feat: 后台下单功能实现及优化

This commit is contained in:
mkm 2024-09-03 15:50:17 +08:00
parent 729b05efbf
commit 5b64d0d9b2
2 changed files with 7 additions and 5 deletions

View File

@ -56,7 +56,7 @@ class StoreOrderLogic extends BaseLogic
$user = User::where('id', $params['user_id'])->find();
$params['shipping_type'] = 2;
$params['pay_type'] = 7;
$params['source'] =2;
$params['source'] =2;//后台下单
$order = OrderLogic::createOrder($cartId, null, $user, $params);
return true;
}

View File

@ -89,7 +89,12 @@ class OrderLogic extends BaseLogic
$off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
foreach ($cart_select as $k => $v) {
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
if (isset($params['source']) && $params['source'] == 2) {
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
$find = StoreProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field($field)->find();
}else{
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
}
if (!$find) {
throw new BusinessException('商品不存在');
}
@ -472,9 +477,6 @@ class OrderLogic extends BaseLogic
$data[$k]['store_id'] = $v['store_id'];
$data[$k]['staff_id'] = $v['staff_id'];
$data[$k]['combination_id'] = 0;
$data[$k]['seckill_id'] = 0;
$data[$k]['bargain_id'] = 0;
$data[$k]['discount_id'] = 0;
$data[$k]['status'] = 1;
$data[$k]['staff_id'] = 0;
$data[$k]['is_new'] = 0;