feat(store_order): 新增判断店铺ID来查询分支商品功能

This commit is contained in:
mkm 2024-09-06 13:46:27 +08:00
parent 473b276e55
commit 816521c6be

View File

@ -13,6 +13,7 @@ use app\admin\validate\store_order\StoreOrderValidate;
use app\common\enum\PayEnum;
use app\common\logic\PayNotifyLogic;
use app\common\model\delivery_service\DeliveryService;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
@ -167,7 +168,11 @@ class StoreOrderController extends BaseAdminController
$order['delivery_time'] = date('Y-m-d', $time);
$data = StoreOrderCartInfo::where('oid', $id)->select();
foreach ($data as $key => &$value) {
$find = StoreProduct::where('id', $value->product_id)->find();
if(in_array($order['store_id'],[17,18])){
$find = StoreBranchProduct::where('product_id', $value->product_id)->where('store_id',$order['store_id'])->find();
}else{
$find = StoreProduct::where('id', $value->product_id)->find();
}
$value->store_name = $find['store_name'] ?? '';
$value->store_info = $find['store_info'] ?? '';
$value->total_price = bcmul($value['price'], $value['cart_num'], 2);