| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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 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 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();
- }
- }
|