ConsoleController.php 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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['ghsMiniOpenId'] ?? '';
  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_caigou.png", "url" => "/pagesPurchase/order"],
  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. ["name" => "员工", "img" => "ghs/home/yggl.png", "url" => "/admin/staff/list"],
  51. ["name" => "销售结账单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/clear/customList"],
  52. ["name" => "采购结账单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/clear/list"],
  53. ];
  54. $agent = $this->shop->agentLevel ?? 0;
  55. if ($agent == 1) {
  56. //代理商显示邀请开店按钮
  57. $menu = [
  58. ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
  59. ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list"],
  60. ["name" => "采购单", "img" => "ghs/home/icon_caigou.png", "url" => "/pagesPurchase/order"],
  61. ["name" => "报损单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/breakage/list"],
  62. ["name" => "预订单", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/statBook"],
  63. ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list"],
  64. ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
  65. ["name" => "邀请开店", "img" => "ghs/home/yqyl.png", "url" => "/pagesInvite/list"]
  66. ];
  67. }
  68. util::success(['asset' => $this->main, 'notice' => $notice, 'todayData' => $todayData, 'incomeStat' => $incomeStat, 'menu' => $menu,]);
  69. }
  70. //常用初始化
  71. public function actionInit()
  72. {
  73. $dict = dict::get();
  74. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  75. util::success(['dict' => $dict, 'shop' => $shop]);
  76. }
  77. }