Commit 35d3ffe9 by 宋毅

Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel

parents ff729475 5404d891
......@@ -4,6 +4,7 @@ const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
class WEBBase {
constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.restClient = system.getObject("util.restClient");
this.execClientNew = system.getObject("util.execClientNew");
this.cacheManager = system.getObject("db.common.cacheManager");
......@@ -21,20 +22,24 @@ class WEBBase {
async doexecMethod(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID();
try {
var rtn = await this[methodname](pobj, query, req);
var result = await this[methodname](pobj, query, req);
if (!result.requestId) {
result.requestId = pobj.RequestId ? pobj.RequestId : pobj.requestId || req.requestId;
}
this.logCtl.createDb({
appid: req.app.id,
appkey: req.app.uappKey,
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(rtn),
resultInfo: JSON.stringify(result),
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api服务提供方appKey:" + settings.appKey,
});
rtn.requestId = req.requestId;
return rtn;
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null);
return result;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.createDb({
......
......@@ -268,16 +268,16 @@ class UtilsAuthService extends AppServiceBase {
let result = await this.get360Token();
let token = result.access_token;
//360验证接口
// let subData = "pin=" + pin + "&token=" + token;
// let url = settings.requestUrl360() + 'api/v1/VerifyPin';
// let rtn = await this.restClient.execGet(subData,url);
// if (!rtn || !rtn.stdout) {
// return system.getResult(null, "restGet data is empty");
// }
// let checkRet = JSON.parse(rtn.stdout);
// if(checkRet.code != 200){
// return system.getResultFail(-1,checkRet.msg)
// }
let subData = "pin=" + pin + "&token=" + token;
let url = settings.requestUrl360() + 'api/v1/VerifyPin';
let rtn = await this.restClient.execGet(subData,url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restGet data is empty");
}
let checkRet = JSON.parse(rtn.stdout);
if(checkRet.code != 200){
return system.getResultFail(-1,checkRet.msg)
}
//---渠道用户登录,有则返回userpin ,没有则注册用户并返回userpin
actionBody.channelUserId = pin;
opResult = await this.getLoginByUserName(req,pobj, actionBody);
......
......@@ -92,6 +92,7 @@ class ExecClientNew {
this.execLogs(execFile + "执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果", params, params.identifyCode, reqResult, rtn);
return reqResult;
} catch (error) {
console.log("执行execPostByTimeOut存在异常", error.stack);
reqResult = system.getResultFail(-200, execFile + "执行execPostByTimeOut存在异常");
reqResult.requestId = requestId || uuid.v1();
this.execLogs(execFile + "执行execPostByTimeOut存在异常", params, params.identifyCode, reqResult, error.stack);
......
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