Commit 5dd9d51a by 任晓松

update

parent ca39c0bc
...@@ -13,63 +13,45 @@ class utils360Sve extends AppServiceBase { ...@@ -13,63 +13,45 @@ class utils360Sve extends AppServiceBase {
} }
//组合参数,由前端传到360 //组合参数,由前端传到360
async getParamsFor360(pobj, actionBody) { async getParamsFor360(pobj, actionBody) {
if (!actionBody.orderNo) { if (!actionBody.orderNo) {
return system.getResult(null, "actionBody.orderNo can not be empty,100110"); return system.getResult(null, "actionBody.orderNo can not be empty,100110");
} }
let seaUrl = this.centerOrderUrl + 'opaction/opPayOrder/getOrderListByOrderServiceNo'; pobj.actionType = "getPayOrderInfo";
let seaRet = await this.restPostUrl(pobj, seaUrl); let orderUrl = settings.centerOrderUrl() + "action/order/springBoard";
if (seaRet.status != 0) { let orderResult = await this.restPostUrl(pobj, orderUrl);
return system.getResultFail(-1, '获取订单信息失败') if (orderResult.status != 0) {
} return orderResult;
let totalSum = 0; }
let sku_id = ''; pobj.actionType ="getOrderDeliveryInfo";
let amount = 0; var deliveryResult = await this.restPostUrl(pobj,orderUrl);
let consignee = ""; if (deliveryResult.status != 0) {
let mobile = ""; return deliveryResult;
let email = "";
for (let i = 0; i < seaRet.data.length; i++) {
let item = seaRet.data[i];
if(!mobile){
pobj.actionType.orderNo = item.orderNo;
pobj.actionType = "getOrderDeliveryInfo";
let deliveryResult = await this.restPostUrl(pobj, orderUrl);
consignee = deliveryResult.data.orderContact.contactName;
mobile = deliveryResult.data.orderContact.mobile;
email = deliveryResult.data.orderContact.email
}
sku_id = item.itemCode;
totalSum += Number(item.totalSum);
amount += Number(item.payTotalSum);
}
// let sku_id = orderResult.data.orderProduct.itemCode;
// let price = Number(orderResult.data.orderProduct.price)*100;
let price = totalSum * 100;
// let quantity = seaRet.data.length;
// let amount = Number(orderResult.data.receiptVoucher.totalSum)*100;
amount = amount * 100;
let order_id = pobj.actionBody.orderNo;
// let consignee = deliveryResult.data.orderContact.contactName;
// let mobile = deliveryResult.data.orderContact.mobile;
// let email = deliveryResult.data.orderContact.email;
let singStr = sku_id + price + order_id + pobj.appInfo.uapp_secret;
let sign = md5(singStr).toUpperCase();
// 推送参数
let result = {
sku_id: sku_id,
price: price,
quantity: seaRet.data.length,
amount: amount,
order_id: order_id,
consignee: consignee,
mobile: mobile,
email: email,
sign: sign
}
return system.getResult(result);
} }
let sku_id = orderResult.data.orderProduct.itemCode;
let price = Number(orderResult.data.orderProduct.price)*100;
let quantity = orderResult.data.orderProduct.quantity;
let amount = Number(orderResult.data.receiptVoucher.totalSum)*100;
let order_id = orderResult.data.receiptVoucher.sourceOrderNo;
let consignee = deliveryResult.data.orderContact.contactName;
let mobile = deliveryResult.data.orderContact.mobile;
let email = deliveryResult.data.orderContact.email;
let singStr = sku_id + price + order_id + pobj.appInfo.uapp_secret;
let sign = md5(singStr).toUpperCase();
let result ={
sku_id,
price,
quantity,
amount,
order_id,
consignee,
mobile,
email,
sign
}
return system.getResult(result);
}
//更新订单状态到360 //更新订单状态到360
async pushOrderStatus(pobj) { async pushOrderStatus(pobj) {
...@@ -93,7 +75,7 @@ class utils360Sve extends AppServiceBase { ...@@ -93,7 +75,7 @@ class utils360Sve extends AppServiceBase {
order_id, status order_id, status
} }
let result = await this.restPostUrl(pushObj, url); let result = await this.restPostUrl(pushObj, url);
if(result.code ==200){ if (result.code == 200) {
this.pushlogSve.createDb({ this.pushlogSve.createDb({
op: "360-pushOrderStatus", op: "360-pushOrderStatus",
content: JSON.stringify(pushObj),//推送的参数信息 content: JSON.stringify(pushObj),//推送的参数信息
...@@ -102,7 +84,7 @@ class utils360Sve extends AppServiceBase { ...@@ -102,7 +84,7 @@ class utils360Sve extends AppServiceBase {
logLevel: '1', logLevel: '1',
opTitle: "推送360信息返回成功" opTitle: "推送360信息返回成功"
}); });
}else{ } else {
this.logCtl.error({ this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
...@@ -113,7 +95,7 @@ class utils360Sve extends AppServiceBase { ...@@ -113,7 +95,7 @@ class utils360Sve extends AppServiceBase {
optitle: pobj.opType + "推送操作异常status->pushOrderStatus", optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
}); });
} }
console.log(result,'-------------push360-----------------') console.log(result, '-------------push360-----------------')
return result; return result;
} catch (e) { } catch (e) {
this.logCtl.error({ this.logCtl.error({
......
...@@ -205,12 +205,7 @@ module.exports = function (app) { ...@@ -205,12 +205,7 @@ module.exports = function (app) {
try { try {
var client_ip = system.get_client_ip(req); var client_ip = system.get_client_ip(req);
let result ={}; let result ={};
const orderNo = req.body.orderNo; result = await utilsOrderSve.channelPayNotify(req.body, client_ip);
if(orderNo.indexOf('CN') ==0){
result = await utilsOrderSve.channelOrdersPayNotify(req.body,client_ip);
}else{
result = await utilsOrderSve.channelPayNotify(req.body, client_ip);
}
logCtl.info({ logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道支付订单通知 api层", optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道支付订单通知 api层",
op: "center-channel/orderNotify/channelPayNotify", op: "center-channel/orderNotify/channelPayNotify",
......
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