| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- <?php
 
- namespace app\service;
 
- use app\model\User;
 
- use think\db\exception\DataNotFoundException;
 
- use think\db\exception\DbException;
 
- use think\db\exception\ModelNotFoundException;
 
- use think\Model;
 
- class UserService
 
- {
 
-     public static function selectLoginInfo($loginInfo){
 
-         $map[] = ["username","=",$loginInfo["username"]];
 
-         $map[] = ["password","=",$loginInfo["password"]];
 
-         return (new User)->where($map)->field("id,username,xzqdm,level,name")->find();
 
-     }
 
-     /**
 
-      * @throws ModelNotFoundException
 
-      * @throws DataNotFoundException
 
-      * @throws DbException
 
-      */
 
-     public static function getUserInfoById($id){
 
-         return (new \app\model\User)->field("username,xzqdm,level,name")->find($id);
 
-     }
 
-     public static function getGridPersonInfoById($id){
 
-         return User::field("name,xzqdm,level,work_organization, phone, work_position, person_group, person_duty, person_image,id")->find($id);
 
-     }
 
-     public static function editPasswordById($id,$password): User
 
-     {
 
-         return User::update(["password"=>$password],["id"=>$id]);
 
-     }
 
-     public static function editUserInfoById($id,$userInfo): User
 
-     {
 
-         return User::update($userInfo,["id"=>$id]);
 
-     }
 
-     public static function saveUserInfo($userInfo): User{
 
-         return User::create($userInfo);
 
-     }
 
-     public static function deleteUserInfoById($id): bool{return User::destroy($id);}
 
-     /**
 
-      * @throws ModelNotFoundException
 
-      * @throws DbException
 
-      * @throws DataNotFoundException
 
-      */
 
-     public static function getUserInfoList($page, $xzqdm){
 
-         switch (strlen($xzqdm) ){
 
-             case 4:
 
-                 $map[]=["xzqdm","like",'%'.$xzqdm.'%'];
 
-                 break;
 
-             case 6:
 
-                 $map[] = ["xzqdm","like",'%'.$xzqdm.'%'];
 
-                 break;
 
-             case 9:
 
-                 $map[] = ["xzqdm","like",'%'.$xzqdm.'%'];
 
-                 break;
 
-             default:
 
-                 $map[]=["xzqdm","<>",'null'];
 
-         }
 
-         $map[]=["work_position","=","网格员"];
 
-         return (new User)->where($map)->page($page["page"],$page["size"])->select();
 
-     }
 
- }
 
 
  |