feat: 添加StoreProduct模型以获取商品信息
This commit is contained in:
parent
84a6854825
commit
1fb3f295ad
@ -3,6 +3,7 @@
|
|||||||
namespace app\admin\logic\statistic;
|
namespace app\admin\logic\statistic;
|
||||||
|
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_log\StoreProductLog;
|
use app\common\model\store_product_log\StoreProductLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,7 +17,7 @@ class ProductStatisticLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
$time = explode('-', $where['create_time']);
|
$time = explode('-', $where['create_time']);
|
||||||
$time = [strtotime($time[0]), strtotime($time[1])];
|
$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([
|
->field([
|
||||||
'store_id',
|
'store_id',
|
||||||
'product_id',
|
'product_id',
|
||||||
@ -36,6 +37,9 @@ class ProductStatisticLogic extends BaseLogic
|
|||||||
if (!$item['store_name']) {
|
if (!$item['store_name']) {
|
||||||
unset($list[$key]);
|
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['profit'] == null) $item['profit'] = 0;
|
||||||
if ($item['changes'] == null) $item['changes'] = 0;
|
if ($item['changes'] == null) $item['changes'] = 0;
|
||||||
if ($item['repeats'] == null) {
|
if ($item['repeats'] == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user