@k3000/s1 0.3.6 → 0.3.7
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/README.md +8 -0
- package/admin/README.MD +47 -0
- package/admin/service.mjs +1 -1
- package/admin/system/user.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/admin/README.MD
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
主要用到的类`Admin`、`AdminAuth`和`AdminAuthPerm`。
|
2
|
+
|
3
|
+
`Admin`普通的管理系统类。
|
4
|
+
|
5
|
+
`AdminAuth`这个类需要登录授权后才能访问。
|
6
|
+
|
7
|
+
`AdminAuthPerm`这个类在登录的基础上需要有特定的权限关键字才能访问。
|
8
|
+
|
9
|
+
```
|
10
|
+
export class User extends AdminAuthPerm {
|
11
|
+
|
12
|
+
pk = 'userId'
|
13
|
+
set = 'sysUser'
|
14
|
+
route = '/system/user'
|
15
|
+
except = ['deptTree', 'authRole', 'changeStatus']
|
16
|
+
|
17
|
+
GET(...arg) {
|
18
|
+
// 调用默认的GET方法
|
19
|
+
const result = this.call(...arg)
|
20
|
+
// 这个是处理没有get方法的情况,如请求为/system/user或者/system/user/
|
21
|
+
if (result === NoActionParams) return store1.getPostUserList().then(this.addCode200)
|
22
|
+
// 这个是处理请求为/system/user/:action但是没有实现action()的情况
|
23
|
+
if (NoActionHandle.is(result)) return store1.getUserInfoById(Number.parseInt(result))
|
24
|
+
.then(this.addCode200)
|
25
|
+
|
26
|
+
return result
|
27
|
+
}
|
28
|
+
|
29
|
+
POST(body, ...arg) {
|
30
|
+
// 调用默认的POST方法
|
31
|
+
const action = this.call(body, ...arg)
|
32
|
+
// 满足该条件表示已有相应方法处理,后续不需要再处理
|
33
|
+
if (action !== NoActionParams && !NoActionHandle.is(action)) return action
|
34
|
+
|
35
|
+
......
|
36
|
+
}
|
37
|
+
|
38
|
+
list(query, {req, res}) {
|
39
|
+
|
40
|
+
......
|
41
|
+
|
42
|
+
return this.page(query, undefined)
|
43
|
+
}
|
44
|
+
// 非默认方法(GET、POST、PUT、……)可以这样赋值
|
45
|
+
resetPwd = store1.resetUserPwd
|
46
|
+
}
|
47
|
+
```
|
package/admin/service.mjs
CHANGED
@@ -2,7 +2,7 @@ import createServer from '@k3000/server'
|
|
2
2
|
import {adminUdpPort as port} from "../common/config.mjs";
|
3
3
|
import {service as pools} from '../common/service.mjs'
|
4
4
|
|
5
|
-
|
5
|
+
createServer({port, type: "udp"}, pools)
|
6
6
|
|
7
7
|
console.log('running on ' + port)
|
8
8
|
|
package/admin/system/user.mjs
CHANGED
@@ -24,7 +24,7 @@ export class User extends AdminAuthPerm {
|
|
24
24
|
|
25
25
|
const action = this.call(body, ...arg)
|
26
26
|
|
27
|
-
if (action !== NoActionParams
|
27
|
+
if (action !== NoActionParams && !NoActionHandle.is(action)) return action
|
28
28
|
|
29
29
|
body.createBy = body.userInfo.userName
|
30
30
|
|