Commit ee911f47 by 孙亚楠

d

parent ed7d1bfc
......@@ -27,6 +27,9 @@ class OrderCtl extends CtlBase {
// TODO:需要去调用商户钱包 扣钱
//TODO:可能需要商户的合同ID和合同名称
if(!pobj.contract_url){
return system.getResult(null, `参数错误 业务合同不能为空`);
}
......@@ -36,8 +39,24 @@ class OrderCtl extends CtlBase {
if(!pobj.live_end){
return system.getResult(null, `参数错误 结束时间不能为空`);
}
if(!pobj.hasOwnProperty('price')){
return system.getResult(null, `参数错误 订单金额不能为空`);
}
pobj.price=system.y2f(pobj.price);
if(pobj.product_type=='2'){//组合产品 需要 规格设成pricee
pobj.product_specifications=pobj.price;
}
if(pobj.product_type=='1'){ //如果是单个产品 需要转化单价
pobj.product_unit_price = system.y2f(pobj.product_unit_price);
}
//保存
let res = await this.orderSve.saveEorder(pobj);
if(res.status==0 && res.data && res.data.price && res.data.product_type){
res.data.price = system.f2y(res.data.price) || 0;
if(res.data.product_type=='2'){ //如果是组合产品
res.data.product_specifications = system.f2y(res.data.product_specifications) || 0;
}
}
return system.getResult(res);
}catch (e) {
console.log(e);
......@@ -61,11 +80,11 @@ class OrderCtl extends CtlBase {
if(!pobj.audit_status){
return system.getResult(null, `参数错误 审核状态不能为空`);
}
pobj.audit_user_id=req.loginUser.id; //获取审核人
let res = await this.orderSve.auditEorder(pobj);
//TODO:审核订单成功之后
if(res.status==0){
pushMerchantTrade(pobj);
this.pushMerchantTrade(pobj);
}
return system.getResult(res);
}catch (e) {
......@@ -84,10 +103,10 @@ class OrderCtl extends CtlBase {
console.log(`推送流水失败 订单信息获取异常`);
}
if(params.audit_status=='20'){ //订单审核成功
//TODO:推送给赵大哥
}
if(params.audit_status=='30'){ //订单审核失败
//TODO:推送给赵大哥
}
}
......@@ -157,4 +176,4 @@ class OrderCtl extends CtlBase {
}
}
module.exports = ProductCtl;
\ No newline at end of file
module.exports = OrderCtl;
\ No newline at end of file
......@@ -200,7 +200,7 @@ class System {
// 商户服务
sve_merchant: local + ":3652" + path,
// 订单服务
sve_order: dev + ":3653" + path,
sve_order: local + ":3653" + path,
}
} else {
return {
......
{
"lockfileVersion": 1
}
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