Data.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\store\service\statistics;
  3. use app\common\service\Basics;
  4. use app\store\service\statistics\data\Survey;
  5. use app\store\service\statistics\data\Trade7days;
  6. use app\store\service\statistics\data\GoodsRanking;
  7. use app\store\service\statistics\data\UserExpendRanking;
  8. /**
  9. * 数据概况服务类
  10. * Class Data
  11. * @package app\store\service\statistics
  12. */
  13. class Data extends Basics
  14. {
  15. /**
  16. * 获取数据概况
  17. * @param null $startDate
  18. * @param null $endDate
  19. * @return array
  20. * @throws \think\Exception
  21. */
  22. public function getSurveyData($startDate = null, $endDate = null)
  23. {
  24. return (new Survey)->getSurveyData($startDate, $endDate);
  25. }
  26. /**
  27. * 近7日走势
  28. * @return array
  29. * @throws \think\Exception
  30. */
  31. public function getTransactionTrend()
  32. {
  33. return (new Trade7days)->getTransactionTrend();
  34. }
  35. /**
  36. * 商品销售榜
  37. * @return string
  38. * @throws \think\db\exception\DataNotFoundException
  39. * @throws \think\db\exception\ModelNotFoundException
  40. * @throws \think\exception\DbException
  41. */
  42. public function getGoodsRanking()
  43. {
  44. return (new GoodsRanking)->getGoodsRanking();
  45. }
  46. /**
  47. * 用户消费榜
  48. * @return string
  49. * @throws \think\db\exception\DataNotFoundException
  50. * @throws \think\db\exception\ModelNotFoundException
  51. * @throws \think\exception\DbException
  52. */
  53. public function geUserExpendRanking()
  54. {
  55. return (new UserExpendRanking)->getUserExpendRanking();
  56. }
  57. }