Commit 145c8e0e by 蒋勇

d

parent 58c677d2
......@@ -13,7 +13,7 @@ class UserCtl extends CtlBase {
return system.getResult(rtn)
}
async loginApp(pobj, qobj, req){
let appkey=pobj.appkey
let appkey=pobj.fromAppKey
let uname=pobj.username
let rtn=await this.service.loginApp(appkey,uname)
return system.getResult(rtn);
......
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
class CodeCache extends CacheBase{
constructor(){
super();
this.userDao=system.getObject("db.auth.userDao");
}
isdebug(){
return false
// return settings.env=="dev";
}
desc(){
return "缓存code子系统用户登录信息对象";
}
prefix(){
return "g_code_userlocal_"
}
async buildCacheVal(cachekey,inputkey, val, ex, ...items) {
if (val) {
return JSON.stringify(val);
}
return null;
}
}
module.exports=CodeCache;
\ No newline at end of file
......@@ -10,18 +10,17 @@ class UserService extends ServiceBase {
this.authS=system.getObject("service.auth.authSve");
}
async pmgetUserByCode(code){
let ux= await this.cacheManager["UserCache"].getCache(code);
let ux= await this.cacheManager["CodeCache"].getCache(code);
return ux;
}
async loginApp(appkey,uname){
let rtn={}
let app= await this.cacheManager["AppCache"].cache(appkey);
let url=app.homePage
let userLogined= this.cacheManager["UserCache"].cache(uname);
let userLogined= await this.cacheManager["UserCache"].cache(uname);
rtn.user=userLogined
if (userLogined) {
let token = await self.cmakejwt(userLogined.jwtkey, userLogined.jwtsecret, null);
let token = await this.cmakejwt(userLogined.jwtkey, userLogined.jwtsecret, null);
rtn.token = token;
}
let roleids=userLogined.Roles.map(item=>{
......@@ -30,9 +29,9 @@ class UserService extends ServiceBase {
let auths= await this.authS.findAuthsByRole(roleids)
rtn.user.access=auths
let code=this.getUUID()
this.cacheManager["UserCache"].cache(code,rtn,60000);
let url=app.homePage+"?code="+code
return {url:url};
this.cacheManager["CodeCache"].cache(code,rtn,60000);
// let url=app.homePage+"?code="+code
return {code,homePage:app.homePage};
}
//登录后的租户创建属于租户的用户
//需要在控制器里取出公司ID
......
......@@ -125,7 +125,7 @@ class AppService extends ServiceBase {
//如果存在functionJSON,那么就需要转换,构建编码路径
if (pobj.functionJSON != "") {
let funcobjs = JSON.parse(pobj.functionJSON)
await self.translateWithBizCode(funcobjs,null)
//await self.translateWithBizCode(funcobjs,null)
pobj.functionJSON= JSON.stringify(funcobjs)
}
await self.dao.update(pobj, 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