UserExpendRanking.php 980 B

123456789101112131415161718192021222324252627282930313233343536373839
  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\data;
  10. use app\store\model\User as UserModel;
  11. use app\common\service\Basics as BasicsService;
  12. /**
  13. * 数据统计-用户消费榜
  14. * Class UserExpendRanking
  15. * @package app\store\service\statistics\data
  16. */
  17. class UserExpendRanking extends BasicsService
  18. {
  19. /**
  20. * 用户消费榜
  21. * @return false|\PDOStatement|string|\think\Collection
  22. * @throws \think\db\exception\DataNotFoundException
  23. * @throws \think\db\exception\ModelNotFoundException
  24. * @throws \think\exception\DbException
  25. */
  26. public function getUserExpendRanking()
  27. {
  28. return (new UserModel)->field(['user_id', 'nickName', 'expend_money'])
  29. ->where('is_delete', '=', 0)
  30. ->order(['expend_money' => 'DESC'])
  31. ->limit(10)
  32. ->select();
  33. }
  34. }