feat(OrderLogic): 修改订单逻辑,优化商品处理流程,更新商品字段获取方式

This commit is contained in:
mkm 2024-08-02 20:30:40 +08:00
parent 795d19dda3
commit 081c89442c

View File

@ -83,7 +83,7 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额
/** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,product_id,top_cate_id,store_info,rose';
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,top_cate_id,store_info,rose';
foreach ($cart_select as $k => $v) {
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
if (!$find) {
@ -115,7 +115,7 @@ class OrderLogic extends BaseLogic
$deduction_price = bcsub($cart_select[$k]['total_price'], $cart_select[$k]['pay_price'], 2);
$cart_select[$k]['deduction_price'] = $deduction_price; //抵扣金额
}
$cart_select[$k]['product_id'] = $find['product_id'];
$cart_select[$k]['product_id'] = $find['id'];
$cart_select[$k]['old_cart_id'] = $v['id'];
$cart_select[$k]['cart_num'] = $v['cart_num'];
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';