Commit 1c131b9d by 任晓松

add 同步接口

parent 3550070e
......@@ -29,6 +29,9 @@ class ProductAPI extends WEBBase {
case "getParamsFor360":
opResult = await this.utils360Sve.getParamsFor360(pobj, pobj.actionBody);
break;
case "pushTmOrderStatus":
opResult = await this.utils360Sve.pushTmOrderStatus(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -143,6 +143,52 @@ class utils360Sve extends AppServiceBase {
return system.getResultSuccess(result.data);
}
async pushTmOrderStatus(pobj){
let token = await this.utilsAuthSve.get360Token();
let url = settings.pushUrl360() + 'api/v1/eshop/GsbOrderUpdate?token=' + token.access_token;
let order_id = pobj.orderNo;
let sub_status = pobj.sub_status;
let status = pobj.status;
let pushObj = {
order_id,
status,
sub_status: sub_status
}
let result = await this.restPostUrl(pushObj, url);
if (result.code == 200) {
this.pushlogSve.createDb({
op: "360-pushTMOrderStatus",
content: JSON.stringify(pushObj),//推送的参数信息
resultInfo: JSON.stringify(result),
returnType: '1',
logLevel: 1,
opTitle: "推送360信息返回成功"
});
} else {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + result.msg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushTMOrderStatus",
});
}
console.log(result, '-------------push360-----------------')
return result;
} catch (e) {
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "utilsSve/utils360Sve/pushTMOrderStatus",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常status->pushOrderStatus",
});
}
}
module.exports = utils360Sve;
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