Commit 78a765c4 by 孙亚楠

Merge branch 'xggsve-uc' of gitlab.gongsibao.com:jiangyong/zhichan into xggsve-uc

parents c466c8de 4affbebd
......@@ -111,9 +111,9 @@ class ActionAPI extends APIBase {
case "listRole":
opResult = await this.roleSve.apiListRole(action_body);
break;
// 用户
case "addUser":
break;
case "updUser":
break;
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class UserorgDao extends Dao {
constructor() {
super(Dao.getModelName(UserorgDao));
}
}
module.exports = UserorgDao;
\ No newline at end of file
......@@ -7,11 +7,17 @@ module.exports = (db, DataTypes) => {
ucname: DataTypes.STRING,
password: DataTypes.STRING,
uctype: DataTypes.INTEGER,
saas_id: DataTypes.INTEGER,
org_id: DataTypes.INTEGER,
orgpath: DataTypes.STRING,
isMain: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
isEnabled: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
saas_id: DataTypes.INTEGER,
}, {
paranoid: true, //假的删除
underscored: true,
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("userorg", {
user_id: DataTypes.INTEGER,
org_id: DataTypes.INTEGER,
}, {
paranoid: true, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'uc_user_org',
validate: {
},
indexes: [
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ const settings = require("../../../../config/settings")
class UserService extends ServiceBase {
constructor() {
super("user", ServiceBase.getDaoName(UserService));
this.user
}
......@@ -36,5 +37,47 @@ class UserService extends ServiceBase {
return system.getResult(-1,`系统错误 错误信息 ${error}`);
}
}
async add(obj) {
var roles = obj.roles || [];
var org = obj.org;
var saas_id = Number(obj.saas_id || 0);
var ucname = this.trim(obj.ucname);
var password = this.trim(obj.password);
var uctype = this.trim(obj.uctype);
var mobile = this.trim(obj.mobile);
var realName = this.trim(obj.realName);
if(!saas_id) {
// TODO 写到这
}
var user = {
ucid: ucid,
ucname: ucname,
password: password,
uctype: uctype,
org_id: org.id,
isMain: obj.isMain || 0,
orgpath: "",
password: "",
isEnabled: 1,
}
var info = {
mobile: mobile,
realName: realName,
}
var self = this;
await self.db.transaction(async function (t) {
// 创建商户
user = await self.dao.create(user, t);
return user;
});
}
}
module.exports = UserService;
\ No newline at end of file
module.exports = UserService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base")
const settings = require("../../../../config/settings")
class UserorgService extends ServiceBase {
constructor() {
super("user", ServiceBase.getDaoName(UserorgService));
}
}
module.exports = UserorgService;
\ No newline at end of file
......@@ -272,5 +272,13 @@ class ServiceBase {
}
return o.toString().trim();
}
async getEncryptStr(str) {
if (!str) {
throw new Error("字符串不能为空");
}
var md5 = md5(str + "_" + settings.salt);
return md5.toString().toLowerCase();
}
}
module.exports = ServiceBase;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment