UserExpendRanking.php 863 B

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