Commit aac3b8cb by 蒋勇

d

parent 14e9dab2
......@@ -15,7 +15,16 @@ class CompanyCtl extends CtlBase {
let company=await this.cacheManager["CompanyCache"].cache(p.companykey)
return system.getResult(company)
}
async bindApps(p,q,req){
let appids=p.appids
let cmpid=p.postcmpid
let appids2=appids.map(item=>{
return item.appid+"|"+item.title
})
let appidstrs=appids2.join(",")
await this.service.bindApps(appidstrs,cmpid)
return system.getResult(appids)
}
async setOrgs(p,q,req){
let orgs=await this.service.setOrgs(p,req.xctx.fromcompanykey)
return system.getResult(orgs)
......
......@@ -64,7 +64,10 @@ class UserDao extends Dao{
}
extraModelFilter(){
//return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"]}]};
return {"key":"include","value":[
{model:this.db.models.app,},
{model:this.db.models.company,},
{model:this.db.models.role,as:"Roles",attributes:["id","name"]}]};
}
extraWhere(obj,w,qc,linkAttrs){
if(obj.bizpath && obj.bizpath!=""){
......
......@@ -5,6 +5,13 @@ class CompanyService extends ServiceBase {
constructor() {
super("common", ServiceBase.getDaoName(CompanyService));
}
async bindApps(appids,companyid){
var self=this
return this.db.transaction(async function (t) {
let u = await self.dao.update({appids:appids,id:companyid},t)
return appids
})
}
async setOrgs(p,cmk) {
var self=this
return this.db.transaction(async function (t) {
......
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