Common.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin\v1\store;
  12. use app\controller\admin\AuthController;
  13. use app\services\order\store\BranchOrderServices;
  14. use app\services\store\SystemStoreServices;
  15. /**
  16. * 平台门店公共
  17. * Class Common
  18. * @package app\controller\admin\v1\store
  19. */
  20. class Common extends AuthController
  21. {
  22. /**
  23. * 首页运营头部统计
  24. * @param BranchOrderServices $orderServices
  25. * @return mixed
  26. */
  27. public function homeStatics(BranchOrderServices $orderServices)
  28. {
  29. [$time] = $this->request->getMore([
  30. ['data', '', '', 'time']
  31. ], true);
  32. $time = $orderServices->timeHandle($time);
  33. return app('json')->success($orderServices->homeStatics(-1, $time));
  34. }
  35. /**
  36. * 首页营业趋势图表
  37. * @param BranchOrderServices $orderServices
  38. * @return mixed
  39. */
  40. public function operateChart(BranchOrderServices $orderServices)
  41. {
  42. [$time] = $this->request->getMore([
  43. ['data', '', '', 'time']
  44. ], true);
  45. $time = $orderServices->timeHandle($time, true);
  46. return app('json')->success($orderServices->operateChart(-1, $time));
  47. }
  48. /**
  49. * 首页交易统计
  50. * @param BranchOrderServices $orderServices
  51. * @return mixed
  52. * @throws \think\db\exception\DataNotFoundException
  53. * @throws \think\db\exception\DbException
  54. * @throws \think\db\exception\ModelNotFoundException
  55. */
  56. public function orderChart(BranchOrderServices $orderServices)
  57. {
  58. [$time] = $this->request->getMore([
  59. ['data', '', '', 'time']
  60. ], true);
  61. $time = $orderServices->timeHandle($time);
  62. return $this->success($orderServices->orderChart(-1, $time));
  63. }
  64. /**
  65. * 首页门店统计
  66. * @param SystemStoreServices $storeServices
  67. * @return mixed
  68. * @throws \think\db\exception\DataNotFoundException
  69. * @throws \think\db\exception\DbException
  70. * @throws \think\db\exception\ModelNotFoundException
  71. */
  72. public function storeChart(SystemStoreServices $storeServices)
  73. {
  74. [$time] = $this->request->getMore([
  75. ['data', '', '', 'time']
  76. ], true);
  77. $time = $storeServices->timeHandle($time);
  78. return $this->success($storeServices->storeChart($time));
  79. }
  80. }