fix(order): 修复下单时未检查商品状态导致的异常
- 在计算订单价格时,增加了对商品状态的检查 - 对于下架商品,抛出异常提示用户更换商品后下单 - 修改了查询商品信息时的字段列表,增加了 is_show 和 status 字段
This commit is contained in:
parent
944aaf2425
commit
1185ecf9ec
@ -92,13 +92,13 @@ 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,cate_id,store_info,rose';
|
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose,is_show';
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
if($source==0){
|
if($source==0){
|
||||||
$source=$v['source'];
|
$source=$v['source'];
|
||||||
}
|
}
|
||||||
if ($source == 2) {
|
if ($source == 2) {
|
||||||
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
|
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose,status';
|
||||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
||||||
if($find && $find['status']==0){
|
if($find && $find['status']==0){
|
||||||
throw new BusinessException('订单存在下架商品请更换后下单');
|
throw new BusinessException('订单存在下架商品请更换后下单');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user