model = new UserModel(); } 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 static function modifyUserPidAndPath($uid, $pid, $newPathPrefix) { return Db::table(self::$table) ->where(['id' => $uid]) ->update([ 'pid' => $pid, 'path' => $newPathPrefix, 'update_time' => date('Y-m-d H:i:s') ]); } public static function modifyUserPath($id, $newPath) { return Db::table(self::$table) ->where(['id' => $id]) ->update([ 'path' => $newPath, 'update_time' => date('Y-m-d H:i:s') ]); } public static function UpdateUserMoney($id, $money) { return Db::table(self::$table) ->where(['id' => $id]) ->update([ 'money' => $money, 'update_time' => date('Y-m-d H:i:s') ]); } public static function UpdateUserScore($id, $score) { return Db::table(self::$table) ->where(['id' => $id]) ->update([ 'score' => $score, 'update_time' => date('Y-m-d H:i:s') ]); } public static function updateState($id, int $status) { return Db::table(self::$table) ->where(['id' => $id]) ->update([ 'status' => $status, '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(); } }