User.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\admin\model\dao;
  3. use app\common\model\UserModel;
  4. use think\facade\Db;
  5. class User extends BaseDao
  6. {
  7. protected $model;
  8. public static $table = "db_user";
  9. public function __construct()
  10. {
  11. $this->model = new UserModel();
  12. }
  13. public static function getUids(array $uids)
  14. {
  15. return Db::table(self::$table)->whereIn('pid', $uids)->column('id');
  16. }
  17. public static function countScore(array $uids)
  18. {
  19. return Db::table(self::$table)->whereIn('id', $uids)->sum('score');
  20. }
  21. public static function countMoney(array $uids)
  22. {
  23. return Db::table(self::$table)->whereIn('id', $uids)->sum('money');
  24. }
  25. public function getCount($where, $userMap)
  26. {
  27. return $this->model
  28. ->withJoin('userData', 'INNER')
  29. ->where($where)
  30. ->where($userMap)
  31. ->count();
  32. }
  33. public function getPageList($page, $limit, $where, $sort, $userMap)
  34. {
  35. return $this->model
  36. ->withJoin('userData', 'INNER')
  37. ->where($where)
  38. ->where($userMap)
  39. ->page($page, $limit)
  40. ->order($sort)
  41. ->select();
  42. }
  43. }