Commit 03797396 by 孙亚楠

d

parent ab5e7da1
......@@ -10,6 +10,9 @@ class OrderCtl extends CtlBase {
this.merchantaccountSve = system.getObject("service.merchant.merchantaccountSve");
this.merchanttradeSve = system.getObject("service.merchant.merchanttradeSve");
// this.redisClient = system.getObject("util.redisClient");
this.productSve = system.getObject("service.product.productSve");
this.ordersignlogSve = system.getObject("service.order.ordersignlogSve");
this.orderauthlogSve = system.getObject("service.order.orderauthlogSve");
}
/**
......@@ -118,7 +121,12 @@ class OrderCtl extends CtlBase {
let res =await this.merchantaccountSve.reduceAccountBalance({merchant_id:orderBean.merchant_id,amount:orderBean.price});
if(res.status==0){
console.log("扣除余额成功 返回结果:" + JSON.stringify(res));
this.merchanttradeSve.valetorder({merchant_id:orderBean.merchant_id,amount:orderBean.price,trade_data_id:orderBean.id,trade_voucher:null});
let res = await this.merchanttradeSve.valetorder({merchant_id:orderBean.merchant_id,amount:orderBean.price,trade_data_id:orderBean.id});
if(res.status==0 && res.data && res.data.id){
console.log('交易流水创建完成 结果:' + JSON.stringify(res));
let r = await this.orderSve.updOrderSimple({id: orderBean.id, trade_id: res.data.id});
console.log("更新交易流水ID完成 结果:"+JSON.stringify(r));
}
}
}
if(params.audit_status=='30'){ //订单审核失败
......@@ -164,6 +172,8 @@ class OrderCtl extends CtlBase {
if(res.status!=0 || res.data.count==0){
return res;
}
//格式化产品信息
let ids = [],productMap={};
for (let item of res.data.rows) {
item.price = system.f2y(item.price);
if(item.product_type=='1'){
......@@ -172,6 +182,18 @@ class OrderCtl extends CtlBase {
if(item.product_type=='2'){
item.product_specifications = system.f2y(item.product_specifications);
}
ids.push(item.product_id);
}
let p_listRes = await this.productSve.getByIds({ids:ids});
if(p_listRes.status!=0){
return system.getResul(`获取订单产品失败`);
}
//将产品列表映射成Map结构
for (let ele of p_listRes.data) {
productMap[ele.id]=ele;
}
for (let item of res.data.rows) {
item.product_info = productMap[item.product_id];
}
return res;
}catch (e) {
......@@ -202,6 +224,24 @@ class OrderCtl extends CtlBase {
return system.getResult(null, `系统错误`);
}
}
/**
* fn:查看日志
* @param pobj
* @param pobj2
* @param req
* @param res
* @returns {Promise<void>}
*/
async pageEorderLog(pobj, pobj2, req, res){
if(pobj.product_property=='1'){
return await this.orderauthlogCtl.pageEorderAuthLog(pobj);
}else if(pobj.product_property=='2'){
return await this.ordersignlogSve.pageEorderSignLog(pobj);
}else{
return system.getResult(null, `参数错误 产品类型属性不存在`);
}
}
}
module.exports = OrderCtl;
\ No newline at end of file
......@@ -51,6 +51,15 @@ class UserService extends ServiceBase {
return await this.callms("sve_order", "updEorderStatus", params);
}
/**
* fn:更新订单(单表更新)
* @param params
* @returns {Promise<void>}
*/
async updOrderSimple(params){
return await this.callms("sve_order", "updOrderSimple", params);
}
......
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