Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
1c0af7fb
U
uni-api
项目概览
DCloud
/
uni-api
通知
776
Star
31
Fork
22
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1c0af7fb
编写于
2月 20, 2025
作者:
M
mehaotian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复 root 类型警告问题
上级
54fb48e1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
58 addition
and
52 deletion
+58
-52
uni_modules/uni-stat/changelog.md
uni_modules/uni-stat/changelog.md
+2
-0
uni_modules/uni-stat/package.json
uni_modules/uni-stat/package.json
+1
-1
uni_modules/uni-stat/utssdk/common/config.uts
uni_modules/uni-stat/utssdk/common/config.uts
+1
-1
uni_modules/uni-stat/utssdk/common/core/report.uts
uni_modules/uni-stat/utssdk/common/core/report.uts
+1
-1
uni_modules/uni-stat/utssdk/common/core/stat.uts
uni_modules/uni-stat/utssdk/common/core/stat.uts
+1
-2
uni_modules/uni-stat/utssdk/common/utils/index.uts
uni_modules/uni-stat/utssdk/common/utils/index.uts
+1
-0
uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts
uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts
+51
-47
未找到文件。
uni_modules/uni-stat/changelog.md
浏览文件 @
1c0af7fb
## 1.0.8(2025-02-20)
-
修复 root 类型警告的问题
## 1.0.7(2025-02-18)
## 1.0.7(2025-02-18)
-
新增 崩溃日志统计(暂不支持查看详细崩溃信息)
-
新增 崩溃日志统计(暂不支持查看详细崩溃信息)
## 1.0.6(2025-01-02)
## 1.0.6(2025-01-02)
...
...
uni_modules/uni-stat/package.json
浏览文件 @
1c0af7fb
{
{
"id"
:
"uni-stat"
,
"id"
:
"uni-stat"
,
"displayName"
:
"uni统计 for uni-app x"
,
"displayName"
:
"uni统计 for uni-app x"
,
"version"
:
"1.0.
7
"
,
"version"
:
"1.0.
8
"
,
"description"
:
"uni统计的uni-app x 版本"
,
"description"
:
"uni统计的uni-app x 版本"
,
"keywords"
:
[
"keywords"
:
[
"uni-stat"
,
"uni-stat"
,
...
...
uni_modules/uni-stat/utssdk/common/config.uts
浏览文件 @
1c0af7fb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import { UniStatOptions, UniStatCollectItemsOptions } from '../interface.uts'
import { UniStatOptions, UniStatCollectItemsOptions } from '../interface.uts'
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
// 访问开始即启动小程序,访问结束结分为:进入后台超过5min、在前台无任何操作超过30min、在新的来源打开小程序;
export const sys = uni.getSystemInfoSync()
export const sys = uni.getSystemInfoSync()
export const device = uni.getDeviceInfo()
export const device = uni.getDeviceInfo()
export const sysAppBase = uni.getAppBaseInfo();
export const sysAppBase = uni.getAppBaseInfo();
export const STAT_VERSION = sys.uniCompilerVersion
export const STAT_VERSION = sys.uniCompilerVersion
...
...
uni_modules/uni-stat/utssdk/common/core/report.uts
浏览文件 @
1c0af7fb
...
@@ -357,7 +357,7 @@ export class Report {
...
@@ -357,7 +357,7 @@ export class Report {
"sv": statdata.sv, // 系统版本名称
"sv": statdata.sv, // 系统版本名称
"brand":statdata.brand, // 手机品牌
"brand":statdata.brand, // 手机品牌
"md": statdata.md, // 手机型号
"md": statdata.md, // 手机型号
"root": statdata.root
? 0 : 1
, // 是否root
"root": statdata.root, // 是否root
// "batlevel": "", // 设备电池电量
// "batlevel": "", // 设备电池电量
// "battemp": "", // 电池温度
// "battemp": "", // 电池温度
// "memuse": "", // 系统已使用内存
// "memuse": "", // 系统已使用内存
...
...
uni_modules/uni-stat/utssdk/common/core/stat.uts
浏览文件 @
1c0af7fb
...
@@ -82,11 +82,10 @@ export class Stat {
...
@@ -82,11 +82,10 @@ export class Stat {
const uniStatConfig = Config.getOptions()
const uniStatConfig = Config.getOptions()
// 设置上报周期时间
// 设置上报周期时间
this.report.eportInterval = uniStatConfig.reportInterval ?? 10
this.report.eportInterval = uniStatConfig.reportInterval ?? 10
// #ifdef APP
// #ifdef APP
// 获取崩溃日志
// 获取崩溃日志
get_crash_logs((logs)=>{
get_crash_logs((logs)=>{
console.log('----- logs',logs);
this.registerEvent(StatType.Crash, null, logs)
this.registerEvent(StatType.Crash, null, logs)
})
})
// #endif
// #endif
...
...
uni_modules/uni-stat/utssdk/common/utils/index.uts
浏览文件 @
1c0af7fb
...
@@ -171,6 +171,7 @@ function getEventData(lt : string, elm : StatDefault) : any {
...
@@ -171,6 +171,7 @@ function getEventData(lt : string, elm : StatDefault) : any {
break
break
case '31': // 应用错误
case '31': // 应用错误
data = FilterParam(ErrorParamsKeys, elm)
data = FilterParam(ErrorParamsKeys, elm)
break
case '41': // 崩溃
case '41': // 崩溃
data = FilterParam(CrashParamsKeys, elm)
data = FilterParam(CrashParamsKeys, elm)
break
break
...
...
uni_modules/uni-stat/utssdk/common/utils/pageInfo.uts
浏览文件 @
1c0af7fb
import { OnLaunchOptionsWithCst, RouteParams, StatDefault, ReportErrorCode } from '../../interface.uts'
import { OnLaunchOptionsWithCst, RouteParams, StatDefault, ReportErrorCode } from '../../interface.uts'
import { STAT_VERSION, sys, device,sysAppBase, Config } from '../config.uts'
import { STAT_VERSION, sys, device,
sysAppBase, Config } from '../config.uts'
// import Config from '../config.uts'
// import Config from '../config.uts'
import { get_time } from './pageTime.uts'
import { get_time } from './pageTime.uts'
import { dbGet, dbSet } from './db.uts'
import { dbGet, dbSet } from './db.uts'
...
@@ -318,6 +318,12 @@ export const is_handle_device = () : boolean => {
...
@@ -318,6 +318,12 @@ export const is_handle_device = () : boolean => {
* 获取上报数据默认值
* 获取上报数据默认值
*/
*/
export const get_default_data = () : StatDefault => {
export const get_default_data = () : StatDefault => {
let isRoot : number
if (device.isRoot == true) {
isRoot = 1
} else {
isRoot = 0
}
let statData : StatDefault = {
let statData : StatDefault = {
uuid: get_uuid(),
uuid: get_uuid(),
...
@@ -348,9 +354,9 @@ export const get_default_data = () : StatDefault => {
...
@@ -348,9 +354,9 @@ export const get_default_data = () : StatDefault => {
lat: '',
lat: '',
lng: '',
lng: '',
net: '',
net: '',
odid: '',
odid: '',
pv: sysAppBase.appVersion,
pv: sysAppBase.appVersion,
root:
device.
isRoot
root: isRoot
}
}
return statData
return statData
}
}
...
@@ -442,48 +448,46 @@ export const is_push_clientid = () : boolean => {
...
@@ -442,48 +448,46 @@ export const is_push_clientid = () : boolean => {
/**
/**
* 获取崩溃日志文件地址
* 获取崩溃日志文件地址
*/
*/
export const get_crash_logs = (fn:(value:string[])=>void) => {
export const get_crash_logs = (fn : (value : string[]) => void) => {
const crash_data = uni.__getAppCrashInfo()
const crash_data = uni.__getAppCrashInfo()
console.log('101 ------',crash_data);
if (crash_data != null && crash_data.length > 0) {
if (crash_data != null && crash_data.length > 0) {
const sysManager = uni.getFileSystemManager();
const sysManager = uni.getFileSystemManager();
const reportLogs : Promise<string>[] = []
const reportLogs : Promise<string>[] = []
for (let i = 0; i < crash_data.length; i++) {
for (let i = 0; i < crash_data.length; i++) {
const item = crash_data[i];
const item = crash_data[i];
let file_text:string;
console.log('-----',item);
// #ifdef APP-ANDROID
let file_text = '';
file_text = item.get('file') as string
// #ifdef APP-ANDROID
// #endif
file_text = item.get('file') as string
// #ifdef APP-IOS
// #endif
file_text = item.file as string
// #ifdef APP-IOS
// #endif
file_text = item.file as string
// #endif
const logPromise = new Promise<string>((resolve, reject) => {
sysManager.readFile({
const logPromise = new Promise<string>((resolve, reject) => {
filePath: file_text,
sysManager.readFile({
encoding: 'utf-8',
filePath: file_text,
success: (res) => {
encoding: 'utf-8',
const crash_text = res.data as string
success: (res) => {
resolve(crash_text); // 成功上报后 resolve
const crash_text = res.data as string
},
resolve(crash_text); // 成功上报后 resolve
fail: (err : any) => {
},
reject(err); // 读取文件失败时 reject
fail: (err : any) => {
}
reject(err); // 读取文件失败时 reject
});
}
});
});
});
reportLogs.push(logPromise);
}
reportLogs.push(logPromise);
}
Promise.all(reportLogs)
.then((res) => {
Promise.all(reportLogs)
fn(res)
.then((res) => {
})
fn(res)
.catch((err) => {
})
console.log('Errorlogs:', err);
.catch((err) => {
});
console.log('Errorlogs:', err);
}
});
}
}
}
...
@@ -530,4 +534,4 @@ export const calibration = (eventName : string, options : any | null) : ReportEr
...
@@ -530,4 +534,4 @@ export const calibration = (eventName : string, options : any | null) : ReportEr
return 61008
return 61008
}
}
return null
return null
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录