Commit 206e07b0 by 宋毅

tj

parent 155deecc
......@@ -7,10 +7,40 @@ class UtilsOrderService extends AppServiceBase {
super();
this.centerOrderUrl = settings.centerOrderUrl();
};
async addOrder(pobj, req) {
/**
* 创建订单
* @param {*} pobj
* @param {*} actionBody {channelItemCode:渠道产品的编码,id:定价id,quantity:订单数量,totalSum:300}
*/
async addOrder(pobj, actionBody) {
if (!actionBody.channelItemCode) {
return system.getResult(null, "产品编码有误,10010");
}
if (!actionBody.id || Number(actionBody.id) <= 0) {
return system.getResult(null, "定价ID有误,10030");
}
if (!actionBody.quantity || Number(actionBody.quantity) <= 0) {
return system.getResult(null, "订单数量有误,10050");
}
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
pobj.actionType = "getProductDetail";
var productItemResult = await this.restPostUrl(pobj, url);
if (productItemResult.status != 0) {
return productItemResult;
}
pobj.actionType = "getProductInterface";
pobj.actionBody.productId = productItemResult.data.id;
var productItemInterfaceResult = await this.restPostUrl(pobj, url);
if (productItemInterfaceResult.status != 0) {
return productItemInterfaceResult;
}
productItemResult.data.interface_info = productItemInterfaceResult.data;
pobj.actionBody.product_info = productItemResult.data;
var url = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, url);
pobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
console.log(pobj);
var result = await this.restPostUrl(pobj, reqUrl);
return result;
}
}
......
......@@ -57,6 +57,7 @@ module.exports = function (app) {
return;
} else {
var params = {
"appInfo": req.body.appInfo,
"actionType": "getLoginInfo",
"actionBody": {
"userpin": userpin
......
......@@ -7,8 +7,8 @@ var ENVINPUT = {
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD,
DB_NAME: process.env.ZC_API_DB_NAME,
REDIS_DB: process.env.ZC_API_REDIS_DB,
DB_NAME: process.env.CENTER_CHANNEL_DB_NAME,
REDIS_DB: process.env.CENTER_CHANNEL_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
};
var settings = {
......
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