Commit f8e82d94 by 蒋勇

d

parent 2b0242df
......@@ -28,7 +28,7 @@ class CtlBase {
let custtags = req.headers["x-consumetag"]?req.headers["x-consumetag"].split("|"):null;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req.xctx = {
appkey: req.headers["x-app-key"],//用于系统管理区分应用,比如角色
appkey: req.headers["xappkey"],//用于系统管理区分应用,比如角色
companyid: custtags?custtags[0].split("_")[1]:null,
password: custtags?custtags[1].split("_")[1]:null,
username: req.headers["x-consumer-username"],
......@@ -47,7 +47,7 @@ class CtlBase {
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// }
if(!req.xctx.companyid && creq.xctx.companykey){
if(!req.xctx.companyid && req.xctx.companykey){
let comptmp=await this.cacheManager["CompanyCache"].cache(req.xctx.companykey);
req.xctx.companyid=comptmp.id;
}
......@@ -58,7 +58,7 @@ class CtlBase {
async doexec(methodname, pobj, query, req) {
try {
let xarg=await this.setContextParams(pobj, query, req);
if(xarg[0]<0){
if(xarg && xarg[0]<0){
return system.getResultFail(...xarg);
}
//从请求头里面取appkey_consumename
......
......@@ -17,7 +17,7 @@ class AppCache extends CacheBase{
return "g_applocal_"
}
async buildCacheVal(cachekey,inputkey, val, ex, ...items) {
const configValue=await this.appDao.findOne({where:{appkey:inputkey}});
const configValue=await this.appDao.findOne({appkey:inputkey});
if (configValue) {
return JSON.stringify(configValue);
}
......
......@@ -17,7 +17,7 @@ class CompanyCache extends CacheBase{
return "gc_companylocal_"
}
async buildCacheVal(cachekey,inputkey, val, ex, ...items) {
const configValue=await this.companyDao.findOne({where:{companykey:inputkey}});
const configValue=await this.companyDao.findOne({companykey:inputkey});
if (configValue) {
return JSON.stringify(configValue);
}
......
......@@ -54,7 +54,7 @@ class UserService extends ServiceBase {
//设置默认角色,租户
//设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
var roles = await self.roleDao.model.findAll({ where: { id: { [self.db.Op.in]: rolecodes } } ,app_id:p.app_id,company_id:p.company_id}, transaction: t });
var roles = await self.roleDao.model.findAll({ where: { id: { [self.db.Op.in]: rolecodes },app_id:p.app_id,company_id:p.company_id}, transaction: t });
if(roles && roles.length>0){
await u.setRoles(roles, { transaction: t });
}
......
......@@ -211,6 +211,7 @@ class System {
try{
ClassObj = require(objabspath);
}catch(e){
console.log(e)
let fname=objsettings[packageName+"base"];
ClassObj = require(fname);
}
......
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