Commit 2a356e75 by 宋毅

tj

parent 6bef5bcb
......@@ -24,6 +24,7 @@ class tmqueryCtl extends CtlBase {
if (req.session.userPinInfo.encryptChannelUserId != pobj.actionBody.channelUserId) {
return system.getResult(null, "ueser login is error");
}
pobj.isDecryptUser = "yes";
}
var rc = system.getObject("util.execClient");
......@@ -106,7 +107,7 @@ class tmqueryCtl extends CtlBase {
return system.getResult(null, "处理请求失败");
}
if (["jd"].indexOf(pobj.actionProcess) >= 0 && pobj.actionType == "subTmOrder") {
var opPayPageInfoResult = await this.opPayPageInfo(pobj);
var opPayPageInfoResult = await this.opPayPageInfo(pobj, req);
return opPayPageInfoResult;
}
return result;
......@@ -241,9 +242,16 @@ class tmqueryCtl extends CtlBase {
return system.getResultFail(-200, "操作error");
}
}
async opPayPageInfo(pobj) {
async opPayPageInfo(pobj, req) {
if (!pobj.itemCode) {
return system.getResult(null, "itemCode param is not empty");
}
if (pobj.actionProcess == "jd") {
var tmpResult = await this.opJdOrder();
var itemCodeList = pobj.itemCode.spilt('-');
if (itemCodeList.length < 2) {
return system.getResult(null, "itemCode is error");
}
var tmpResult = await this.opJdOrder(pobj.itemCode, itemCodeList, req);
// { result: true,
// data:
// '{"success":true,"code":null,"msg":null,"data":{"orderNumber":"6058867","erpOrderId":"523198741458590844",
......@@ -254,6 +262,7 @@ class tmqueryCtl extends CtlBase {
var payDataResult = JSON.parse(tmpResult.data);
console.log(payDataResult, "payDataResult...........payDataResult........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$..002..");
if (payDataResult && payDataResult.success && payDataResult.success == true) {
//更新订单信息
return system.getResultSuccess({ payUrl: payDataResult.data.returnUrl });
}//成功
}
......@@ -261,8 +270,9 @@ class tmqueryCtl extends CtlBase {
}
return system.getResultSuccess()
}
async opJdOrder(pobj, qobj, req) {
async opJdOrder(itemCode, itemCodeList, req) {
try {
const { Signer, Context } = require('../jd-gateway-sdk');
let ctx = new Context('x3k0s704lfun-test.cn-north-1.jdcloud-api.net', '/market/order/api/submit', 'POST', null, 'empty');
ctx.regionId = 'cn-north-1'
......@@ -277,7 +287,8 @@ class tmqueryCtl extends CtlBase {
//ctx.body = "pin=jcloud_pRiHQTd&serviceId=580010&itemCode=FW_GOODS-580010-1&platform=6"
//POST
var qs = require('querystring');
var post_data = { pin: "syaify", serviceId: 580010, itemCode: "FW_GOODS-580010-1", platform: 6, orderNum: 1, articleType: 1 };//这是需要提交的数据
// var post_data = { pin: "syaify", serviceId: 580010, itemCode: "FW_GOODS-580010-1", platform: 6, orderNum: 1, articleType: 1 };//这是需要提交的数据
var post_data = { pin: req.session.userPinInfo.channelUserId, serviceId: itemCodeList[1], itemCode: itemCode, platform: 6, orderNum: 1, articleType: 1, additions: { "195": 0 } };//这是需要提交的数据
var tmpContent = JSON.stringify(post_data);
var tmpContentLength = Buffer.byteLength(tmpContent);
var content = qs.stringify(post_data);
......
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