Commit 206e07b0 by 宋毅

tj

parent 155deecc
...@@ -7,10 +7,40 @@ class UtilsOrderService extends AppServiceBase { ...@@ -7,10 +7,40 @@ class UtilsOrderService extends AppServiceBase {
super(); super();
this.centerOrderUrl = settings.centerOrderUrl(); this.centerOrderUrl = settings.centerOrderUrl();
}; };
async addOrder(pobj, req) { /**
* 创建订单
var url = this.centerOrderUrl + "action/order/springBoard"; * @param {*} pobj
var result = await this.restPostUrl(pobj, url); * @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;
pobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
console.log(pobj);
var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
} }
......
...@@ -57,6 +57,7 @@ module.exports = function (app) { ...@@ -57,6 +57,7 @@ module.exports = function (app) {
return; return;
} else { } else {
var params = { var params = {
"appInfo": req.body.appInfo,
"actionType": "getLoginInfo", "actionType": "getLoginInfo",
"actionBody": { "actionBody": {
"userpin": userpin "userpin": userpin
......
...@@ -7,8 +7,8 @@ var ENVINPUT = { ...@@ -7,8 +7,8 @@ var ENVINPUT = {
REDIS_HOST: process.env.REDIS_HOST, REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT, REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD, REDIS_PWD: process.env.REDIS_PWD,
DB_NAME: process.env.ZC_API_DB_NAME, DB_NAME: process.env.CENTER_CHANNEL_DB_NAME,
REDIS_DB: process.env.ZC_API_REDIS_DB, REDIS_DB: process.env.CENTER_CHANNEL_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev" APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
}; };
var settings = { 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