Commit 9bdaff85 by 宋毅

tj

parent 6f01c503
......@@ -105,8 +105,8 @@ class tmqueryCtl extends CtlBase {
if (!result) {
return system.getResult(null, "处理请求失败");
}
if (["jd"].indexOf(pobj.actionProcess).length >= 0 && pobj.actionType == "subTmOrder") {
var opPayPageInfoResult = await opPayPageInfo(pobj);
if (["jd"].indexOf(pobj.actionProcess) >= 0 && pobj.actionType == "subTmOrder") {
var opPayPageInfoResult = await this.opPayPageInfo(pobj);
return opPayPageInfoResult;
}
return result;
......@@ -243,11 +243,15 @@ class tmqueryCtl extends CtlBase {
}
async opPayPageInfo(pobj) {
if (pobj.actionProcess == "jd") {
var tmpResult = this.opJdOrder();
if (!tmpResult.success && tmpResult.success != true) {
//记录下来
var tmpResult = await this.opJdOrder();
console.log(tmpResult,"tmpResult...........opPayPageInfo........$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$....");
if (tmpResult && tmpResult.result && tmpResult.result == true) {
var payDataResult = JSON.parse(tmpResult.data);
if (payDataResult && payDataResult.success && payDataResult.success == true) {
system.getResultSuccess({ payUrl: tmpResult.data.returnUrl });
}//成功
}
return system.getResultSuccess({ payUrl: tmpResult.data.returnUrl });
return system.getResult(null, "pay page is error");
}
return system.getResultSuccess()
}
......@@ -300,8 +304,9 @@ class tmqueryCtl extends CtlBase {
}
console.log("\n post options:\n", options);
console.log("\n tmpContent:\n", tmpContent);
var req = http.request(options, function (res) {
var reqResult = await new Promise(function (resolve, reject) {
let req = http.request(options, function (res) {
// res.setEncoding(encoding);
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
var _data = '';
......@@ -309,17 +314,42 @@ class tmqueryCtl extends CtlBase {
_data += chunk;
});
res.on('end', function () {
console.log("\n--->>\nresult:", _data)
console.log("\n--req---成功->>\nresult:", _data)
resolve({ result: true, data: _data });
});
});
req.on('error', (e) => {
console.error(`请求遇到问题-------------: ${e.message}`);
resolve({ result: false, errmsg: e.message });
});
req.write(tmpContent);
req.end();
});
var tmd = 99;
return reqResult;
// var req = http.request(options, function (res) {
// console.log("statusCode: ", res.statusCode);
// console.log("headers: ", res.headers);
// var _data = '';
// res.on('data', function (chunk) {
// _data += chunk;
// });
// res.on('end', function () {
// console.log("\n--->>\nresult:", _data)
// });
// });
// req.on('error', (e) => {
// console.error(`请求遇到问题-------------: ${e.message}`);
// });
// req.write(tmpContent);
// req.end();
// var tmd = 99;
} catch (errorMsg) {
console.log(errorMsg, "--jd>>>>>>>errorMsg..............................>>>>>>");
return { success: false, code: -200, msg: errorMsg.stack };
}
}
async pushJdOrder(pushData, req) {
......
......@@ -1242,13 +1242,23 @@
apply: that.apply,
nclones: that.nclOne,
itemCode: that.itemCode,
channelUser: {
channelUserId: that.$route.query.channelUserId
},
channelOrder: {
quantity: 1,
payStatus: "dfk"
}
};
var jdObj = that.$root.copyParams(obj, "subTmOrder", "/action/tmOrder/springBoard", "yes", "yes");
that.$root.postReq("/web/trademark/tmqueryCtl/doPost", jdObj).then(function (d) {
if (d.status == 0) {
console.log(`///////////////////////////////`, d);
if (d.status == 0) {
that.$message.warning("操作成功");
location.href = d.data.payUrl;
} else {
console.log(d);
console.log(d, "subTmOrder..........");
that.$message.warning(d.msg);
}
}).catch(function (e) {
that.$message.warning("操作失败");
......
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