Commit ac313f1d by 宋毅

tj

parent 910515de
var WEBBase = require("../../web.base"); var APIBase = require("../../api.base");
var system = require("../../../system"); var system = require("../../../system");
class ChannelAccessAuthAPI extends WEBBase { class ChannelAccessAuthAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.utilsuserSve = system.getObject("service.utilsSve.utilsuserSve"); this.utilsuserSve = system.getObject("service.utilsSve.utilsuserSve");
......
...@@ -156,6 +156,9 @@ class AppServiceBase { ...@@ -156,6 +156,9 @@ class AppServiceBase {
return system.getResult(null, "execGet data is empty"); return system.getResult(null, "execGet data is empty");
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if(!result.status){
return system.getResultSuccess(result);
}
return result; return result;
} }
......
var system = require("../../../system"); var system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base"); const AppServiceBase = require("../../app.base");
const logCtl = system.getObject("service.common.oplogSve");
//商标查询操作 //商标查询操作
class UtilsUserSve extends AppServiceBase { class UtilsUserSve extends AppServiceBase {
constructor() { constructor() {
super(); super();
this.apppaliparamDao = system.getObject("db.dbapp.apppaliparamDao"); this.apppaliparamDao = system.getObject("db.dbapp.apppaliparamDao");
this.logCtl = system.getObject("service.common.oplogSve");
} }
async getH5AliDingUserByCode(pobj) { async getH5AliDingUserByCode(pobj) {
var item = await this.apppaliparamDao.getItemByUAppId(Number(pobj.appInfo.uapp_id || 0)); var item = await this.apppaliparamDao.getItemByUAppId(Number(pobj.appInfo.uapp_id || 0));
...@@ -28,11 +28,11 @@ class UtilsUserSve extends AppServiceBase { ...@@ -28,11 +28,11 @@ class UtilsUserSve extends AppServiceBase {
if (accessTokenResult.status != 0) { if (accessTokenResult.status != 0) {
return accessTokenResult; return accessTokenResult;
} }
if (accessTokenResult.errcode != 0) { if (accessTokenResult.data.errcode != 0) {
return system.getResult(null, accessTokenResult.errmsg); return system.getResult(null, accessTokenResult.data.errmsg);
} }
param = { param = {
access_token: accessTokenResult.access_token, access_token: accessTokenResult.data.access_token,
code: pobj.actionBody.code code: pobj.actionBody.code
}; };
var userResult = await this.execGetUrl(param, "https://oapi.dingtalk.com/user/getuserinfo"); var userResult = await this.execGetUrl(param, "https://oapi.dingtalk.com/user/getuserinfo");
...@@ -46,15 +46,15 @@ class UtilsUserSve extends AppServiceBase { ...@@ -46,15 +46,15 @@ class UtilsUserSve extends AppServiceBase {
if (userResult.status != 0) { if (userResult.status != 0) {
return userResult; return userResult;
} }
if (userResult.errcode != 0) { if (userResult.data.errcode != 0) {
return system.getResult(null, userResult.errmsg + "-userResult"); return system.getResult(null, userResult.data.errmsg + "-userResult");
} }
return system.getResultSuccess({ return system.getResultSuccess({
channelUserId: userResult.userid, channelUserId: userResult.data.userid,
isAdmin: userResult.is_sys && userResult.is_sys == true ? 1 : 0, isAdmin: userResult.data.is_sys && userResult.data.is_sys == true ? 1 : 0,
isSuper: userResult.sys_level && userResult.sys_level == 1 ? 1 : 0 isSuper: userResult.data.sys_level && userResult.data.sys_level == 1 ? 1 : 0
}); });
} }
} }
module.exports = UtilsUserSve; module.exports = UtilsUserSve;
...@@ -5,7 +5,7 @@ const exec = util.promisify(require('child_process').exec); ...@@ -5,7 +5,7 @@ const exec = util.promisify(require('child_process').exec);
class ExecClient { class ExecClient {
constructor() { constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"; this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'"; this.cmdGetPattern = "curl -G -X GET -d '{data}' '{url}'";
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"; this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
} }
...@@ -58,8 +58,14 @@ class ExecClient { ...@@ -58,8 +58,14 @@ class ExecClient {
} }
FetchGetCmd(subData, url) { FetchGetCmd(subData, url) {
var tmpSubData = null;
if (Object.keys(subData).length > 0) {
tmpSubData = Object.keys(subData).map(key => {
return `${encodeURIComponent(key)}=${encodeURIComponent(subData[key])}`
}).join('&');
}
var cmd = this.cmdGetPattern.replace( var cmd = this.cmdGetPattern.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url); /\{data\}/g, tmpSubData).replace(/\{url\}/g, url);
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
......
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