Commit 70e24bf9 by v_vjyjiang

d

parent 2ae3ea71
...@@ -8,40 +8,40 @@ class CtlBase { ...@@ -8,40 +8,40 @@ class CtlBase {
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.logClient = system.getObject("util.logClient"); this.logClient = system.getObject("util.logClient");
} }
getUUID() { getUUID () {
var uuid = uuidv4(); var uuid = uuidv4();
var u = uuid.replace(/\-/g, ""); var u = uuid.replace(/\-/g, "");
return u; return u;
} }
static getServiceName(ClassObj) { static getServiceName (ClassObj) {
return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Ctl")).toLowerCase() + "Sve"; return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Ctl")).toLowerCase() + "Sve";
} }
async update(pobj, qobj, req) { async update (pobj, qobj, req) {
const up = await this.service.update(pobj); const up = await this.service.update(pobj);
return system.getResult(up); return system.getResult(up);
} }
async create(pobj, qobj, req) { async create (pobj, qobj, req) {
const up = await this.service.create(pobj); const up = await this.service.create(pobj);
return system.getResult(up); return system.getResult(up);
} }
async delete(pobj, qobj, req) { async delete (pobj, qobj, req) {
const up = await this.service.delete(pobj); const up = await this.service.delete(pobj);
return system.getResult(up); return system.getResult(up);
} }
async findAndCountAll(pobj, qobj, req) { async findAndCountAll (pobj, qobj, req) {
//设置查询条件 //设置查询条件
console.log(pobj) console.log(pobj)
const rs = await this.service.findAndCountAll(pobj); const rs = await this.service.findAndCountAll(pobj);
return system.getResult(rs); return system.getResult(rs);
} }
async refQuery(pobj, qobj, req) { async refQuery (pobj, qobj, req) {
//pobj.refwhere.app_id=pobj.app_id;//角色过滤按照公司过滤 //pobj.refwhere.app_id=pobj.app_id;//角色过滤按照公司过滤
pobj.refwhere.company_id = pobj.company_id; pobj.refwhere.company_id = pobj.company_id;
let rtn = await this.service.refQuery(pobj); let rtn = await this.service.refQuery(pobj);
return rtn return rtn
} }
async setContextParams(pobj, qobj, req) { async setContextParams (pobj, qobj, req) {
let custtags = req.headers["x-consumetag"] ? req.headers["x-consumetag"].split("|") : null; let custtags = req.headers["x-consumetag"] ? req.headers["x-consumetag"].split("|") : null;
let lastindex = custtags ? custtags.length - 1 : 0; let lastindex = custtags ? custtags.length - 1 : 0;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值 //当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
...@@ -65,7 +65,9 @@ class CtlBase { ...@@ -65,7 +65,9 @@ class CtlBase {
if (req.xctx.ptags && req.xctx.ptags != "") { if (req.xctx.ptags && req.xctx.ptags != "") {
pobj.opath = req.xctx.ptags pobj.opath = req.xctx.ptags
} else { } else {
pobj.opath = req.xctx.opath if (!pobj.opath || pobj.opath == "") {
pobj.opath = req.xctx.opath
}
} }
if (!req.xctx.appkey) { if (!req.xctx.appkey) {
return [-200, "请求头缺少应用x-app-key"] return [-200, "请求头缺少应用x-app-key"]
...@@ -95,7 +97,7 @@ class CtlBase { ...@@ -95,7 +97,7 @@ class CtlBase {
pobj.bizpath = req.xctx.bizpath; pobj.bizpath = req.xctx.bizpath;
} }
async doexec(methodname, pobj, query, req) { async doexec (methodname, pobj, query, req) {
try { try {
let xarg = await this.setContextParams(pobj, query, req); let xarg = await this.setContextParams(pobj, query, req);
if (xarg && xarg[0] < 0) { if (xarg && xarg[0] < 0) {
......
...@@ -371,6 +371,7 @@ class UserService extends ServiceBase { ...@@ -371,6 +371,7 @@ class UserService extends ServiceBase {
var self = this; var self = this;
return this.db.transaction(async function (t) { return this.db.transaction(async function (t) {
delete qobj['company_id'] delete qobj['company_id']
//delete qobj['opath']
let up = await self.dao.update(qobj, t); let up = await self.dao.update(qobj, t);
//令缓存失效 //令缓存失效
await self.cacheManager["UserCache"].invalidate(qobj.userName); await self.cacheManager["UserCache"].invalidate(qobj.userName);
......
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