更新
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
params: {
|
||||
"type": ["accountPassword"],//登录类型
|
||||
"data": "object",//数据
|
||||
},
|
||||
fun : async (ctx, app) => {
|
||||
const {type, data} = ctx.params
|
||||
if (await $components.login[type](data)) {
|
||||
return $res.success({
|
||||
token: await $components.jwt.sign({})
|
||||
}, "登录成功")
|
||||
}
|
||||
|
||||
|
||||
return $res.error({}, "登录失败")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
params: {
|
||||
"type": ["accountPassword"],//注册类型
|
||||
"data": "object",//数据
|
||||
},
|
||||
fun : async (ctx, app) => {
|
||||
const {type, data} = ctx.params
|
||||
if (await $components.registered[type](data)) {
|
||||
return $res.success({
|
||||
token: await $components.jwt.sign({})
|
||||
}, "注册成功")
|
||||
}
|
||||
|
||||
return $res.error({}, "登录失败")
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user