Commit 397f077b by 宋毅

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

parents e1e9882c caa84b87
......@@ -271,7 +271,7 @@ class QcCenterOrderService extends AppServiceBase {
var reqParams = {
actionBody: {
intentionBizId: res.data.needinfo.channelNeedNo,
status: "beforeConfirmation"
status: "createSolution"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
......@@ -338,6 +338,7 @@ class QcCenterOrderService extends AppServiceBase {
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('www+++result',result)
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
......@@ -351,7 +352,7 @@ class QcCenterOrderService extends AppServiceBase {
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "isClosed"
status: "closeNeed"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
......@@ -362,15 +363,25 @@ class QcCenterOrderService extends AppServiceBase {
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/commen/qcCenterOrderSve.js/closeNeed",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { BizId: pobj.actionBody.needNo, BizType: "esp.wangwen" }, apiVersion: "2020-03-06" });
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
console.log('alalallala',a)
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
// 2020 1021 lin 新增查看日志
self.logCtl.info({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/common/qcCenterOrderSve.js/closeNeed",
content: JSON.stringify(a),
resultInfo: "",
optitle: "推送ali关闭需求->closeNeed",
});
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseWangWenNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
......@@ -477,7 +488,7 @@ async submitFoodSolution(pobj) {
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "beforeConfirmation"
status: "createSolution"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
......@@ -489,7 +500,7 @@ async submitFoodSolution(pobj) {
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/impl/commen/qcCenterOrderSve.js/submitFoodSolution",
op: "service/impl/common/qcCenterOrderSve.js/submitFoodSolution",
content: JSON.stringify(reqParams),
resultInfo: "",
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
......@@ -523,7 +534,7 @@ async foodCloseNeed(pobj) {
pobj.actionType = "abolishIcpProgrammeByNeed"
var reqUrl = this.centerOrderUrl + "action/qcapi/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('food+++result',result)
if (result.status == 0) {
if (result.data) {
pobj.actionBody.orderNo = result.data;
......@@ -537,7 +548,7 @@ async foodCloseNeed(pobj) {
var reqParams = {
actionBody: {
intentionBizId: pobj.actionBody.needNo,
status: "isClosed"
status: "closeNeed"
},
opType: "updateChanceStatus",
appInfo: pobj.appInfo
......@@ -555,8 +566,8 @@ async foodCloseNeed(pobj) {
optitle: "updateChanceStatus推送蜂擎获取的接口信息->aliBusiness2Delivery",
});
// 推送ali
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { BizId: pobj.actionBody.needNo, BizType: "esp.wangwen" }, apiVersion: "2020-03-06" });
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseICPNeed");
var a = await self.aliclient.reqbyget({ action: "CloseIntentionForPartner", reqbody: { IntentionBizId: pobj.actionBody.needNo, BizType: "esp.wangwen" ,Note : pobj.actionBody.note}, apiVersion: "2020-03-06" });
self.utilsPushSve.aliBusiness2Fq(pobj, "pushCloseFoodNeed");
return system.getResultSuccess();
} else {
return system.getResult(null, "close fail 100389 ");
......
......@@ -167,30 +167,20 @@ class UtilsAuthService extends AppServiceBase {
* @returns {Promise<void>}
*/
async channelUserLogin(pobj,actionBody,req){
//360登录地址
let skipUrl = '';
let opResult = system.getResult(null, "req Failure");
//----通过Authorization 获取用户信息
let Authorization = req.headers["authorization"] || "";
if(!Authorization){
opResult.data.redirectUrl = skipUrl;
opResult =system.getResultFail(-99,'用户未登录',{redirectUrl:'skipUrl'});
return opResult;
}
let icCompanyUrl = '';
let subData = {
Authorization:Authorization
}
let rtn = await this.execClient.execFqGet(subData,icCompanyUrl);
let opResult = system.getResultSuccess()
let pin = actionBody.pin;
let result = await this.get360Token();
let token = result.access_token;
//360验证接口
let subData = "pin=" + pin + "&token=" + token
let rtn = await this.restClient.execGet(subData,settings.requestUrl360());
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
return system.getResult(null, "restPost data is empty");
}
var userInfo = JSON.parse(rtn.stdout);
//----结束
let checkRet = JSON.parse(rtn.stdout);
console.log(checkRet,'checkRet--------------')
//---渠道用户登录,有则返回userpin ,没有则注册用户并返回userpin
let channelUserId = userInfo.mobile;
actionBody.channelUserId = channelUserId;
actionBody.channelUserId = pin;
let loginRt = await this.getLoginByUserName(pobj,actionBody);
if (loginRt.status != 0 && loginRt.status != 2060) {
return loginRt;
......@@ -203,5 +193,14 @@ class UtilsAuthService extends AppServiceBase {
return opResult;
}
async get360Token(){
let rtn = await this.execClient.exec360GetToken(settings.tokenUrl360())
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost data is empty");
}
let result = JSON.parse(rtn.stdout);
return result;
}
}
module.exports = UtilsAuthService;
......@@ -2,6 +2,7 @@ var childproc = require('child_process');
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const uuidv4 = require('uuid/v4');
var settings = require("../../config/settings");
class ExecClient {
constructor() {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
......@@ -9,7 +10,8 @@ class ExecClient {
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
this.cmdFeishuGetPattern = "curl -X GET -k -H 'Content-Type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url} ";
this.cmdFeishuPostPattern = "curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}";
//360
this.cmd360PostPattern = "curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}"
}
getUUID() {
var uuid = uuidv4();
......@@ -80,11 +82,6 @@ class ExecClient {
console.log(cmd);
return cmd;
}
FetchFqGetCmd(subData, url) {
var cmd = this.cmdFeishuGetPattern.replace(/\{url\}/g, url).replace(/\{Authorization\}/g, "Bearer " + subData.Authorization);
console.log(cmd);
return cmd;
}
//飞书小程序GET请求
FetchFeishuGetCmd(subData, url) {
......@@ -106,8 +103,16 @@ class ExecClient {
return result;
}
async execFqGet(subData, url) {
let cmd = this.FetchFqGetCmd(subData, url);
Fetch360PostCmd(subData,url){
var cmd = this.cmd360PostPattern.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url);
console.log(cmd);
return cmd;
}
async exec360GetToken(url){
let obj = {"scope":"smart_business","grant_type":"client_credentials"}
let cmd = this.Fetch360PostCmd(qs.stringify(obj),url);
console.log(cmd);
var result = await this.exec(cmd);
return result;
......
......@@ -19,7 +19,6 @@ class RestClient {
this.cmdPostPattern5 = "curl -k --data '{data}' {url}";
// authorization=[token]
this.cmdPostpatternToken = "curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url}"
}
getUUID() {
var uuid = uuidv4();
......@@ -172,6 +171,12 @@ class RestClient {
var result = await this.exec(cmd);
return result;
}
async execDeliveryPost(subdata,url){
let cmd = this.FetchPostCmd(subdata,url)
cmd += " -H 'XAPPKEY:647a68c9-da01-40d3-9763-1ffa0f64cf3f'"
var result = await this.exec(cmd);
return result;
}
test() {
console.log("hello");
}
......
......@@ -228,6 +228,20 @@ var settings = {
return "https://m.ucommune.com/"// 6.29lin修改为测试环境。原因优客 目前还没有正式环境
}
},
tokenUrl360:function(){
if (this.env == "dev") {
return "https://oauth2.e.360.cn/site/token"// 360测试环境
} else {
return ""//
}
},
requestUrl360:function(){
if (this.env == "dev") {
return "http://180.163.239.98:38085/"// 360测试环境
} else {
return ""//
}
},
aliUappId: function () {
if (this.env == "dev") {
return 18// uapp_id
......
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