优化详情查询逻辑

This commit is contained in:
liu 2024-07-02 10:58:00 +08:00
parent 3c9c20e0f4
commit e128394934

View File

@ -424,6 +424,9 @@ class OrderLogic extends BaseLogic
$find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
->field('product_id,cart_num nums,store_id')->select()->each(function ($item) use ($find) {
$find = StoreBranchProduct::where('product_id', $item['product_id'])->where('store_id', $find['store_id'])->find();
if(empty($find)){
$find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
}
$item['store_name'] = $find['store_name'];
$item['image'] = $find['image'];
$item['price'] = $find['price'];