skybase 0.1.99 → 0.1.104
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/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
## [0.1.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## [0.1.97](https://github.com/kongnet/skybase/compare/v0.1.96...v0.1.97) (2025-10-14)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## [0.1.96](https://github.com/kongnet/skybase/compare/v0.1.95...v0.1.96) (2025-10-14)
|
|
1
|
+
## [0.1.100](https://github.com/kongnet/skybase/compare/v0.1.95...v0.1.100) (2025-12-13)
|
|
12
2
|
|
|
13
3
|
|
|
14
4
|
### :sparkles:
|
|
@@ -62,7 +62,7 @@ const routerLog = (result, name, apiPath, ms) => {
|
|
|
62
62
|
}
|
|
63
63
|
)
|
|
64
64
|
resultKey = resultKey.slice(0, 1000)
|
|
65
|
-
$.
|
|
65
|
+
$.err(
|
|
66
66
|
'[router处理]=>',
|
|
67
67
|
resultKey,
|
|
68
68
|
`\n${$.c.dimc(name + apiPath)} => ${$.c.dimc(ms || '0')} ms\n`
|
|
@@ -80,9 +80,9 @@ const warn = (...args) => {
|
|
|
80
80
|
const checkapiStandard = (apiPath, opt) => {
|
|
81
81
|
const apiDesc = opt.name || opt.desc
|
|
82
82
|
if (!apiDesc) {
|
|
83
|
-
$.
|
|
83
|
+
$.err($.c.y('?'), apiPath.fillStr(' ', 30), $.c.y('接口未写名称或描述'))
|
|
84
84
|
} else if (apiPath.includes('_')) {
|
|
85
|
-
$.
|
|
85
|
+
$.err($.c.y('?'), apiPath.fillStr(' ', 30), $.c.y('接口命名不规范'))
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -91,7 +91,7 @@ const getApiFn = (apiPath, opt) => {
|
|
|
91
91
|
let mockModel = 0
|
|
92
92
|
if (!opt.controller) {
|
|
93
93
|
if (opt.mock) {
|
|
94
|
-
$.
|
|
94
|
+
$.err(
|
|
95
95
|
$.c.g('✔'),
|
|
96
96
|
apiPath.fillStr(' ', 30),
|
|
97
97
|
$.c.r('controller未定义'),
|
|
@@ -99,7 +99,7 @@ const getApiFn = (apiPath, opt) => {
|
|
|
99
99
|
)
|
|
100
100
|
mockModel = 1
|
|
101
101
|
} else {
|
|
102
|
-
$.
|
|
102
|
+
$.err(
|
|
103
103
|
$.c.r('✘'),
|
|
104
104
|
apiPath.fillStr(' ', 30),
|
|
105
105
|
$.c.r('controller未定义 & mock未定义')
|
|
@@ -119,15 +119,15 @@ const getApiFn = (apiPath, opt) => {
|
|
|
119
119
|
const contr = require(fileDir) || {}
|
|
120
120
|
func = contr[fn]
|
|
121
121
|
if (!func) {
|
|
122
|
-
$.
|
|
122
|
+
$.err(
|
|
123
123
|
$.c.r('✘'),
|
|
124
124
|
apiPath.fillStr(' ', 30),
|
|
125
125
|
$.c.r(`文件“${fileDir}”中不存在“${fn}”方法`)
|
|
126
126
|
)
|
|
127
127
|
}
|
|
128
128
|
} catch (e) {
|
|
129
|
-
$.
|
|
130
|
-
$.
|
|
129
|
+
$.err($.c.r('✘'), apiPath.fillStr(' ', 30), $.c.r(`router不存在 ${file}`))
|
|
130
|
+
$.err(e.stack)
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
return func
|
|
@@ -335,7 +335,7 @@ const loadRunDict = () => {
|
|
|
335
335
|
|
|
336
336
|
// $.dir($S)
|
|
337
337
|
|
|
338
|
-
$.
|
|
338
|
+
$.err(
|
|
339
339
|
n === 0 ? $.c.r('✘') : $.c.g('✔'),
|
|
340
340
|
`[${$.c.y('frontApi/totlaApi')}] = [${$.c.y(
|
|
341
341
|
`${n}/${m}`
|
|
@@ -140,7 +140,24 @@ module.exports = async (ctx, next) => {
|
|
|
140
140
|
)
|
|
141
141
|
apiCheckLog(apiPath, ctx.checkedData, method, params, ctx)
|
|
142
142
|
if (ctx.checkedData.code >= 400) {
|
|
143
|
-
|
|
143
|
+
/* 有errSimple 看是否配置了语言参数_lang=en 或者 默认default,或者直接返回errSimple.
|
|
144
|
+
没有 errSimple 返回 ctx.checkedData.msg
|
|
145
|
+
errSimple: {
|
|
146
|
+
default: 'Parameter error, please check the input parameters',
|
|
147
|
+
zh: '参数错误,请检查输入参数'
|
|
148
|
+
},
|
|
149
|
+
或者
|
|
150
|
+
errSimple:'err msg'
|
|
151
|
+
*/
|
|
152
|
+
return ctx.throwCode(
|
|
153
|
+
400,
|
|
154
|
+
apiSetting.errSimple
|
|
155
|
+
? apiSetting.errSimple[params['_lang'] ? params['_lang'] : 'default'] ||
|
|
156
|
+
(typeof apiSetting.errSimple === 'string'
|
|
157
|
+
? apiSetting.errSimple
|
|
158
|
+
: ctx.checkedData.msg)
|
|
159
|
+
: ctx.checkedData.msg
|
|
160
|
+
)
|
|
144
161
|
}
|
|
145
162
|
await next()
|
|
146
163
|
}
|