ConsoleController.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace ghs\controllers;
  3. use bizTy\sj\services\MerchantAssetService;
  4. use biz\stat\services\StatIncomeMonthService;
  5. use biz\stat\services\StatIncomeService;
  6. use biz\stat\services\StatOrderService;
  7. use biz\stat\services\StatUserService;
  8. use biz\stat\services\StatVisitService;
  9. use Yii;
  10. use common\components\util;
  11. class ConsoleController extends BaseController
  12. {
  13. //概况 shish 2019.12.19
  14. public function actionProfile()
  15. {
  16. $asset = MerchantAssetService::getByMerchantId($this->sjId);
  17. $notice = [
  18. //['title' => '您还有10天试用期结束 ', 'action' => '立即续费', 'clickHint' => '请在手机上进行续费', 'url' => 'http://www.test.com'],
  19. ];
  20. //今天访客数
  21. $todayVisit = StatVisitService::getTodayVisitNum($this->sjId);
  22. //今天客户与粉丝数
  23. $userData = StatUserService::getTodayNum($this->sjId);
  24. $todayFansNum = isset($userData['riseFansNum']) ? $userData['riseFansNum'] : 0;
  25. $todayUserNum = isset($userData['riseUserNum']) ? $userData['riseUserNum'] : 0;
  26. //今天订单数
  27. $orderData = StatOrderService::getTodayNum($this->sjId);
  28. $todayOrder = isset($orderData['riseNum']) ? $orderData['riseNum'] : 0;
  29. //今天收入
  30. $incomeData = StatIncomeService::getTodayNum($this->sjId);
  31. $todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0;
  32. $todayData = ['visit' => $todayVisit, 'fans' => $todayFansNum, 'user' => $todayUserNum, 'income' => $todayIncome, 'order' => $todayOrder, 'expend' => 399];
  33. $mainMenu = [
  34. ['name' => '开单', 'img' => 'https://img.huaml.com/retail/admin/tab-icon-6.png', 'page' => '/pageA/merchant/getList'],
  35. ['name' => '采购', 'img' => 'https://img.huaml.com/retail/admin/tab-icon-6.png', 'page' => '/pageA/merchant/getList'],
  36. ];
  37. $menu = [
  38. ['name' => '库存预警', 'img' => 'https://img.huaml.com/retail/admin/tab-icon-6.png', 'page' => '/pageA/merchant/getList'],
  39. ['name' => '改价', 'img' => 'https://img.huaml.com/retail/admin/tab-icon-6.png', 'page' => '/pageA/merchant/getList'],
  40. ['name' => '全部', 'img' => 'https://img.huaml.com/retail/admin/tab-icon-6.png', 'page' => '/pageA/merchant/getList'],
  41. ];
  42. util::success([
  43. 'asset' => $asset,
  44. 'notice' => $notice,
  45. 'todayData' => $todayData,
  46. 'mainMenu' => $mainMenu,
  47. 'menu' => $menu,
  48. ]);
  49. }
  50. //常用初始化
  51. public function actionInit()
  52. {
  53. $constant = [
  54. //默认的日期搜索选项
  55. 'defaultDateSearchOption' => [
  56. ['name' => '昨天', 'value' => 1, 'type' => 'fixed'],
  57. ['name' => '今天', 'value' => 2, 'type' => 'fixed'],
  58. ['name' => '本月', 'value' => 3, 'type' => 'fixed'],
  59. ['name' => '上月', 'value' => 4, 'type' => 'fixed'],
  60. ['name' => '今年', 'value' => 5, 'type' => 'fixed'],
  61. ['name' => '自定义', 'value' => 6, 'type' => 'custom'],
  62. ],
  63. ];
  64. util::success(['constant' => $constant]);
  65. }
  66. }