|
|
@@ -2,17 +2,22 @@
|
|
|
|
|
|
namespace hd\controllers;
|
|
|
|
|
|
+use bizHd\purchase\classes\PurchaseClass;
|
|
|
use GatewayClient\Gateway;
|
|
|
use bizHd\ad\services\AdService;
|
|
|
use bizHd\goods\services\CategoryService;
|
|
|
use bizHd\goods\services\GoodsCategoryService;
|
|
|
use common\components\util;
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
+use bizGhs\product\classes\ProductClass;
|
|
|
+use bizHd\stat\classes\StatIncomeClass;
|
|
|
+use bizHd\stat\classes\StatOrderClass;
|
|
|
|
|
|
class MainController extends BaseController
|
|
|
{
|
|
|
|
|
|
public $guestAccess = ['index'];
|
|
|
-
|
|
|
+
|
|
|
public function actionDemo()
|
|
|
{
|
|
|
return $this->renderPartial('demo');
|
|
|
@@ -107,55 +112,144 @@ class MainController extends BaseController
|
|
|
//经营概况 ssh 2021.1.27
|
|
|
public function actionProfile()
|
|
|
{
|
|
|
+
|
|
|
+ //余额
|
|
|
+ $shopInfo = ShopClass::getById($this->shopId);
|
|
|
+ //库存情况
|
|
|
+ $stockInfo = ProductClass::getProductStockByShopId($this->sjId,$this->shopId);
|
|
|
+ //今日销售金额
|
|
|
+ $today = StatIncomeClass::getAmountToday($this->shopId);
|
|
|
+ //近七天销售金额
|
|
|
+ $latestSeven = StatIncomeClass::getAmountWeek($this->shopId);
|
|
|
+ //30天销售金额
|
|
|
+ $latestThirty = StatIncomeClass::getAmountThirty($this->shopId);
|
|
|
+
|
|
|
$base = [
|
|
|
- 'balance' => 5020.00,
|
|
|
- 'mayGathering' => 10,
|
|
|
- 'mayPay' => 20,
|
|
|
- 'stockCost' => 2000,
|
|
|
- 'stockNum' => 100,
|
|
|
- 'stockWarning' => 5,
|
|
|
- 'today' => 90,
|
|
|
- 'todayCompareYesterday' => -5,
|
|
|
- 'latestSeven' => 9000,
|
|
|
- 'latestSevenSameTerm' => 10,
|
|
|
- 'latestThirty' => 8000,
|
|
|
- 'latestThirtySameTerm' => -9,
|
|
|
+ 'balance' => $shopInfo['balance'],
|
|
|
+ 'mayGathering' =>$shopInfo['mayGathering'],
|
|
|
+ 'mayPay' => 0,
|
|
|
+ 'stockCost' => $stockInfo['stockCost'],
|
|
|
+ 'stockNum' => 0,
|
|
|
+ 'stockBigNum' => $stockInfo['stockBigNum'],
|
|
|
+ 'stockSmallNum' => $stockInfo['stockSmallNum'],
|
|
|
+ 'stockWarning' => $stockInfo['stockWarning'],
|
|
|
+ 'today' => $today,
|
|
|
+ 'todayCompareYesterday' => 0,
|
|
|
+ 'latestSeven' => $latestSeven,
|
|
|
+ 'latestSevenSameTerm' => 0,
|
|
|
+ 'latestThirty' => $latestThirty,
|
|
|
+ 'latestThirtySameTerm' => 0,
|
|
|
];
|
|
|
+
|
|
|
+
|
|
|
+ //今日订单数
|
|
|
+ $saleNum = StatOrderClass::getRiseNumToday($this->shopId);
|
|
|
+ //今日销售金额
|
|
|
+ $saleAmount =$today;
|
|
|
+
|
|
|
+ //昨日订单数
|
|
|
+ $ySaleNum = StatOrderClass::getRiseNumYesterday($this->shopId);
|
|
|
+ //昨日销售金额
|
|
|
+ $ySaleAmount = StatIncomeClass::getAmountYesterday($this->shopId);
|
|
|
+
|
|
|
+ //7天订单数
|
|
|
+ $sevenSaleNum = StatOrderClass::getRiseNumWeek($this->shopId);
|
|
|
+
|
|
|
+ //7天销售金额
|
|
|
+ $sevenSaleAmount = $latestSeven;
|
|
|
+ //30天订单数
|
|
|
+ $thirtySaleNum = StatOrderClass::getRiseNumThirty($this->shopId);
|
|
|
+ //30天销售金额
|
|
|
+ $thirtySaleAmount = $latestThirty;
|
|
|
+
|
|
|
+
|
|
|
+ //采购相关信息
|
|
|
+ //今日采购数
|
|
|
+ //今日采购金额
|
|
|
+ $todayPurchaseStat = PurchaseClass::statOrderInfo($this->shopId,"today");
|
|
|
+
|
|
|
+ //昨日采购数
|
|
|
+ //昨日采购金额
|
|
|
+ $yesterdayPurchaseStat = PurchaseClass::statOrderInfo($this->shopId,"yesterday");
|
|
|
+
|
|
|
+ //7日采购数
|
|
|
+ //7日采购金额
|
|
|
+ $sevendayPurchaseStat = PurchaseClass::statOrderInfo($this->shopId,"seven");
|
|
|
+
|
|
|
+ //30日采购数
|
|
|
+ //30日采购金额
|
|
|
+ $thirtydayPurchaseStat = PurchaseClass::statOrderInfo($this->shopId,"thirty");
|
|
|
+//
|
|
|
+// $more = [
|
|
|
+// 'today' => [
|
|
|
+// 'income' => 10,
|
|
|
+// 'expend' => 2,
|
|
|
+// 'saleNum' => 1,
|
|
|
+// 'saleAmount' => 100,
|
|
|
+// 'purchaseNum' => 2,
|
|
|
+// 'purchaseAmount' => 3,
|
|
|
+// ],
|
|
|
+// 'yesterday' => [
|
|
|
+// 'income' => 10,
|
|
|
+// 'expend' => 2,
|
|
|
+// 'saleNum' => 1,
|
|
|
+// 'saleAmount' => 100,
|
|
|
+// 'purchaseNum' => 2,
|
|
|
+// 'purchaseAmount' => 3,
|
|
|
+// ],
|
|
|
+// 'latestSeven' => [
|
|
|
+// 'income' => 10,
|
|
|
+// 'expend' => 2,
|
|
|
+// 'saleNum' => 1,
|
|
|
+// 'saleAmount' => 100,
|
|
|
+// 'purchaseNum' => 2,
|
|
|
+// 'purchaseAmount' => 3,
|
|
|
+// ],
|
|
|
+// 'latestThirty' => [
|
|
|
+// 'income' => 10,
|
|
|
+// 'expend' => 2,
|
|
|
+// 'saleNum' => 1,
|
|
|
+// 'saleAmount' => 100,
|
|
|
+// 'purchaseNum' => 2,
|
|
|
+// 'purchaseAmount' => 3,
|
|
|
+// ],
|
|
|
+// ];
|
|
|
+
|
|
|
$more = [
|
|
|
'today' => [
|
|
|
- 'income' => 10,
|
|
|
- 'expend' => 2,
|
|
|
- 'saleNum' => 1,
|
|
|
- 'saleAmount' => 100,
|
|
|
- 'purchaseNum' => 2,
|
|
|
- 'purchaseAmount' => 3,
|
|
|
+ 'income' => 0,
|
|
|
+ 'expend' => 0,
|
|
|
+ 'saleNum' => $saleNum,
|
|
|
+ 'saleAmount' => $saleAmount,
|
|
|
+ 'purchaseNum' => $todayPurchaseStat['totalNum'],
|
|
|
+ 'purchaseAmount' => $todayPurchaseStat['totalAmount'],
|
|
|
],
|
|
|
'yesterday' => [
|
|
|
- 'income' => 10,
|
|
|
- 'expend' => 2,
|
|
|
- 'saleNum' => 1,
|
|
|
- 'saleAmount' => 100,
|
|
|
- 'purchaseNum' => 2,
|
|
|
- 'purchaseAmount' => 3,
|
|
|
+ 'income' => 0,
|
|
|
+ 'expend' => 0,
|
|
|
+ 'saleNum' => $ySaleNum,
|
|
|
+ 'saleAmount' => $ySaleAmount,
|
|
|
+ 'purchaseNum' => $yesterdayPurchaseStat['totalNum'],
|
|
|
+ 'purchaseAmount' => $yesterdayPurchaseStat['totalAmount'],
|
|
|
],
|
|
|
'latestSeven' => [
|
|
|
- 'income' => 10,
|
|
|
- 'expend' => 2,
|
|
|
- 'saleNum' => 1,
|
|
|
- 'saleAmount' => 100,
|
|
|
- 'purchaseNum' => 2,
|
|
|
- 'purchaseAmount' => 3,
|
|
|
+ 'income' => 0,
|
|
|
+ 'expend' => 0,
|
|
|
+ 'saleNum' => $sevenSaleNum,
|
|
|
+ 'saleAmount' => $sevenSaleAmount,
|
|
|
+ 'purchaseNum' => $sevendayPurchaseStat['totalNum'],
|
|
|
+ 'purchaseAmount' => $sevendayPurchaseStat['totalAmount'],
|
|
|
],
|
|
|
'latestThirty' => [
|
|
|
- 'income' => 10,
|
|
|
- 'expend' => 2,
|
|
|
- 'saleNum' => 1,
|
|
|
- 'saleAmount' => 100,
|
|
|
- 'purchaseNum' => 2,
|
|
|
- 'purchaseAmount' => 3,
|
|
|
+ 'income' => 0,
|
|
|
+ 'expend' => 0,
|
|
|
+ 'saleNum' => $thirtySaleNum,
|
|
|
+ 'saleAmount' => $thirtySaleAmount,
|
|
|
+ 'purchaseNum' => $thirtydayPurchaseStat['totalNum'],
|
|
|
+ 'purchaseAmount' => $thirtydayPurchaseStat['totalAmount'],
|
|
|
],
|
|
|
];
|
|
|
util::success(['base' => $base, 'more' => $more]);
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|