|
|
|
@ -51,7 +51,7 @@ class Home extends BaseService |
|
|
|
|
* 后台首页数据 |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
public function getData(): array |
|
|
|
|
public function getData(array $params = []): array |
|
|
|
|
{ |
|
|
|
|
// 今天的日期 |
|
|
|
|
$today = date('Y-m-d'); |
|
|
|
@ -86,9 +86,9 @@ class Home extends BaseService |
|
|
|
|
// 数据统计 |
|
|
|
|
'statistics' => [ |
|
|
|
|
// 商品总数量 |
|
|
|
|
'goodsTotal' => $this->getGoodsTotal(), |
|
|
|
|
'goodsTotal' => $this->getGoodsTotal($params['storeInfo']), |
|
|
|
|
//上架商品总数 |
|
|
|
|
'getGoodsGroundingTotal' => $this->getGoodsGroundingTotal(), |
|
|
|
|
'getGoodsGroundingTotal' => $this->getGoodsGroundingTotal($params['storeInfo']), |
|
|
|
|
// 会员总人数 |
|
|
|
|
'userTotal' => $this->getUserTotal(), |
|
|
|
|
// 付款订单总量 |
|
|
|
@ -135,17 +135,29 @@ class Home extends BaseService |
|
|
|
|
* 获取商品总量 |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
private function getGoodsTotal(): string |
|
|
|
|
private function getGoodsTotal(array $storeInfo = []): string |
|
|
|
|
{ |
|
|
|
|
return number_format($this->GoodsModel->getGoodsTotal()); |
|
|
|
|
$storeIds = [$storeInfo['store_id']]; |
|
|
|
|
if (isset($storeInfo['p_store_id']) && $storeInfo['p_store_id']) { |
|
|
|
|
$storeIds[] = $storeInfo['p_store_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$where[] = ['store_id', 'in', $storeIds]; |
|
|
|
|
return number_format($this->GoodsModel->getGoodsTotal($where)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 获取商品已上架总量 |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
private function getGoodsGroundingTotal(): string |
|
|
|
|
private function getGoodsGroundingTotal(array $storeInfo = []): string |
|
|
|
|
{ |
|
|
|
|
return number_format($this->GoodsModel->getGoodsGroundingTotal()); |
|
|
|
|
$storeIds = [$storeInfo['store_id']]; |
|
|
|
|
if (isset($storeInfo['p_store_id']) && $storeInfo['p_store_id']) { |
|
|
|
|
$storeIds[] = $storeInfo['p_store_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$where[] = ['store_id', 'in', $storeIds]; |
|
|
|
|
return number_format($this->GoodsModel->getGoodsGroundingTotal($where)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|