@pixel-shell/elpis 1.0.0
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/.eslintgnore +1 -0
- package/.eslintrc +55 -0
- package/README.md +194 -0
- package/app/controller/base.js +40 -0
- package/app/controller/project.js +56 -0
- package/app/controller/view.js +18 -0
- package/app/extend/logger.js +37 -0
- package/app/middleware/api-params-verify.js +71 -0
- package/app/middleware/api-sign-verify.js +32 -0
- package/app/middleware/error-handler.js +33 -0
- package/app/middleware/project-handler.js +27 -0
- package/app/middleware.js +31 -0
- package/app/pages/asserts/custom.css +12 -0
- package/app/pages/boot.js +47 -0
- package/app/pages/common/curl.js +88 -0
- package/app/pages/common/utils.js +2 -0
- package/app/pages/dashboard/complex-view/header-view/complex-view/sub-menu/sub-menu.vue +17 -0
- package/app/pages/dashboard/complex-view/header-view/header-view.vue +129 -0
- package/app/pages/dashboard/complex-view/iframe-view/iframe-view.vue +43 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/search-panel/search-panel.vue +37 -0
- package/app/pages/dashboard/complex-view/schema-view/complex-view/table-panel/table-panel.vue +114 -0
- package/app/pages/dashboard/complex-view/schema-view/components/component-config.js +22 -0
- package/app/pages/dashboard/complex-view/schema-view/components/create-form/create-form.vue +85 -0
- package/app/pages/dashboard/complex-view/schema-view/components/detail-panel/detail-panel.vue +92 -0
- package/app/pages/dashboard/complex-view/schema-view/components/edit-form/edit-form.vue +106 -0
- package/app/pages/dashboard/complex-view/schema-view/hook/schema.js +123 -0
- package/app/pages/dashboard/complex-view/schema-view/schema-view.vue +88 -0
- package/app/pages/dashboard/complex-view/sider-view/complex-view/sub-menu/sub-menu.vue +18 -0
- package/app/pages/dashboard/complex-view/sider-view/sider-view.vue +117 -0
- package/app/pages/dashboard/dashboard.vue +89 -0
- package/app/pages/dashboard/entry.dashboard.js +42 -0
- package/app/pages/store/index.js +5 -0
- package/app/pages/store/menu.js +57 -0
- package/app/pages/store/project.js +15 -0
- package/app/pages/widgets/header-container/asserts/avatar.png +0 -0
- package/app/pages/widgets/header-container/asserts/logo.png +0 -0
- package/app/pages/widgets/header-container/header-container.vue +102 -0
- package/app/pages/widgets/schema-form/complex-view/input/input.vue +129 -0
- package/app/pages/widgets/schema-form/complex-view/input-number/input-number.vue +130 -0
- package/app/pages/widgets/schema-form/complex-view/select/select.vue +116 -0
- package/app/pages/widgets/schema-form/form-item-config.js +23 -0
- package/app/pages/widgets/schema-form/schema-form.vue +121 -0
- package/app/pages/widgets/schema-search-bar/complex-view/date-range/date-range.vue +41 -0
- package/app/pages/widgets/schema-search-bar/complex-view/dynamic-select/dynamic-select.vue +51 -0
- package/app/pages/widgets/schema-search-bar/complex-view/input/input.vue +34 -0
- package/app/pages/widgets/schema-search-bar/complex-view/select/select.vue +36 -0
- package/app/pages/widgets/schema-search-bar/schema-search-bar.vue +121 -0
- package/app/pages/widgets/schema-search-bar/search-item-config.js +27 -0
- package/app/pages/widgets/schema-table/schema-table.vue +227 -0
- package/app/pages/widgets/sider-container/sider-container.vue +29 -0
- package/app/public/static/logo.png +0 -0
- package/app/public/static/normalize.css +241 -0
- package/app/router/project.js +6 -0
- package/app/router/view.js +8 -0
- package/app/router-schema/project.js +30 -0
- package/app/service/base.js +10 -0
- package/app/service/project.js +40 -0
- package/app/view/entry.tpl +25 -0
- package/app/webpack/build.js +18 -0
- package/app/webpack/config/webpack.base.js +234 -0
- package/app/webpack/config/webpack.dev.js +58 -0
- package/app/webpack/config/webpack.prod.js +113 -0
- package/app/webpack/dev.js +60 -0
- package/app/webpack/libs/blank.js +1 -0
- package/app/webpack/prod.js +22 -0
- package/config/config.default.js +3 -0
- package/docs/dashboard-mode.js +141 -0
- package/elpis-core/env.js +16 -0
- package/elpis-core/index.js +70 -0
- package/elpis-core/loader/config.js +51 -0
- package/elpis-core/loader/controller.js +71 -0
- package/elpis-core/loader/extend.js +61 -0
- package/elpis-core/loader/middleware.js +69 -0
- package/elpis-core/loader/roter-schema.js +54 -0
- package/elpis-core/loader/router.js +42 -0
- package/elpis-core/loader/service.js +70 -0
- package/index.js +35 -0
- package/model/index.js +86 -0
- package/package.json +92 -0
- package/test/controller/project.test.js +194 -0
package/model/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const _ = require("lodash");
|
|
2
|
+
const glob = require("glob");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { sep } = path;
|
|
5
|
+
// project 继承 model 方法
|
|
6
|
+
const projectExtendModel = (model, project) => {
|
|
7
|
+
return _.mergeWith({}, model, project, (modelValue, projValue) => {
|
|
8
|
+
if (Array.isArray(modelValue) && Array.isArray(projValue)) {
|
|
9
|
+
let result = [];
|
|
10
|
+
// project有的键值,model也有的话就修改(重载)
|
|
11
|
+
// project有的键值,model没有的话就新增
|
|
12
|
+
// model有的键值,project没有的话保留(继承)
|
|
13
|
+
|
|
14
|
+
// 处理修改和保留
|
|
15
|
+
for(let i = 0; i < modelValue.length; i++) {
|
|
16
|
+
let modelItem = modelValue[i];
|
|
17
|
+
const projItem = projValue.find((item) => item.key === modelItem.key);
|
|
18
|
+
result.push(projItem ? projectExtendModel(modelItem, projItem) : modelItem);
|
|
19
|
+
}
|
|
20
|
+
// 处理新增
|
|
21
|
+
for(let i = 0; i < projValue.length; i++) {
|
|
22
|
+
let projItem = projValue[i];
|
|
23
|
+
const modelItem = modelValue.find((item) => item.key === projItem.key);
|
|
24
|
+
if (!modelItem) {
|
|
25
|
+
result.push(projItem);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 解析model 配置,并返回阻止且继承后的数据结构
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
module.exports = (app) => {
|
|
38
|
+
const modelList = [];
|
|
39
|
+
|
|
40
|
+
// 遍历当前文件夹,构造模型数据结构,挂载到 modelList 上
|
|
41
|
+
const modelPath = path.resolve(process.cwd(), `.${sep}model`);
|
|
42
|
+
const fileList = glob.sync(path.resolve(modelPath, `.${sep}**${sep}**.js`));
|
|
43
|
+
fileList.forEach((file) => {
|
|
44
|
+
if (file.indexOf("index.js") > -1) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// 区分配置类型(model / project)
|
|
48
|
+
const type = file.indexOf(`${sep}project${sep}`) > -1 ? "project" : "model";
|
|
49
|
+
if (type === "model") {
|
|
50
|
+
const modelKey = file.match(/\/model\/(.*?)\/model\.js/)?.[1];
|
|
51
|
+
let modelItem = modelList.find((item) => item.model?.key === modelKey);
|
|
52
|
+
if (!modelItem) {
|
|
53
|
+
// 初始化 model 数据结构
|
|
54
|
+
modelItem = {};
|
|
55
|
+
modelList.push(modelItem);
|
|
56
|
+
}
|
|
57
|
+
modelItem.model = require(path.resolve(file));
|
|
58
|
+
modelItem.model.key = modelKey; // 挂载 key
|
|
59
|
+
}
|
|
60
|
+
if (type === "project") {
|
|
61
|
+
const modelKey = file.match(/\/model\/(.*?)\/project/)?.[1];
|
|
62
|
+
const projKey = file.match(/\/project\/(.*?)\.js/)?.[1];
|
|
63
|
+
const modelItem = modelList.find((item) => item.model?.key === modelKey);
|
|
64
|
+
if (!modelItem) {
|
|
65
|
+
// 初始化 model 数据结构
|
|
66
|
+
modelItem = {};
|
|
67
|
+
modelList.push(modelItem);
|
|
68
|
+
}
|
|
69
|
+
if (!modelItem.project) {
|
|
70
|
+
// 初始化 project 数据结构
|
|
71
|
+
modelItem.project = {};
|
|
72
|
+
}
|
|
73
|
+
modelItem.project[projKey] = require(path.resolve(file));
|
|
74
|
+
modelItem.project[projKey].key = projKey; // 挂载 key
|
|
75
|
+
modelItem.project[projKey].modelKey = modelKey; // 挂载 modelKey
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// 数据处理,project 继承 model
|
|
79
|
+
modelList.forEach((item) => {
|
|
80
|
+
const { model, project } = item;
|
|
81
|
+
for (const key in project) {
|
|
82
|
+
project[key] = projectExtendModel(model, project[key]);
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
return modelList;
|
|
86
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pixel-shell/elpis",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint --quiet --ext js,vue .",
|
|
8
|
+
"test": "_ENV='local' mocha 'test/**/*.js'"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://git.code.tencent.com/changdong/Elpis.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "小东",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@babel/core": "^7.24.0",
|
|
18
|
+
"@babel/runtime": "^7.29.7",
|
|
19
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
20
|
+
"ajv": "^6.10.2",
|
|
21
|
+
"axios": "^0.19.2",
|
|
22
|
+
"echarts": "^5.5.0",
|
|
23
|
+
"element-plus": "^2.3.7",
|
|
24
|
+
"generate-password": "^1.7.1",
|
|
25
|
+
"glob": "^7.1.4",
|
|
26
|
+
"jsonwebtoken": "^9.0.2",
|
|
27
|
+
"knex": "^0.19.0",
|
|
28
|
+
"koa": "2.7.0",
|
|
29
|
+
"koa-bodyparser": "^4.2.1",
|
|
30
|
+
"koa-nunjucks-2": "^3.0.2",
|
|
31
|
+
"koa-router": "^7.4.0",
|
|
32
|
+
"koa-static": "^5.0.0",
|
|
33
|
+
"koa-useragent": "2.0.0",
|
|
34
|
+
"koa2-cors": "^2.0.6",
|
|
35
|
+
"less": "^3.8.1",
|
|
36
|
+
"lodash": "^4.17.21",
|
|
37
|
+
"log4js": "^6.9.1",
|
|
38
|
+
"md5": "^2.2.1",
|
|
39
|
+
"moment": "^2.29.4",
|
|
40
|
+
"mysql": "^2.18.1",
|
|
41
|
+
"node-schedule": "^2.1.1",
|
|
42
|
+
"nodemon": "^1.19.2",
|
|
43
|
+
"path": "^0.12.7",
|
|
44
|
+
"pinia": "^2.1.6",
|
|
45
|
+
"superagent": "^8.1.2",
|
|
46
|
+
"vue": "^3.3.4",
|
|
47
|
+
"vue-json-viewer": "^3.0.4",
|
|
48
|
+
"vue-router": "^4.2.4",
|
|
49
|
+
"vuex": "^4.1.0",
|
|
50
|
+
"@babel/plugin-transform-runtime": "^7.1.0",
|
|
51
|
+
"@babel/preset-env": "^7.4.5",
|
|
52
|
+
"babel-loader": "^8.0.4",
|
|
53
|
+
"clean-webpack-plugin": "^0.1.19",
|
|
54
|
+
"consoler": "^0.2.0",
|
|
55
|
+
"css-loader": "^0.23.1",
|
|
56
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
57
|
+
"directory-named-webpack-plugin": "^4.0.1",
|
|
58
|
+
"express": "^4.18.2",
|
|
59
|
+
"file-loader": "^6.2.0",
|
|
60
|
+
"happypack": "^5.0.1",
|
|
61
|
+
"html-webpack-inject-attributes-plugin": "^1.0.1",
|
|
62
|
+
"html-webpack-plugin": "^5.5.3",
|
|
63
|
+
"less-loader": "^11.1.3",
|
|
64
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
65
|
+
"style-loader": "^0.14.1",
|
|
66
|
+
"terser-webpack-plugin": "^5.6.1",
|
|
67
|
+
"url-loader": "^4.1.1",
|
|
68
|
+
"vue-loader": "^17.2.2",
|
|
69
|
+
"vue-style-loader": "^4.1.2",
|
|
70
|
+
"webpack": "^5.88.1",
|
|
71
|
+
"webpack-dev-middleware": "^6.1.1",
|
|
72
|
+
"webpack-hot-middleware": "^2.25.4",
|
|
73
|
+
"webpack-merge": "^4.2.1"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"assert": "^2.0.0",
|
|
77
|
+
"babel-eslint": "^10.0.2",
|
|
78
|
+
"eslint": "^7.32.0",
|
|
79
|
+
"eslint-plugin-import": "^2.28.1",
|
|
80
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
81
|
+
"ghooks": "~1.0.3",
|
|
82
|
+
"mocha": "^6.1.4",
|
|
83
|
+
"supertest": "^4.0.2",
|
|
84
|
+
"validate-commit-msg": "~2.14.0"
|
|
85
|
+
},
|
|
86
|
+
"config": {
|
|
87
|
+
"ghooks": {
|
|
88
|
+
"commit-msg": "validate-commit-msg",
|
|
89
|
+
"pre-commit": "pnpm lint"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
const assert = require("assert");
|
|
2
|
+
const supertest = require("supertest");
|
|
3
|
+
const md5 = require("md5");
|
|
4
|
+
const elpisCore = require("../../elpis-core");
|
|
5
|
+
|
|
6
|
+
const signKey = "hgy3ghj5gyu03ghjk2ghje3kgu4ghj";
|
|
7
|
+
const st = Date.now();
|
|
8
|
+
|
|
9
|
+
describe("Project Controller", function () {
|
|
10
|
+
this.timeout(10000);
|
|
11
|
+
|
|
12
|
+
let modelList;
|
|
13
|
+
const projectList = [];
|
|
14
|
+
|
|
15
|
+
let request;
|
|
16
|
+
|
|
17
|
+
it("启动服务", async () => {
|
|
18
|
+
const app = await elpisCore.start();
|
|
19
|
+
modelList = require("../../model/index.js")(app);
|
|
20
|
+
modelList.forEach((modelItem) => {
|
|
21
|
+
const { project } = modelItem;
|
|
22
|
+
for (const projKey in project) {
|
|
23
|
+
projectList.push(project[projKey]);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
request = supertest(app.listen());
|
|
27
|
+
});
|
|
28
|
+
it("GET /api/project/list without proj_key", async () => {
|
|
29
|
+
let tmpRes = request.get("/api/project/list");
|
|
30
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
31
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
32
|
+
const res = await tmpRes;
|
|
33
|
+
assert(res.body.success === true);
|
|
34
|
+
const resData = res.body.data;
|
|
35
|
+
assert(resData.length === projectList.length);
|
|
36
|
+
for (let i = 0; i < resData.length; i++) {
|
|
37
|
+
const item = resData[i];
|
|
38
|
+
assert(item.modelKey);
|
|
39
|
+
assert(item.key);
|
|
40
|
+
assert(item.name);
|
|
41
|
+
assert(item.desc !== undefined);
|
|
42
|
+
assert(item.homePage !== undefined);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("GET /api/project/list with proj_key", async () => {
|
|
47
|
+
const { key: projKey } =
|
|
48
|
+
projectList[Math.floor(Math.random() * projectList.length)];
|
|
49
|
+
const { modelKey } = projectList.find((item) => item.key === projKey);
|
|
50
|
+
let tmpRes = request.get("/api/project/list");
|
|
51
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
52
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
53
|
+
tmpRes = tmpRes.query({ proj_key: projKey });
|
|
54
|
+
const res = await tmpRes;
|
|
55
|
+
assert(res.body.success === true);
|
|
56
|
+
const resData = res.body.data;
|
|
57
|
+
assert(
|
|
58
|
+
projectList.filter((item) => item.modelKey === modelKey).length ===
|
|
59
|
+
resData.length,
|
|
60
|
+
);
|
|
61
|
+
for (let i = 0; i < resData.length; i++) {
|
|
62
|
+
const item = resData[i];
|
|
63
|
+
assert(item.modelKey);
|
|
64
|
+
assert(item.key);
|
|
65
|
+
assert(item.name);
|
|
66
|
+
assert(item.desc !== undefined);
|
|
67
|
+
assert(item.homePage !== undefined);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("GET /api/project without proj_key", async () => {
|
|
72
|
+
let tmpRes = request.get("/api/project");
|
|
73
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
74
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
75
|
+
const res = await tmpRes;
|
|
76
|
+
assert(res.body.success === false);
|
|
77
|
+
|
|
78
|
+
const resBody = res.body;
|
|
79
|
+
assert(resBody.code === 442);
|
|
80
|
+
assert(
|
|
81
|
+
resBody.message.indexOf(
|
|
82
|
+
`request validate fail: data should have required property 'proj_key'`,
|
|
83
|
+
) > -1,
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("GET /api/project fail", async () => {
|
|
88
|
+
let tmpRes = request.get("/api/project");
|
|
89
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
90
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
91
|
+
tmpRes = tmpRes.query({ proj_key: "xxxxxxxxxxxx" });
|
|
92
|
+
const res = await tmpRes;
|
|
93
|
+
assert(res.body.success === false);
|
|
94
|
+
const resBody = res.body;
|
|
95
|
+
assert(resBody.code === 50000);
|
|
96
|
+
assert(resBody.message === "获取项目异常");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("GET /api/project with proj_key", async () => {
|
|
100
|
+
for (let i = 0; i < projectList.length; i++) {
|
|
101
|
+
const projItem = projectList[i];
|
|
102
|
+
const { key: projKey } = projItem;
|
|
103
|
+
|
|
104
|
+
let tmpRes = request.get("/api/project");
|
|
105
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
106
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
107
|
+
tmpRes = tmpRes.query({ proj_key: projKey });
|
|
108
|
+
const res = await tmpRes;
|
|
109
|
+
assert(res.body.success === true);
|
|
110
|
+
const resData = res.body.data;
|
|
111
|
+
assert(resData.modelKey);
|
|
112
|
+
assert(resData.key === projKey);
|
|
113
|
+
assert(resData.name);
|
|
114
|
+
assert(resData.desc !== undefined);
|
|
115
|
+
assert(resData.homePage !== undefined);
|
|
116
|
+
const { menu } = resData;
|
|
117
|
+
menu.forEach((menuItem) => {
|
|
118
|
+
checkMenuItem(menuItem);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function checkMenuItem(menuItem) {
|
|
123
|
+
assert(menuItem.key);
|
|
124
|
+
assert(menuItem.name);
|
|
125
|
+
assert(menuItem.menuType);
|
|
126
|
+
|
|
127
|
+
if (menuItem.menuType === "group") {
|
|
128
|
+
assert(menuItem.subMenu !== undefined);
|
|
129
|
+
menuItem.subMenu.forEach((subMenuItem) => {
|
|
130
|
+
checkMenuItem(subMenuItem);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (menuItem.menuType === "model") {
|
|
135
|
+
checkModelItem(menuItem);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function checkModelItem(menuItem) {
|
|
140
|
+
const { moduleType } = menuItem;
|
|
141
|
+
assert(moduleType);
|
|
142
|
+
|
|
143
|
+
if (moduleType === "sider") {
|
|
144
|
+
const { siderConfig } = menuItem;
|
|
145
|
+
assert(siderConfig);
|
|
146
|
+
assert(siderConfig.menu);
|
|
147
|
+
siderConfig.menu.forEach((siderMenuItem) => {
|
|
148
|
+
checkMenuItem(siderMenuItem);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (moduleType === "iframe") {
|
|
153
|
+
const { iframeConfig } = menuItem;
|
|
154
|
+
assert(iframeConfig);
|
|
155
|
+
assert(iframeConfig.path !== undefined);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (moduleType === "custom") {
|
|
159
|
+
const { customConfig } = menuItem;
|
|
160
|
+
assert(customConfig);
|
|
161
|
+
assert(customConfig.path !== undefined);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (moduleType === "schema") {
|
|
165
|
+
const { schemaConfig } = menuItem;
|
|
166
|
+
assert(schemaConfig);
|
|
167
|
+
assert(schemaConfig.api !== undefined);
|
|
168
|
+
assert(schemaConfig.schema);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("GET /api/project/model_list", async () => {
|
|
174
|
+
let tmpRes = request.get("/api/project/model_list");
|
|
175
|
+
tmpRes = tmpRes.set("s_t", st);
|
|
176
|
+
tmpRes = tmpRes.set("s_sign", md5(`${signKey}_${st}`));
|
|
177
|
+
const res = await tmpRes;
|
|
178
|
+
assert(res.body.success === true);
|
|
179
|
+
const resData = res.body.data;
|
|
180
|
+
assert(resData.length > 0);
|
|
181
|
+
|
|
182
|
+
for (let i = 0; i < resData.length; i++) {
|
|
183
|
+
const item = resData[i];
|
|
184
|
+
assert(item.model);
|
|
185
|
+
assert(item.model.key);
|
|
186
|
+
assert(item.model.name);
|
|
187
|
+
assert(item.project);
|
|
188
|
+
for (const projkey in item.project) {
|
|
189
|
+
assert(item.project[projkey].key);
|
|
190
|
+
assert(item.project[projkey].name);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|