UserExpendRanking.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 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\data;
  13. use app\store\model\User as UserModel;
  14. use app\common\service\BaseService;
  15. /**
  16. * 数据统计-用户消费榜
  17. * Class UserExpendRanking
  18. * @package app\store\service\statistics\data
  19. */
  20. class UserExpendRanking extends BaseService
  21. {
  22. /**
  23. * 用户消费榜
  24. * @return \think\Collection
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function getUserExpendRanking(): \think\Collection
  30. {
  31. return (new UserModel)->field(['user_id', 'nick_name', 'expend_money'])
  32. ->where('is_delete', '=', 0)
  33. ->order(['expend_money' => 'DESC'])
  34. ->limit(10)
  35. ->select();
  36. }
  37. }