ConsoleController.php 3.0 KB

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