deeke-script-app 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@deekeScript/@type/Class/Global.d.ts +1 -1
- package/@deekeScript/@type/Class/Rect.d.ts +16 -16
- package/@deekeScript/@type/Class/UiSelector.d.ts +201 -201
- package/@deekeScript/@type/Class/WebSocket.d.ts +49 -49
- package/@deekeScript/@type/interface/Access.d.ts +71 -71
- package/@deekeScript/@type/interface/Device.d.ts +88 -88
- package/@deekeScript/@type/interface/Encrypt.d.ts +58 -58
- package/@deekeScript/@type/interface/Engines.d.ts +39 -34
- package/@deekeScript/@type/interface/FloatDialogs.d.ts +10 -0
- package/@deekeScript/@type/interface/ForegroundServiceBridge.d.ts +31 -31
- package/@deekeScript/@type/interface/Hid.d.ts +342 -342
- package/@deekeScript/@type/interface/Http.d.ts +41 -41
- package/@deekeScript/@type/interface/Images.d.ts +71 -71
- package/@deekeScript/@type/interface/Java.d.ts +7 -7
- package/@deekeScript/@type/interface/KeyBoards.d.ts +27 -27
- package/@deekeScript/@type/interface/Log.d.ts +16 -16
- package/@deekeScript/@type/interface/NotificationBridge.d.ts +28 -28
- package/@deekeScript/@type/interface/{SocketIoClient.d.ts → SocketIOClient.d.ts} +76 -76
- package/@deekeScript/@type/interface/System.d.ts +3 -2
- package/@deekeScript/@type/interface/UiObject.d.ts +290 -290
- package/README.md +67 -67
- package/deekeScript.json +669 -611
- package/deekeScriptZipBuild +48 -48
- package/gulpfile +17 -17
- package/images/test/statistics.png +0 -0
- package/init +32 -32
- package/jsconfig.json +11 -11
- package/package.json +42 -42
- package/script/9/common/util.js +20 -0
- package/script/9/dy/common/common.js +10 -0
- package/script/9/dy/common/version.js +4 -0
- package/script/9/dy/common/video.js +8 -0
- package/script/9/dy/task/taskOne.js +7 -0
- package/script/9/dy/version/310701.js +7 -0
- package/script/index.js +0 -1
- package/script/statistics/statistics.js +120 -120
- package/script/task/douyin_zan.js +38 -0
- package/script/task/dy.js +7 -14
- package/script/task/dyApp.js +7 -7
- package/script/task/dyCity.js +1 -1
- package/script/task/tool.js +10 -19
- package/script/task.html +4 -4
- package/script/test/2.js +1 -0
- package/script/test/5.js +3 -0
- package/script/test/8.js +17 -0
- package/src/12/main.js +40 -0
- package/src/12/task.js +10 -0
- package/src/9/common/util.js +28 -0
- package/src/9/dy/common/common.js +13 -0
- package/src/9/dy/common/version.js +12 -0
- package/src/9/dy/common/video.js +14 -0
- package/src/9/dy/task/taskOne.js +13 -0
- package/src/9/dy/version/310701.js +7 -0
- package/src/statistics/statistics.js +120 -120
- package/src/task/douyin_zan.js +89 -0
- package/src/task/dy.js +14 -14
- package/src/task/dyApp.js +7 -7
- package/src/task/tool.js +19 -19
- package/src/task.html +4 -4
- package/src/test/2.js +2 -0
- package/src/test/5.js +4 -0
- package/src/test/8.js +36 -0
- package/test/2.0/engines/enginesSimple.js +72 -72
- package/test/2.js +6 -6
- package/test/Access.js +9 -9
- package/test/SocketIOClient.js +39 -39
- package/test/SocketIOServer.js +49 -49
- package/test/Storage.js +3 -3
- package/test/console.js +5 -5
- package/test/deekeScriptJson.js +5 -5
- package/test/device.js +11 -11
- package/test/encrypt.js +3 -3
- package/test/engines/1.js +4 -4
- package/test/engines/eng/1.js +8 -8
- package/test/engines/engines.js +6 -6
- package/test/engines/relative.dir.js +8 -8
- package/test/engines/relative.js +1 -1
- package/test/engines/test.js +6 -6
- package/test/engines.js +5 -5
- package/test/extension.js +27 -27
- package/test/files.js +7 -7
- package/test/foreground.js +23 -23
- package/test/http.js +19 -19
- package/test/images/findColor.js +15 -15
- package/test/java.js +28 -28
- package/test/log.js +10 -10
- package/test/module/module.js +4 -4
- package/test/notification.js +26 -26
- package/test/package.js +3 -3
- package/test/permise.js +29 -29
- package/test/thread.js +11 -11
- package/test/timer.close.js +27 -27
- package/test/timer.js +25 -25
- package/test/timer.stop.js +28 -28
- package/test/webSocket.js +22 -22
- package/uglify-config.json +15 -15
package/deekeScriptZipBuild
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
const path = require('path'); // CommonJS 方式引入 path:ml-citation{ref="1,2" data="citationList"}
|
|
2
|
-
const fs = require('fs'); // 引入 fs 模块:ml-citation{ref="5" data="citationList"}
|
|
3
|
-
const AdmZip = require('adm-zip'); // 引入 adm-zip 库:ml-citation{ref="3,4" data="citationList"}
|
|
4
|
-
|
|
5
|
-
// 获取上层目录路径
|
|
6
|
-
// const parentDir = path.join(__dirname, '..');
|
|
7
|
-
const parentDir = __dirname;
|
|
8
|
-
console.log('开始执行打包');
|
|
9
|
-
|
|
10
|
-
fs.unlink(path.join(parentDir, 'deekeScript.zip'), (err) => {
|
|
11
|
-
if (err) {
|
|
12
|
-
//没有文件
|
|
13
|
-
} else {
|
|
14
|
-
//console.log('deekeScript.zip文件已删除');
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// 创建 zip 实例
|
|
19
|
-
const zip = new AdmZip();
|
|
20
|
-
|
|
21
|
-
// 递归添加文件并排除目录
|
|
22
|
-
function addFilesToZip(directory) {
|
|
23
|
-
const files = fs.readdirSync(directory);
|
|
24
|
-
|
|
25
|
-
files.forEach(file => {
|
|
26
|
-
const fullPath = path.join(directory, file);
|
|
27
|
-
const relativePath = path.relative(parentDir, fullPath);
|
|
28
|
-
|
|
29
|
-
// 排除 DeekeScript 和 node_modules 目录
|
|
30
|
-
if (relativePath.startsWith('src') || relativePath.startsWith('.vscode') || relativePath.startsWith('.git') || relativePath.startsWith('@deekeScript') || relativePath.startsWith('node_modules')) {
|
|
31
|
-
console.log('排除目录:' + relativePath);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// 处理子目录或文件
|
|
36
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
37
|
-
addFilesToZip(fullPath); // 递归处理子目录
|
|
38
|
-
} else {
|
|
39
|
-
zip.addLocalFile(fullPath, path.dirname(relativePath));
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 执行压缩
|
|
45
|
-
addFilesToZip(parentDir);
|
|
46
|
-
zip.writeZip(path.join(parentDir, 'deekeScript.zip'));
|
|
47
|
-
|
|
48
|
-
console.log('打包完成');
|
|
1
|
+
const path = require('path'); // CommonJS 方式引入 path:ml-citation{ref="1,2" data="citationList"}
|
|
2
|
+
const fs = require('fs'); // 引入 fs 模块:ml-citation{ref="5" data="citationList"}
|
|
3
|
+
const AdmZip = require('adm-zip'); // 引入 adm-zip 库:ml-citation{ref="3,4" data="citationList"}
|
|
4
|
+
|
|
5
|
+
// 获取上层目录路径
|
|
6
|
+
// const parentDir = path.join(__dirname, '..');
|
|
7
|
+
const parentDir = __dirname;
|
|
8
|
+
console.log('开始执行打包');
|
|
9
|
+
|
|
10
|
+
fs.unlink(path.join(parentDir, 'deekeScript.zip'), (err) => {
|
|
11
|
+
if (err) {
|
|
12
|
+
//没有文件
|
|
13
|
+
} else {
|
|
14
|
+
//console.log('deekeScript.zip文件已删除');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// 创建 zip 实例
|
|
19
|
+
const zip = new AdmZip();
|
|
20
|
+
|
|
21
|
+
// 递归添加文件并排除目录
|
|
22
|
+
function addFilesToZip(directory) {
|
|
23
|
+
const files = fs.readdirSync(directory);
|
|
24
|
+
|
|
25
|
+
files.forEach(file => {
|
|
26
|
+
const fullPath = path.join(directory, file);
|
|
27
|
+
const relativePath = path.relative(parentDir, fullPath);
|
|
28
|
+
|
|
29
|
+
// 排除 DeekeScript 和 node_modules 目录
|
|
30
|
+
if (relativePath.startsWith('src') || relativePath.startsWith('.vscode') || relativePath.startsWith('.git') || relativePath.startsWith('@deekeScript') || relativePath.startsWith('node_modules')) {
|
|
31
|
+
console.log('排除目录:' + relativePath);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 处理子目录或文件
|
|
36
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
37
|
+
addFilesToZip(fullPath); // 递归处理子目录
|
|
38
|
+
} else {
|
|
39
|
+
zip.addLocalFile(fullPath, path.dirname(relativePath));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 执行压缩
|
|
45
|
+
addFilesToZip(parentDir);
|
|
46
|
+
zip.writeZip(path.join(parentDir, 'deekeScript.zip'));
|
|
47
|
+
|
|
48
|
+
console.log('打包完成');
|
package/gulpfile
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const uglifyConfig = require('./uglify-config.json');
|
|
2
|
-
const gulp = require('gulp');
|
|
3
|
-
const uglify = require('gulp-uglify');
|
|
4
|
-
|
|
5
|
-
function compressJS() {
|
|
6
|
-
let config = ['script/**/*.js'];//需要混淆的文件
|
|
7
|
-
//不需要混淆
|
|
8
|
-
let exclude = [
|
|
9
|
-
"!script/statistics/*.js"
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
config = [...config, ...exclude];
|
|
13
|
-
return gulp.src(config).pipe(uglify(uglifyConfig)) // 应用 JSON 配置
|
|
14
|
-
.pipe(gulp.dest('script'));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
compressJS();
|
|
1
|
+
const uglifyConfig = require('./uglify-config.json');
|
|
2
|
+
const gulp = require('gulp');
|
|
3
|
+
const uglify = require('gulp-uglify');
|
|
4
|
+
|
|
5
|
+
function compressJS() {
|
|
6
|
+
let config = ['script/**/*.js'];//需要混淆的文件
|
|
7
|
+
//不需要混淆
|
|
8
|
+
let exclude = [
|
|
9
|
+
"!script/statistics/*.js"
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
config = [...config, ...exclude];
|
|
13
|
+
return gulp.src(config).pipe(uglify(uglifyConfig)) // 应用 JSON 配置
|
|
14
|
+
.pipe(gulp.dest('script'));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
compressJS();
|
|
Binary file
|
package/init
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
function generateFiles(answers) {
|
|
5
|
-
const projectPath = path.dirname(path.dirname(__dirname)); // 输出:/Users/username/project
|
|
6
|
-
const files = fs.readdirSync(projectPath);
|
|
7
|
-
|
|
8
|
-
if (files.includes('init.lock')) {
|
|
9
|
-
return ;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const entries = fs.readdirSync(__dirname, { withFileTypes: true });
|
|
13
|
-
const excludeFiles = ['node_modules']; // 需排除的文件名列表
|
|
14
|
-
|
|
15
|
-
const filteredEntries = entries.filter(entry =>
|
|
16
|
-
!excludeFiles.includes(entry.name)
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
filteredEntries.forEach(entry => {
|
|
20
|
-
const srcPath = path.join(__dirname, entry.name);
|
|
21
|
-
const destPath = path.join(projectPath, entry.name);
|
|
22
|
-
|
|
23
|
-
if (entry.isFile()) {
|
|
24
|
-
fs.copyFileSync(srcPath, destPath);
|
|
25
|
-
} else if (entry.isDirectory()) {
|
|
26
|
-
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
generateFiles({});
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
function generateFiles(answers) {
|
|
5
|
+
const projectPath = path.dirname(path.dirname(__dirname)); // 输出:/Users/username/project
|
|
6
|
+
const files = fs.readdirSync(projectPath);
|
|
7
|
+
|
|
8
|
+
if (files.includes('init.lock')) {
|
|
9
|
+
return ;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const entries = fs.readdirSync(__dirname, { withFileTypes: true });
|
|
13
|
+
const excludeFiles = ['node_modules']; // 需排除的文件名列表
|
|
14
|
+
|
|
15
|
+
const filteredEntries = entries.filter(entry =>
|
|
16
|
+
!excludeFiles.includes(entry.name)
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
filteredEntries.forEach(entry => {
|
|
20
|
+
const srcPath = path.join(__dirname, entry.name);
|
|
21
|
+
const destPath = path.join(projectPath, entry.name);
|
|
22
|
+
|
|
23
|
+
if (entry.isFile()) {
|
|
24
|
+
fs.copyFileSync(srcPath, destPath);
|
|
25
|
+
} else if (entry.isDirectory()) {
|
|
26
|
+
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
generateFiles({});
|
package/jsconfig.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES6",
|
|
4
|
-
"lib": ["es6"], // 不包含 "dom"
|
|
5
|
-
"checkJs": true
|
|
6
|
-
},
|
|
7
|
-
"include": [
|
|
8
|
-
"src/**/*",
|
|
9
|
-
"test/**/*",
|
|
10
|
-
"@deekeScript/**/*"
|
|
11
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"lib": ["es6"], // 不包含 "dom"
|
|
5
|
+
"checkJs": true
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"src/**/*",
|
|
9
|
+
"test/**/*",
|
|
10
|
+
"@deekeScript/**/*"
|
|
11
|
+
]
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "deeke-script-app",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"description": "DeekeScript应用",
|
|
5
|
-
"main": "src/index.ts",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "cpx \"src/**/*\" script",
|
|
8
|
-
"build-zip": "cpx \"src/**/*\" script && ts-node --esm ./deekeScriptZipBuild",
|
|
9
|
-
"build-obfuscator": "cpx \"src/**/*\" script && ts-node --esm ./gulpfile",
|
|
10
|
-
"build-obfuscator-zip": "cpx \"src/**/*\" script && ts-node --esm ./gulpfile && ts-node --esm ./deekeScriptZipBuild",
|
|
11
|
-
"postinstall": "ts-node --esm init"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/DeekeScript/deekeScript.git"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"DeekeScript应用"
|
|
19
|
-
],
|
|
20
|
-
"author": "DeekeScript",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/DeekeScript/deekeScript/issues"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/DeekeScript/deekeScript#readme",
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/adm-zip": "^0.5.7",
|
|
28
|
-
"@types/node": "^22.13.9",
|
|
29
|
-
"file-loader": "^6.2.0",
|
|
30
|
-
"glob": "^11.0.0",
|
|
31
|
-
"gulp": "^5.0.0",
|
|
32
|
-
"gulp-uglify": "^3.0.2",
|
|
33
|
-
"ts-loader": "^9.5.1",
|
|
34
|
-
"typescript": "^5.8.2"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"adm-zip": "^0.5.16",
|
|
38
|
-
"cpx": "^1.5.0",
|
|
39
|
-
"socket.io": "^4.8.1",
|
|
40
|
-
"ts-node": "^10.9.2"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "deeke-script-app",
|
|
3
|
+
"version": "1.6.3",
|
|
4
|
+
"description": "DeekeScript应用",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "cpx \"src/**/*\" script",
|
|
8
|
+
"build-zip": "cpx \"src/**/*\" script && ts-node --esm ./deekeScriptZipBuild",
|
|
9
|
+
"build-obfuscator": "cpx \"src/**/*\" script && ts-node --esm ./gulpfile",
|
|
10
|
+
"build-obfuscator-zip": "cpx \"src/**/*\" script && ts-node --esm ./gulpfile && ts-node --esm ./deekeScriptZipBuild",
|
|
11
|
+
"postinstall": "ts-node --esm init"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/DeekeScript/deekeScript.git"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"DeekeScript应用"
|
|
19
|
+
],
|
|
20
|
+
"author": "DeekeScript",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/DeekeScript/deekeScript/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/DeekeScript/deekeScript#readme",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/adm-zip": "^0.5.7",
|
|
28
|
+
"@types/node": "^22.13.9",
|
|
29
|
+
"file-loader": "^6.2.0",
|
|
30
|
+
"glob": "^11.0.0",
|
|
31
|
+
"gulp": "^5.0.0",
|
|
32
|
+
"gulp-uglify": "^3.0.2",
|
|
33
|
+
"ts-loader": "^9.5.1",
|
|
34
|
+
"typescript": "^5.8.2"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"adm-zip": "^0.5.16",
|
|
38
|
+
"cpx": "^1.5.0",
|
|
39
|
+
"socket.io": "^4.8.1",
|
|
40
|
+
"ts-node": "^10.9.2"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let e = {
|
|
2
|
+
setLog(e) {
|
|
3
|
+
Log.setFile(e);
|
|
4
|
+
},
|
|
5
|
+
log() {
|
|
6
|
+
Log.log(arguments), console.log(arguments);
|
|
7
|
+
},
|
|
8
|
+
click(e) {
|
|
9
|
+
this.log("点击了控件:", e), Gesture.click(e.bounds().left + Math.random() * e.bounds().width(), e.bounds().top + Math.random() * e.bounds().height());
|
|
10
|
+
},
|
|
11
|
+
input(e, t) {
|
|
12
|
+
e.setText(t);
|
|
13
|
+
},
|
|
14
|
+
swipe() {
|
|
15
|
+
var e = Device.height() * (.6 + .2 * Math.random()), t = Device.height() * (.2 + .2 * Math.random()), o = Math.random() * Device.width() * .6 + .2 * Device.width();
|
|
16
|
+
Gesture.swipe(o, e, o + .1 * Device.width(), t, 200 + 100 * Math.random());
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = e;
|
package/script/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//这个文件不用编写代码
|
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
var deekeStatistics = {
|
|
2
|
-
getDate() {
|
|
3
|
-
let d = new Date();
|
|
4
|
-
let m = d.getMonth() + 1;
|
|
5
|
-
let date = d.getDate();
|
|
6
|
-
return (m >= 10 ? m : ('0' + m)) + '.' + (date >= 10 ? date : ('0' + date));
|
|
7
|
-
},
|
|
8
|
-
getData(time) {
|
|
9
|
-
time = time || this.getDate();
|
|
10
|
-
return {
|
|
11
|
-
s_viewVideo: Storage.getInteger('s_viewVideo' + time) || 0,
|
|
12
|
-
s_viewTargetVideo: Storage.getInteger('s_viewTargetVideo' + time) || 0,
|
|
13
|
-
s_zan: Storage.getInteger('s_zan' + time) || 0,
|
|
14
|
-
s_comment: Storage.getInteger('s_comment' + time) || 0,
|
|
15
|
-
s_zanComment: Storage.getInteger('s_zanComment' + time) || 0,
|
|
16
|
-
s_privateMsg: Storage.getInteger('s_privateMsg' + time) || 0,
|
|
17
|
-
s_focus: Storage.getInteger('s_focus' + time) || 0,
|
|
18
|
-
s_viewUser: Storage.getInteger('s_viewUser' + time) || 0,
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
getWeekDate() {
|
|
22
|
-
let dates = [];
|
|
23
|
-
// 获取当前日期
|
|
24
|
-
let now = new Date();
|
|
25
|
-
// 循环获取最近 7 天的日期
|
|
26
|
-
for (let i = 1; i <= 7; i++) {
|
|
27
|
-
// 获取当前日期的时间戳
|
|
28
|
-
let timestamp = now.getTime();
|
|
29
|
-
// 计算 i 天前的时间戳
|
|
30
|
-
let dayTimestamp = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
|
31
|
-
let iDayAgoTimestamp = timestamp - i * dayTimestamp;
|
|
32
|
-
// 转换为日期对象
|
|
33
|
-
let date = new Date(iDayAgoTimestamp);
|
|
34
|
-
// 格式化日期为 "yyyy-MM-dd" 的字符串并存入数组
|
|
35
|
-
//let year = date.getFullYear();
|
|
36
|
-
let month = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
37
|
-
let day = ("0" + date.getDate()).slice(-2);
|
|
38
|
-
dates.push(month + "." + day);
|
|
39
|
-
}
|
|
40
|
-
return dates;
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
getWeekData() {
|
|
44
|
-
let dates = this.getWeekDate();
|
|
45
|
-
let data = [];
|
|
46
|
-
for (let i in dates) {
|
|
47
|
-
data.push([dates[i], this.getData(dates[i])]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//数据整理
|
|
51
|
-
let res = [];
|
|
52
|
-
let ids = ['s_viewVideo', 's_viewTargetVideo', 's_zan', 's_comment', 's_zanComment', 's_privateMsg', 's_focus', 's_viewUser'];
|
|
53
|
-
for (let i in ids) {
|
|
54
|
-
res[ids[i]] = [];
|
|
55
|
-
for (let j = data.length - 1; j >= 0; j--) {
|
|
56
|
-
res[ids[i]].push([data[j][0], data[j][1][ids[i]]]);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return res;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
dataList() {
|
|
63
|
-
let data = this.getData(this.getDate());
|
|
64
|
-
let weekData = this.getWeekData();
|
|
65
|
-
//weight最大24
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
'title': '今日累计视频',
|
|
69
|
-
'weight': 12,
|
|
70
|
-
'checked': true,
|
|
71
|
-
'value': data['s_viewVideo'],
|
|
72
|
-
'data': weekData['s_viewVideo'],
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
'title': '今日目标视频',
|
|
76
|
-
'weight': 12,
|
|
77
|
-
'value': data['s_viewTargetVideo'],
|
|
78
|
-
'data': weekData['s_viewTargetVideo'],
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
'title': '今日点赞',
|
|
82
|
-
'weight': 8,
|
|
83
|
-
'value': data['s_zan'],
|
|
84
|
-
'data': weekData['s_zan'],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
'title': '今日评论',
|
|
88
|
-
'count': 1,
|
|
89
|
-
'weight': 8,
|
|
90
|
-
'value': data['s_comment'],
|
|
91
|
-
'data': weekData['s_comment'],
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
'title': '今日赞评论',
|
|
95
|
-
'weight': 8,
|
|
96
|
-
'value': data['s_zanComment'],
|
|
97
|
-
'data': weekData['s_zanComment'],
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
'title': '今日私信',
|
|
101
|
-
'weight': 8,
|
|
102
|
-
'value': data['s_privateMsg'],
|
|
103
|
-
'data': weekData['s_privateMsg'],
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
'title': '今日关注',
|
|
107
|
-
'count': 1,
|
|
108
|
-
'weight': 8,
|
|
109
|
-
'value': data['s_focus'],
|
|
110
|
-
'data': weekData['s_focus'],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
'title': '今日访问',
|
|
114
|
-
'weight': 8,
|
|
115
|
-
'value': data['s_viewUser'],
|
|
116
|
-
'data': weekData['s_viewUser'],
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
}
|
|
120
|
-
}
|
|
1
|
+
var deekeStatistics = {
|
|
2
|
+
getDate() {
|
|
3
|
+
let d = new Date();
|
|
4
|
+
let m = d.getMonth() + 1;
|
|
5
|
+
let date = d.getDate();
|
|
6
|
+
return (m >= 10 ? m : ('0' + m)) + '.' + (date >= 10 ? date : ('0' + date));
|
|
7
|
+
},
|
|
8
|
+
getData(time) {
|
|
9
|
+
time = time || this.getDate();
|
|
10
|
+
return {
|
|
11
|
+
s_viewVideo: Storage.getInteger('s_viewVideo' + time) || 0,
|
|
12
|
+
s_viewTargetVideo: Storage.getInteger('s_viewTargetVideo' + time) || 0,
|
|
13
|
+
s_zan: Storage.getInteger('s_zan' + time) || 0,
|
|
14
|
+
s_comment: Storage.getInteger('s_comment' + time) || 0,
|
|
15
|
+
s_zanComment: Storage.getInteger('s_zanComment' + time) || 0,
|
|
16
|
+
s_privateMsg: Storage.getInteger('s_privateMsg' + time) || 0,
|
|
17
|
+
s_focus: Storage.getInteger('s_focus' + time) || 0,
|
|
18
|
+
s_viewUser: Storage.getInteger('s_viewUser' + time) || 0,
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
getWeekDate() {
|
|
22
|
+
let dates = [];
|
|
23
|
+
// 获取当前日期
|
|
24
|
+
let now = new Date();
|
|
25
|
+
// 循环获取最近 7 天的日期
|
|
26
|
+
for (let i = 1; i <= 7; i++) {
|
|
27
|
+
// 获取当前日期的时间戳
|
|
28
|
+
let timestamp = now.getTime();
|
|
29
|
+
// 计算 i 天前的时间戳
|
|
30
|
+
let dayTimestamp = 24 * 60 * 60 * 1000; // 一天的毫秒数
|
|
31
|
+
let iDayAgoTimestamp = timestamp - i * dayTimestamp;
|
|
32
|
+
// 转换为日期对象
|
|
33
|
+
let date = new Date(iDayAgoTimestamp);
|
|
34
|
+
// 格式化日期为 "yyyy-MM-dd" 的字符串并存入数组
|
|
35
|
+
//let year = date.getFullYear();
|
|
36
|
+
let month = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
37
|
+
let day = ("0" + date.getDate()).slice(-2);
|
|
38
|
+
dates.push(month + "." + day);
|
|
39
|
+
}
|
|
40
|
+
return dates;
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
getWeekData() {
|
|
44
|
+
let dates = this.getWeekDate();
|
|
45
|
+
let data = [];
|
|
46
|
+
for (let i in dates) {
|
|
47
|
+
data.push([dates[i], this.getData(dates[i])]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//数据整理
|
|
51
|
+
let res = [];
|
|
52
|
+
let ids = ['s_viewVideo', 's_viewTargetVideo', 's_zan', 's_comment', 's_zanComment', 's_privateMsg', 's_focus', 's_viewUser'];
|
|
53
|
+
for (let i in ids) {
|
|
54
|
+
res[ids[i]] = [];
|
|
55
|
+
for (let j = data.length - 1; j >= 0; j--) {
|
|
56
|
+
res[ids[i]].push([data[j][0], data[j][1][ids[i]]]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return res;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
dataList() {
|
|
63
|
+
let data = this.getData(this.getDate());
|
|
64
|
+
let weekData = this.getWeekData();
|
|
65
|
+
//weight最大24
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
'title': '今日累计视频',
|
|
69
|
+
'weight': 12,
|
|
70
|
+
'checked': true,
|
|
71
|
+
'value': data['s_viewVideo'],
|
|
72
|
+
'data': weekData['s_viewVideo'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
'title': '今日目标视频',
|
|
76
|
+
'weight': 12,
|
|
77
|
+
'value': data['s_viewTargetVideo'],
|
|
78
|
+
'data': weekData['s_viewTargetVideo'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
'title': '今日点赞',
|
|
82
|
+
'weight': 8,
|
|
83
|
+
'value': data['s_zan'],
|
|
84
|
+
'data': weekData['s_zan'],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
'title': '今日评论',
|
|
88
|
+
'count': 1,
|
|
89
|
+
'weight': 8,
|
|
90
|
+
'value': data['s_comment'],
|
|
91
|
+
'data': weekData['s_comment'],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
'title': '今日赞评论',
|
|
95
|
+
'weight': 8,
|
|
96
|
+
'value': data['s_zanComment'],
|
|
97
|
+
'data': weekData['s_zanComment'],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
'title': '今日私信',
|
|
101
|
+
'weight': 8,
|
|
102
|
+
'value': data['s_privateMsg'],
|
|
103
|
+
'data': weekData['s_privateMsg'],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
'title': '今日关注',
|
|
107
|
+
'count': 1,
|
|
108
|
+
'weight': 8,
|
|
109
|
+
'value': data['s_focus'],
|
|
110
|
+
'data': weekData['s_focus'],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
'title': '今日访问',
|
|
114
|
+
'weight': 8,
|
|
115
|
+
'value': data['s_viewUser'],
|
|
116
|
+
'data': weekData['s_viewUser'],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
}
|