feat(IndexController): 根据store_id调整统计逻辑

This commit is contained in:
mkm 2024-06-22 15:07:41 +08:00
parent fd0b942c85
commit b21c74f103

@ -11,9 +11,12 @@ use DateTime;
class IndexController extends BaseLikeController class IndexController extends BaseLikeController
{ {
public $store_id=3;
public function index() public function index()
{ {
$res = OrderLogic::dayPayPrice(5); $store_id = $this->store_id;
$res = OrderLogic::dayPayPrice($store_id);
if (OrderLogic::hasError()) { if (OrderLogic::hasError()) {
return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息
} }
@ -32,7 +35,8 @@ class IndexController extends BaseLikeController
$date = date('Y-m-d', $timestamp); $date = date('Y-m-d', $timestamp);
$dates[]=$date; $dates[]=$date;
} }
$res = UserLogic::userCount(5,$dates); $store_id = $this->store_id;
$res = UserLogic::userCount($store_id,$dates);
if (UserLogic::hasError()) { if (UserLogic::hasError()) {
return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息
} }
@ -44,7 +48,8 @@ class IndexController extends BaseLikeController
*/ */
public function product_count() public function product_count()
{ {
$res = ProductLogic::Count(5); $store_id = $this->store_id;
$res = ProductLogic::Count($store_id);
if (ProductLogic::hasError()) { if (ProductLogic::hasError()) {
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
} }
@ -55,7 +60,8 @@ class IndexController extends BaseLikeController
*/ */
public function order_user_num_count() public function order_user_num_count()
{ {
$res = OrderLogic::Count(5); $store_id = $this->store_id;
$res = OrderLogic::Count($store_id);
if (ProductLogic::hasError()) { if (ProductLogic::hasError()) {
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
} }
@ -66,7 +72,8 @@ class IndexController extends BaseLikeController
*/ */
public function sales_ranking() public function sales_ranking()
{ {
$res = ProductLogic::sales(5); $store_id = $this->store_id;
$res = ProductLogic::sales($store_id);
if (ProductLogic::hasError()) { if (ProductLogic::hasError()) {
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
} }
@ -87,7 +94,8 @@ class IndexController extends BaseLikeController
$date->modify('+' . $i . ' days'); $date->modify('+' . $i . ' days');
$dates[] = $date->format('Y-m-d'); $dates[] = $date->format('Y-m-d');
} }
$res = UserLogic::TradeCount(5, $dates); $store_id = $this->store_id;
$res = UserLogic::TradeCount($store_id, $dates);
if (UserLogic::hasError()) { if (UserLogic::hasError()) {
return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息
} }
@ -98,7 +106,8 @@ class IndexController extends BaseLikeController
*/ */
public function street_currday_order_count() public function street_currday_order_count()
{ {
$res = OrderLogic::Currday(5); $store_id = $this->store_id;
$res = OrderLogic::Currday($store_id);
if (ProductLogic::hasError()) { if (ProductLogic::hasError()) {
return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息
} }