瀏覽代碼

首页数据

shish 5 年之前
父節點
當前提交
00c03db216
共有 2 個文件被更改,包括 13 次插入6 次删除
  1. 7 5
      app-ghs/controllers/ConsoleController.php
  2. 6 1
      sql.sql

+ 7 - 5
app-ghs/controllers/ConsoleController.php

@@ -5,6 +5,7 @@ namespace ghs\controllers;
 use biz\shop\services\ShopService;
 use biz\sj\services\MerchantAssetService;
 use biz\stat\services\StatOutService;
+use bizHd\stat\classes\StatViewClass;
 use bizHd\stat\services\StatIncomeMonthService;
 use bizHd\stat\services\StatIncomeService;
 use bizHd\stat\services\StatOrderService;
@@ -30,17 +31,19 @@ class ConsoleController extends BaseController
         ];
         //今天客户与粉丝数
         $userData = StatUserService::getTodayNum($this->shopId);
-        $todayUserNum = isset($userData['riseUserNum']) ? $userData['riseUserNum'] : 0;
+        $customNum = isset($userData['riseUserNum']) ? $userData['riseUserNum'] : 0;
         //今天收入
         $incomeData = StatIncomeService::getTodayNum($this->shopId);
-        $todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0;
+        $todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0.00;
         //2021.4.14 linqh 今日支出
         $outData = StatOutService::getTodayNum($this->shopId);
-        $todayOut = $outData['amount'] ?? 0;
+        $todayOut = $outData['amount'] ?? '0.00';
         //今天开单数
         $statOrder = \bizHd\stat\classes\StatOrderClass::getByCondition(['shopId' => $this->shopId, 'time' => date('Ymd')]);
         $orderNum = $statOrder['riseNum'] ?? 0;
-        $todayData = ['income' => $todayIncome, 'order' => $orderNum, 'custom' => $todayUserNum, 'expend' => $todayOut];
+        $view = StatViewClass::getByCondition(['shopId' => $this->shopId, 'time' => date('Ymd')]);
+        $viewNum = $view['riseNum'] ?? 0;
+        $todayData = ['income' => $todayIncome, 'order' => $orderNum, 'custom' => $customNum, 'expend' => $todayOut, 'view' => $viewNum];
 
         $incomeStat = [];
         if (httpUtil::isMiniProgram() == false) {
@@ -57,7 +60,6 @@ class ConsoleController extends BaseController
                 'list' => $latestIncome,
             ];
         }
-
         util::success([
             'asset' => $asset,
             'notice' => $notice,

+ 6 - 1
sql.sql

@@ -2154,4 +2154,9 @@ ALTER TABLE `xhPtAdmin` CHANGE `adminName` `name` VARCHAR(50) NOT NULL DEFAULT '
 ALTER TABLE xhApply DROP COLUMN `nickName`;
 ALTER TABLE `xhUser` CHANGE `nickName` `name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '名称';
 ALTER TABLE `xhUser` DROP COLUMN `userName`;
-ALTER TABLE `xhUser` DROP COLUMN `realName`;
+ALTER TABLE `xhUser` DROP COLUMN `realName`;
+ALTER TABLE `xhStatView` ADD shopId INT NOT NULL DEFAULT 0 COMMENT '' AFTER `merchantId`;
+ALTER TABLE `xhStatViewMonth` ADD shopId INT NOT NULL DEFAULT 0 COMMENT '' AFTER `merchantId`;
+ALTER TABLE `xhStatVisit` ADD shopId INT NOT NULL DEFAULT 0 COMMENT '' AFTER `merchantId`;
+ALTER TABLE `xhStatVisitMonth` ADD shopId INT NOT NULL DEFAULT 0 COMMENT '' AFTER `merchantId`;
+ALTER TABLE xhShop ADD totalItem INT NOT NULL DEFAULT 0 COMMENT '总花材数' AFTER `totalExpend`;