| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\admin\model\dao;
- use app\common\model\UserModel;
- use think\facade\Db;
- class User extends BaseDao
- {
- protected $model;
- public static $table = "db_user";
- public function __construct()
- {
- $this->model = new UserModel();
- }
- public static function getUids(array $uids)
- {
- return Db::table(self::$table)->whereIn('pid', $uids)->column('id');
- }
- public static function countScore(array $uids)
- {
- return Db::table(self::$table)->whereIn('id', $uids)->sum('score');
- }
- public static function countMoney(array $uids)
- {
- return Db::table(self::$table)->whereIn('id', $uids)->sum('money');
- }
- public static function getUserById($uid)
- {
- return Db::table(self::$table)->where('id', $uid)->find();
- }
- public static function getUserByMobile($mobile)
- {
- return Db::table(self::$table)->where('mobile', $mobile)->find();
- }
- public static function ModifyMobile($uid, $phone)
- {
- return Db::table(self::$table)
- ->where(['id' => $uid])
- ->update([
- 'mobile' => $phone,
- 'update_time' => date('Y-m-d H:i:s')
- ]);
- }
- public function getCount($where, $userMap)
- {
- return $this->model
- ->withJoin('userData', 'INNER')
- ->where($where)
- ->where($userMap)
- ->count();
- }
- public function getPageList($page, $limit, $where, $sort, $userMap)
- {
- return $this->model
- ->withJoin('userData', 'INNER')
- ->where($where)
- ->where($userMap)
- ->page($page, $limit)
- ->order($sort)
- ->select();
- }
- }
|