feat(OrderLogic): 更新订单逻辑,优化商品处理流程,调整商品字段获取方式
This commit is contained in:
parent
081c89442c
commit
1151b8fb4e
@ -83,13 +83,24 @@ class OrderLogic extends BaseLogic
|
|||||||
self::$fresh_price = 0; //生鲜金额
|
self::$fresh_price = 0; //生鲜金额
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
$off_activity = Config::where('name', 'off_activity')->value('value');
|
$off_activity = Config::where('name', 'off_activity')->value('value');
|
||||||
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,top_cate_id,store_info,rose';
|
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
||||||
if (!$find) {
|
if (!$find) {
|
||||||
self::setError('商品不存在');
|
self::setError('商品不存在');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$StoreCategory=StoreCategory::where('id',$find['cate_id'])->find();
|
||||||
|
$find['top_cate_id']=$find['cate_id'];
|
||||||
|
if($StoreCategory && $StoreCategory['pid']>0){
|
||||||
|
$StoreCategory2=StoreCategory::where('id',$StoreCategory['pid'])->find();
|
||||||
|
if($StoreCategory2 && $StoreCategory['pid']>0){
|
||||||
|
$find['top_cate_id']=$StoreCategory2['pid'];
|
||||||
|
}else{
|
||||||
|
$find['top_cate_id']=$StoreCategory['pid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
unset($cart_select[$k]['id']);
|
unset($cart_select[$k]['id']);
|
||||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||||
if ($off_activity == 1 || ($user != null && in_array($user['user_ship'], [4, 6, 7]))) {
|
if ($off_activity == 1 || ($user != null && in_array($user['user_ship'], [4, 6, 7]))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user