Data.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\store\service\statistics;
  13. use app\common\service\BaseService;
  14. use app\store\service\statistics\data\Survey;
  15. use app\store\service\statistics\data\Trade7days;
  16. use app\store\service\statistics\data\GoodsRanking;
  17. use app\store\service\statistics\data\UserExpendRanking;
  18. /**
  19. * 数据概况服务类
  20. * Class Data
  21. * @package app\store\service\statistics
  22. */
  23. class Data extends BaseService
  24. {
  25. /**
  26. * 获取数据概况
  27. * @param null $startDate
  28. * @param null $endDate
  29. * @return array
  30. */
  31. public function getSurveyData($startDate = null, $endDate = null)
  32. {
  33. return (new Survey)->getSurveyData($startDate, $endDate);
  34. }
  35. /**
  36. * 近7日走势
  37. * @return array
  38. */
  39. public function getTransactionTrend()
  40. {
  41. return (new Trade7days)->getTransactionTrend();
  42. }
  43. /**
  44. * 商品销售榜
  45. * @return mixed
  46. */
  47. public function getGoodsRanking()
  48. {
  49. return (new GoodsRanking)->getGoodsRanking();
  50. }
  51. /**
  52. * 用户消费榜
  53. * @return \think\Collection
  54. * @throws \think\db\exception\DataNotFoundException
  55. * @throws \think\db\exception\DbException
  56. * @throws \think\db\exception\ModelNotFoundException
  57. */
  58. public function geUserExpendRanking()
  59. {
  60. return (new UserExpendRanking)->getUserExpendRanking();
  61. }
  62. }