Data.php 1.7 KB

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