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

This commit is contained in:
mkm 2024-08-02 20:54:45 +08:00
parent 3f9bda6bef
commit ee8a43b2ac

View File

@ -71,7 +71,7 @@ class OrderLogic extends BaseLogic
self::setError('购物车为空'); self::setError('购物车为空');
return false; return false;
} }
try { // try {
self::$total_price = 0; self::$total_price = 0;
self::$pay_price = 0; self::$pay_price = 0;
self::$cost = 0; //成本由采购价替代原成本为门店零售价 self::$cost = 0; //成本由采购价替代原成本为门店零售价
@ -94,7 +94,7 @@ class OrderLogic extends BaseLogic
$find['top_cate_id']=$find['cate_id']; $find['top_cate_id']=$find['cate_id'];
if($StoreCategory && $StoreCategory['pid']>0){ if($StoreCategory && $StoreCategory['pid']>0){
$StoreCategory2=StoreCategory::where('id',$StoreCategory['pid'])->find(); $StoreCategory2=StoreCategory::where('id',$StoreCategory['pid'])->find();
if($StoreCategory2 && $StoreCategory['pid']>0){ if($StoreCategory2 && $StoreCategory2['pid']>0){
$find['top_cate_id']=$StoreCategory2['pid']; $find['top_cate_id']=$StoreCategory2['pid'];
}else{ }else{
$find['top_cate_id']=$StoreCategory['pid']; $find['top_cate_id']=$StoreCategory['pid'];
@ -246,10 +246,10 @@ class OrderLogic extends BaseLogic
} }
} }
} }
} catch (\Exception $e) { // } catch (\Exception $e) {
self::setError($e->getMessage()); // self::setError($e->getMessage());
return false; // return false;
} // }
return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store']]; return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store']];
} }