Commit 29967344 by 蒋勇

d

parent 74c42368
......@@ -15,11 +15,15 @@ class CtlBase {
const up = await this.service.update(pobj);
return system.getResult(up);
}
async delete(pobj, qobj, req) {
const up = await this.service.delete(pobj);
return system.getResult(up);
}
async findAndCountAll(pobj, qobj, req) {
//设置查询条件
console.log(pobj)
const apps = await this.service.findAndCountAll(pobj);
return system.getResult(apps);
const rs = await this.service.findAndCountAll(pobj);
return system.getResult(rs);
}
async refQuery(pobj, qobj, req) {
return this.service.refQuery(pobj);
......
......@@ -40,7 +40,7 @@ class UserCtl extends CtlBase {
async create(p, q, req){
//检查是否有用户名和密码
if (!pobj.userName) {
if (!p.userName) {
return system.getResult(null, "请检查用户名和密码是否存在")
}
let rtn = await this.service.registerByTantent(p, q);
......
......@@ -62,7 +62,7 @@ class Dao {
}
}
async delete(qobj, t) {
var en = await this.model.findOne({ where: qobj });
var en = await this.model.findOne({ where: {id:qobj.id} });
if (t != null && t != 'undefined') {
if (en != null) {
return en.destroy({ transaction: t });
......
......@@ -15,8 +15,8 @@ class RoleDao extends Dao{
// // w["app_id"]=obj.appid;
// // }
// }
w["app_id"]=obj.appid;
w["company_id"]=obj.tocompanyid;
w["app_id"]=obj.app_id;
w["company_id"]=obj.company_id;
return w;
}
extraModelFilter(){
......
......@@ -17,8 +17,8 @@ db.sync({force:true}).then(async ()=>{
"backend":"192.168.4.1"
});
let Role=db.models["role"];
await Role.create({code:"ta",name:"租户",app_id:appnew.id,company_id:settings.pmcompanyid})
await Role.create({code:"pr",name:"个人",app_id:appnew.id,company_id:settings.pmcompanyid})
await Role.create({code:"ta",name:"租户",isSystem:true,app_id:appnew.id,company_id:settings.pmcompanyid})
await Role.create({code:"pr",name:"个人",isSystem:true,app_id:appnew.id,company_id:settings.pmcompanyid})
let usuper=await usS.pmregister({userName:"sm",password:"951753",isSuper:true,isAdmin:true,isSystem:true,isEnabled:true,nickName:"superman",app_id:appnew.id,company_id:settings.id})
......
......@@ -44,7 +44,7 @@ class UserService extends ServiceBase {
//对于租户类型注册,创建一个默认公司,公司名称xxxx的公司
//如果非租户类型,需要按照传递进来的公司companykey,来查询公司,按照companykey缓存到redis
let cmpkey = self.getUUID();
let rolecodes = p.rolecode ? p.rolecodes : [settings.pmroleid["ta"]];
let rolecodes = p.rolecodes ? p.rolecodes : [settings.pmroleid["ta"]];
if (rolecodes[0] == settings.pmroleid["ta"]) {//如果注册时,角色是租户,那么需要创建默认公司
let cmp = await self.companyDao.create({ name: p.userName + "的公司", companykey: cmpkey }, t);
p.company_id = cmp.id;
......
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