Commit cfe3f473 by 蒋勇

d

parent 7546c18d
......@@ -11,17 +11,35 @@ class CtlBase {
return ClassObj["name"].substring(0, ClassObj["name"].lastIndexOf("Ctl")).toLowerCase() + "Sve";
}
async update(pobj, qobj, req) {
const up = await this.service.update(pobj);
return system.getResult(up);
}
async findAndCountAll(pobj, qobj, req) {
//设置查询条件
console.log(pobj)
const apps = await this.service.findAndCountAll(pobj);
return system.getResult(apps);
}
async refQuery(pobj, qobj, req) {
return this.dao.refQuery(pobj);
}
async setContextParams(pobj, qobj, req) {
req.xctx={
appkey:req.headers["x-appkey"],
}
let custtags = req.headers["x-consumetag"]?req.headers["x-consumetag"].split("|"):null;
req.xctx = {
appkey: req.headers["x-appkey"],
companyid: custtags?custtags[0].split("_")[1]:null,
password: custtags?custtags[1].split("_")[1]:null,
username: req.headers["x-consumer-username"],
credid: req.headers["x-credential-identifier"]
}
}
async doexec(methodname, pobj, query, req) {
try {
await this.setContextParams(pobj, query, req);
//从请求头里面取appkey_consumename
// var consumeName=req.headers[""]
// var appkey=
// var consumeName=req.headers[""]
// var appkey=
// if( this.session["appkey_consumename"]) {
// }else{
......
......@@ -39,6 +39,11 @@ class UserCtl extends CtlBase {
let rtn=await this.service.pmlogin(pobj, qobj,req);
return system.getResult(rtn);
}
async getUserInfo(pobj, qobj, req){
let uname=req.xctx.username;
let rtn=await this.service.getUserInfo(uname);
return system.getResult(rtn);
}
async pmloginByVCode(pobj, qobj, req){
let rtn=this.service.pmloginByVCode(pobj, qobj);
return system.getResult(rtn);
......
......@@ -103,6 +103,13 @@ class UserService extends ServiceBase {
}
})
}
async getUserInfo(uname){
let userfind = await this.dao.model.findOne({
where: { userName: uname, app_id: settings.pmappid },
include: [{ model: this.db.models.company, raw: true, attributes: ["companykey"] }]
});
return userfind;
}
//平台注册与登录
//用户验证码登录
//
......
......@@ -35,8 +35,8 @@ class ServiceBase {
const apps = await this.dao.findAndCountAll(obj);
return apps;
}
async refQuery(qobj) {
return this.dao.refQuery(qobj);
async refQuery(pobj) {
return this.dao.refQuery(pobj);
}
async bulkDelete(ids) {
var en = await this.dao.bulkDelete(ids);
......
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