Common.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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\supplier;
  12. use app\controller\admin\AuthController;
  13. use app\services\order\supplier\SupplierOrderServices;
  14. use app\services\supplier\SystemSupplierServices;
  15. /**
  16. * 公共接口基类 主要存放公共接口
  17. * Class Common
  18. * @package app\controller\admin
  19. */
  20. class Common extends AuthController
  21. {
  22. /**
  23. * 首页运营头部统计
  24. * @param SupplierOrderServices $orderServices
  25. * @return mixed
  26. */
  27. public function homeStatics(SupplierOrderServices $orderServices)
  28. {
  29. [$supplierId, $time] = $this->request->getMore([
  30. ['supplier_id', 0],
  31. ['data', '', '', 'time']
  32. ], true);
  33. $time = $orderServices->timeHandle($time, true);
  34. $data = $orderServices->homeStatics((int)$supplierId, $time);
  35. return $this->success($data);
  36. }
  37. /**
  38. * 营业趋势图表
  39. * @param SupplierOrderServices $orderServices
  40. * @return mixed
  41. */
  42. public function orderChart(SupplierOrderServices $orderServices)
  43. {
  44. [$supplierId, $time] = $this->request->getMore([
  45. ['supplier_id', 0],
  46. ['data', '', '', 'time']
  47. ], true);
  48. $time = $orderServices->timeHandle($time, true);
  49. $data = $orderServices->orderCharts((int)$supplierId, $time);
  50. return $this->success($data);
  51. }
  52. /**
  53. * 订单类型分析
  54. * @param SupplierOrderServices $orderServices
  55. * @return mixed
  56. */
  57. public function orderType(SupplierOrderServices $orderServices)
  58. {
  59. [$supplierId, $time] = $this->request->getMore([
  60. ['supplier_id', 0],
  61. ['data', '', '', 'time']
  62. ], true);
  63. $time = $orderServices->timeHandle($time, true);
  64. $data = $orderServices->getOrderType((int)$supplierId, $time);
  65. return $this->success($data);
  66. }
  67. /**
  68. * 订单来源分析
  69. * @param SupplierOrderServices $orderServices
  70. * @return mixed
  71. */
  72. public function orderChannel(SupplierOrderServices $orderServices)
  73. {
  74. [$supplierId, $time] = $this->request->getMore([
  75. ['supplier_id', 0],
  76. ['data', '', '', 'time']
  77. ], true);
  78. $time = $orderServices->timeHandle($time, true);
  79. $data = $orderServices->getOrderChannel((int)$supplierId, $time);
  80. return $this->success($data);
  81. }
  82. /**
  83. * 首页供应商统计
  84. * @param SystemSupplierServices $supplierServices
  85. * @return mixed
  86. */
  87. public function supplierChart(SystemSupplierServices $supplierServices)
  88. {
  89. [$supplierId, $time] = $this->request->getMore([
  90. ['supplier_id', 0],
  91. ['data', '', '', 'time']
  92. ], true);
  93. $time = $supplierServices->timeHandle($time);
  94. return $this->success($supplierServices->supplierChart((int)$supplierId, $time));
  95. }
  96. }