Bladeren bron

[Chg] Add goods_type in order_goods

Ark 4 jaren geleden
bovenliggende
commit
c978154b08
1 gewijzigde bestanden met toevoegingen van 5 en 4 verwijderingen
  1. 5 4
      src/api/controller/order.js

+ 5 - 4
src/api/controller/order.js

@@ -257,8 +257,7 @@ module.exports = class extends Base {
     }
 
     // 统计商品总价
-    const orderGoodsData = [];
-    orderGoodsData.push({
+    const orderGoodsData = {
       order_id: orderId,
       goods_id: checkedGoodsId,
       goods_sn: checkedGoods.goods_sn,
@@ -270,9 +269,11 @@ module.exports = class extends Base {
       number: this.post('goodsCount'),
       goods_specifition_name_value: checkedGoods.goods_specifition_name_value,
       goods_specifition_ids: checkedGoods.goods_specifition_ids
-    });
+    };
 
-    await this.model('order_goods').addMany(orderGoodsData);
+    if (checkedGoods.promotion_desc.length > 0) orderGoodsData.goods_type = 100;
+
+    await this.model('order_goods').addMany([orderGoodsData]);
 
     return this.success({ orderInfo: orderInfo });
   }