| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace ghs\controllers;
- use biz\stat\classes\StatSaleClass;
- use biz\stat\services\StatOutService;
- use bizHd\stat\classes\StatViewClass;
- use bizHd\stat\classes\StatVisitClass;
- use bizHd\stat\services\StatIncomeMonthService;
- use bizHd\stat\services\StatIncomeService;
- use bizHd\stat\services\StatUserService;
- use common\components\dict;
- use common\components\httpUtil;
- use common\components\util;
- use Yii;
- class ConsoleController extends BaseController
- {
- public $guestAccess = ['init', 'profile'];
- //概况 ssh 2019.12.19
- public function actionProfile()
- {
- $get = Yii::$app->request->get();
- $isMini = $get['isMini'] ?? 0;
- $notice = [];
- $admin = $this->admin;
- if ($isMini == 1 && !empty($admin)) {
- $miniOpenId = $admin['miniOpenId'] ?? '';
- if (empty($miniOpenId)) {
- $notice = [['title' => '绑定微信,下次自动登录后台', 'action' => '去绑定', 'page' => '/admin/staff/miniAutoLogin']];
- }
- }
- //今天销售
- $sale = StatSaleClass::getByCondition(['mainId' => $this->mainId, 'time' => date('Ymd')]);
- $todaySale = $sale['amount'] ?? 0;
- $orderNum = $sale['num'] ?? 0;
- //2021.4.14 lqh 今日支出
- $outData = StatOutService::getTodayNum($this->mainId);
- $todayOut = $outData['amount'] ?? '0.00';
- //访客数
- $visitCustom = StatVisitClass::getVisitNum($this->mainId);
- $todayData = ['income' => $todaySale, 'order' => $orderNum, 'expend' => $todayOut, 'visitCustom' => $visitCustom];
- $incomeStat = [];
- $menu = [
- ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
- ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list"],
- ["name" => "供应商", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
- ["name" => "报损单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/breakage/list"],
- ["name" => "预订单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/statBook"],
- ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list"],
- ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
- ["name" => "调拨入库", "img" => "ghs/home/dbrk.png", "url" => "/pagesStorehouse/allot/allotPut"]
- ];
- $agent = $this->shop->agentLevel ?? 0;
- if ($agent == 1) {
- //代理商显示邀请开店按钮
- $menu = [
- ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
- ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list"],
- ["name" => "供应商", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
- ["name" => "报损单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/breakage/list"],
- ["name" => "预订单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/statBook"],
- ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list"],
- ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
- ["name" => "邀请开店", "img" => "ghs/home/yqyl.png", "url" => "/pagesInvite/list"]
- ];
- }
- util::success(['asset' => $this->main, 'notice' => $notice, 'todayData' => $todayData, 'incomeStat' => $incomeStat, 'menu' => $menu,]);
- }
- //常用初始化
- public function actionInit()
- {
- $dict = dict::get();
- $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
- util::success(['dict' => $dict, 'shop' => $shop]);
- }
- }
|