初始化
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
params: {
|
||||
"uid": "string",//数据
|
||||
"general_management": "string",//数据
|
||||
},
|
||||
fun : async (ctx, app) => {
|
||||
const {name, general_management} = ctx.params
|
||||
if (await $components.registered[type](data)) {
|
||||
return $res.success({
|
||||
token: await $components.jwt.sign({})
|
||||
}, "注册成功")
|
||||
}
|
||||
|
||||
return $res.error({}, "登录失败")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
params: {
|
||||
"name": "string",//数据
|
||||
"general_management": "string",//数据
|
||||
},
|
||||
fun : async (ctx, app) => {
|
||||
const {name, general_management} = ctx.params
|
||||
if (await $components.registered[type](data)) {
|
||||
return $res.success({
|
||||
token: await $components.jwt.sign({})
|
||||
}, "注册成功")
|
||||
}
|
||||
|
||||
return $res.error({}, "登录失败")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
const crypto = require('crypto');
|
||||
const shortid = require('shortid');
|
||||
module.exports = {
|
||||
// 随机数(盐值)
|
||||
getRandomSalt() {
|
||||
@@ -20,4 +21,8 @@ module.exports = {
|
||||
cryptPwdVerification(password, salt, user_password_md5) {
|
||||
return this.cryptPwd(password, salt) === user_password_md5;
|
||||
},
|
||||
// 返回随机短uuid
|
||||
shortid() {
|
||||
return shortid.generate()
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
module.exports = {
|
||||
//添加机构
|
||||
async add(name, general_management) {
|
||||
$db.table('Organization').data({
|
||||
oid: $components.encrypt.shortid(),
|
||||
name,
|
||||
general_management
|
||||
}).save()
|
||||
},
|
||||
}
|
||||
@@ -7,9 +7,9 @@
|
||||
* @return {boolean} 注册 是否 成功.
|
||||
*/
|
||||
module.exports = async (data) => {
|
||||
const {account, password} = data
|
||||
const {account, password, oid} = data
|
||||
const salt = app.components.encrypt.getRandomSalt()
|
||||
const md5 = app.components.encrypt.cryptPwd(password, salt)
|
||||
await app.db.table("User").data({account, password: md5, salt}).save()
|
||||
await app.db.table("User").data({account, password: md5, salt, to_oid: oid}).save()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
module.exports = {
|
||||
doc: "组织表",
|
||||
api: true,//是否需要生成api接口
|
||||
doc : "机构表",
|
||||
api : true,//是否需要生成api接口
|
||||
model: {
|
||||
oid: {type: "STRING", comment: '组织id'},
|
||||
name: {type: "STRING", comment: '组织名称'},
|
||||
general_management: {type: "STRING", comment: '是否为总管理平台(可以管理所有组织)'},
|
||||
oid : {type: "INTEGER", comment: '机构id', primaryKey: true},
|
||||
name : {type: "STRING", comment: '机构名称'},
|
||||
general_management: {type: "STRING", comment: '是否为总管理平台(可以管理所有机构):y/n'},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
doc: "组织配置表",
|
||||
api: true,//是否需要生成api接口
|
||||
model: {
|
||||
oid: {type: "STRING", comment: '组织id'},
|
||||
name: {type: "STRING", comment: '名称'},
|
||||
type: {type: "STRING", comment: '类型:string/number/json'},
|
||||
code: {type: "STRING", comment: '识别码'},
|
||||
value: {type: "STRING", comment: '权限值'},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = {
|
||||
doc: "权限列表",
|
||||
api: true,//是否需要生成api接口
|
||||
model: {
|
||||
pid: {type: "STRING", comment: '权限id'},
|
||||
pid: {type: "INTEGER", comment: '权限id', primaryKey: true},
|
||||
name: {type: "STRING", comment: '权限名称'},
|
||||
type: {type: "STRING", comment: '权限类型:接口/字段/表格/按钮:jk/zd/bg/an'},
|
||||
code: {type: "STRING", comment: '权限识别码'},
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = {
|
||||
doc: "角色表",
|
||||
api: true,//是否需要生成api接口
|
||||
model: {
|
||||
rid: {type: "STRING", comment: '角色id'},
|
||||
rid: {type: "INTEGER", comment: '角色id', primaryKey: true},
|
||||
name: {type: "STRING", comment: '角色名称'},
|
||||
to_oid: {type: "STRING", comment: '所属组织id'},
|
||||
},
|
||||
|
||||
@@ -2,12 +2,10 @@ module.exports = {
|
||||
doc: "用户表",
|
||||
api: true,//是否需要生成api接口
|
||||
model: {
|
||||
uid: {type: "STRING", comment: '用户id'},
|
||||
uid: {type: "INTEGER", comment: '用户id', primaryKey: true},
|
||||
account: {type: "STRING", comment: '用户账号'},
|
||||
password: {type: "STRING", comment: '用户加密密码'},
|
||||
salt: {type: "STRING", comment: '用户加密随机数'},
|
||||
to_oid: {type: "STRING", comment: '所属组织id'},
|
||||
to_rid: {type: "STRING", comment: '所属角色id'},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,15 @@ module.exports = {
|
||||
doc: "用户资料表",
|
||||
api: true,//是否需要生成api接口
|
||||
model: {
|
||||
uid: {type: "STRING", comment: '用户id'},
|
||||
uid: {type: "INTEGER", comment: '用户id'},
|
||||
to_oid: {type: "INTEGER", comment: '所属组织id'},
|
||||
to_rid: {type: "INTEGER", comment: '所属角色id'},
|
||||
account: {type: "STRING", comment: '用户账号'},
|
||||
name: {type: "STRING", comment: '名称'},
|
||||
avatar: {type: "STRING", comment: '头像'},
|
||||
wechat_openid: {type: "STRING", comment: '微信openid'},
|
||||
phone_number: {type: "STRING", comment: '手机号'},
|
||||
age: {type: "STRING", comment: '年龄'},
|
||||
age: {type: "INTEGER", comment: '年龄'},
|
||||
sex: {type: "STRING", comment: '性别'},
|
||||
province: {type: "STRING", comment: '省份'},
|
||||
city: {type: "STRING", comment: '城市'},
|
||||
|
||||
Reference in New Issue
Block a user