diff --git a/app/admin/logic/statistic/ProductStatisticLogic.php b/app/admin/logic/statistic/ProductStatisticLogic.php index a87f99710..b7261ab69 100644 --- a/app/admin/logic/statistic/ProductStatisticLogic.php +++ b/app/admin/logic/statistic/ProductStatisticLogic.php @@ -3,6 +3,7 @@ namespace app\admin\logic\statistic; use app\common\logic\BaseLogic; +use app\common\model\store_product\StoreProduct; use app\common\model\store_product_log\StoreProductLog; /** @@ -16,7 +17,7 @@ class ProductStatisticLogic extends BaseLogic { $time = explode('-', $where['create_time']); $time = [strtotime($time[0]), strtotime($time[1])]; - $list = StoreProductLog::whereBetweenTime('create_time',$time[0],$time[1])->with('store') + $list = StoreProductLog::whereBetweenTime('create_time',$time[0],$time[1]) ->field([ 'store_id', 'product_id', @@ -36,6 +37,9 @@ class ProductStatisticLogic extends BaseLogic if (!$item['store_name']) { unset($list[$key]); } + $find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find(); + $item['store_name']=$find['store_name']; + $item['image']=$find['image']; if ($item['profit'] == null) $item['profit'] = 0; if ($item['changes'] == null) $item['changes'] = 0; if ($item['repeats'] == null) {