ConsoleController.php 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\stat\classes\StatSaleClass;
  4. use biz\stat\services\StatOutService;
  5. use bizHd\stat\classes\StatViewClass;
  6. use bizHd\stat\classes\StatVisitClass;
  7. use bizHd\stat\services\StatIncomeMonthService;
  8. use bizHd\stat\services\StatIncomeService;
  9. use bizHd\stat\services\StatUserService;
  10. use common\components\dict;
  11. use common\components\httpUtil;
  12. use common\components\util;
  13. use Yii;
  14. class ConsoleController extends BaseController
  15. {
  16. public $guestAccess = ['init', 'profile'];
  17. //概况 ssh 2019.12.19
  18. public function actionProfile()
  19. {
  20. $get = Yii::$app->request->get();
  21. $isMini = $get['isMini'] ?? 0;
  22. $notice = [];
  23. $admin = $this->admin;
  24. if ($isMini == 1 && !empty($admin)) {
  25. $miniOpenId = $admin['miniOpenId'] ?? '';
  26. if (empty($miniOpenId)) {
  27. $notice = [['title' => '绑定微信,下次自动登录后台', 'action' => '去绑定', 'page' => '/admin/staff/miniAutoLogin']];
  28. }
  29. }
  30. //今天销售
  31. $sale = StatSaleClass::getByCondition(['mainId' => $this->mainId, 'time' => date('Ymd')]);
  32. $todaySale = $sale['amount'] ?? 0;
  33. $orderNum = $sale['num'] ?? 0;
  34. //2021.4.14 lqh 今日支出
  35. $outData = StatOutService::getTodayNum($this->mainId);
  36. $todayOut = $outData['amount'] ?? '0.00';
  37. //访客数
  38. $visitCustom = StatVisitClass::getVisitNum($this->mainId);
  39. $todayData = ['income' => $todaySale, 'order' => $orderNum, 'expend' => $todayOut, 'visitCustom' => $visitCustom];
  40. $incomeStat = [];
  41. $menu = [
  42. ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
  43. ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list"],
  44. ["name" => "供应商", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
  45. ["name" => "报损单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/breakage/list"],
  46. ["name" => "预订单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/statBook"],
  47. ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list"],
  48. ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
  49. ["name" => "调拨入库", "img" => "ghs/home/dbrk.png", "url" => "/pagesStorehouse/allot/allotPut"]
  50. ];
  51. $agent = $this->shop->agentLevel ?? 0;
  52. if ($agent == 1) {
  53. //代理商显示邀请开店按钮
  54. $menu = [
  55. ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
  56. ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list"],
  57. ["name" => "供应商", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],
  58. ["name" => "报损单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/breakage/list"],
  59. ["name" => "预订单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/statBook"],
  60. ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list"],
  61. ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
  62. ["name" => "邀请开店", "img" => "ghs/home/yqyl.png", "url" => "/pagesInvite/list"]
  63. ];
  64. }
  65. util::success(['asset' => $this->main, 'notice' => $notice, 'todayData' => $todayData, 'incomeStat' => $incomeStat, 'menu' => $menu,]);
  66. }
  67. //常用初始化
  68. public function actionInit()
  69. {
  70. $dict = dict::get();
  71. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  72. util::success(['dict' => $dict, 'shop' => $shop]);
  73. }
  74. }