Commit 14715ebc by linboxuan

tmorder add

parent c3caf3a4
var WEBBase = require("../../web.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ProductAPI extends WEBBase {
constructor() {
super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
pobj.requestId = req.requestId;
var opResult = null;
switch (action_type) {
case "tmAccept"://2020 0828 lin 新增 ali商标交易 创建订单接口
opResult = await this.utilsOrderSve.tmAccept(pobj, pobj.actionBody);
break;
case "tmRefuse"://2020 0828 lin 新增 ali商标交易 关闭订单接口
opResult = await this.utilsOrderSve.tmRefuse(pobj, pobj.actionBody);
break;
case "tmStatus"://2020 0828 lin 新增 ali商标交易 订单查询
opResult = await this.utilsOrderSve.tmStatus(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ProductAPI;
...@@ -795,5 +795,58 @@ class UtilsOrderService extends AppServiceBase { ...@@ -795,5 +795,58 @@ class UtilsOrderService extends AppServiceBase {
return system.getResultFail(-200, e.stack); return system.getResultFail(-200, e.stack);
} }
} }
async tmAccept(pobj) {// 2020 0828 lin 新增 ali商标交易 创建订单接口
try {
var actionBody = pobj.actionBody;
actionBody.channelItemCode = "sbjy"
actionBody.quantity = 1;
pobj.actionType = "getProductDetail";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemResult = await this.restPostUrl(pobj, url);
if (productItemResult.status != 0) {
return productItemResult;
}
pobj.actionBody.product_info = productItemResult.data;
var verifyResult = await this.isOrderVerify(pobj, pobj.actionBody);
if (verifyResult.status != 0) {
return verifyResult;
}
pobj.actionType = "getProductInterface";
pobj.actionBody.product_id = pobj.actionBody.product_info.id;
var productItemInterfaceResult = await this.restPostUrl(pobj, url);
pobj.actionBody.product_info.interface_info = productItemInterfaceResult.data;
pobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// console.log(pobj);
var result = await this.restPostUrl(pobj, reqUrl);
result.totalSum = actionBody.totalSum;
return result;
if(result) {
var result = {
"errorCode": "error",
"errorMsg": orderinfo.msg,
"module": { "orderId": "" },
"requestId": req.requestId,
"success": false
}
return result;
}
} catch (e) {
var result = {
"errorCode": "error",
"errorMsg": e,
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
return result;
}
}
} }
module.exports = UtilsOrderService; module.exports = UtilsOrderService;
...@@ -247,7 +247,8 @@ module.exports = function (app) { ...@@ -247,7 +247,8 @@ module.exports = function (app) {
"orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList","opSubmitNeed","opNeedClose","opNeedList","getItemByNeedNo","opNeedDetailByChannelNo", "orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList","opSubmitNeed","opNeedClose","opNeedList","getItemByNeedNo","opNeedDetailByChannelNo",
"getNeedListUser", "getNeedListUser",
"manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention" "submitIcpIntention", "queryIntentionList", "confirmIcpIntention",
"tmAccept", "tmRefuse", "tmStatus"
]; ];
if (lst.indexOf(req.body.actionType) >= 0) { if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["userpin"] || ""; var userpin = req.headers["userpin"] || "";
......
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