mirror of
				https://gitee.com/zoujingli/ThinkAdmin.git
				synced 2025-10-27 02:12:08 +08:00 
			
		
		
		
	修改用户权限关联
This commit is contained in:
		
							parent
							
								
									4f67b1057f
								
							
						
					
					
						commit
						b4b43ceff2
					
				| @ -33,13 +33,6 @@ use think\exception\HttpResponseException; | ||||
|  */ | ||||
| class Oplog extends Controller | ||||
| { | ||||
| 
 | ||||
|     /** | ||||
|      * 绑定数据表 | ||||
|      * @var string | ||||
|      */ | ||||
|     private $table = 'SystemOplog'; | ||||
| 
 | ||||
|     /** | ||||
|      * 系统日志管理 | ||||
|      * @auth true | ||||
|  | ||||
| @ -25,6 +25,7 @@ use think\admin\service\AdminService; | ||||
| use think\db\exception\DataNotFoundException; | ||||
| use think\db\exception\DbException; | ||||
| use think\db\exception\ModelNotFoundException; | ||||
| use think\model\Relation; | ||||
| 
 | ||||
| /** | ||||
|  * 系统用户管理 | ||||
| @ -44,7 +45,11 @@ class User extends Controller | ||||
|     public function index() | ||||
|     { | ||||
|         $this->type = input('get.type', 'index'); | ||||
|         $this->_query(SystemUser::class)->layTable(function () { | ||||
|         $this->_query(SystemUser::mk()->with([ | ||||
|             'userinfo' => function (Relation $relation) { | ||||
|                 $relation->field('code,name,content'); | ||||
|             }, | ||||
|         ]))->layTable(function () { | ||||
|             $this->title = '系统用户管理'; | ||||
|             $this->bases = SystemBase::mk()->items('身份权限'); | ||||
|         }, function (QueryHelper $query) { | ||||
| @ -60,15 +65,6 @@ class User extends Controller | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 数据列表处理 | ||||
|      * @param array $data | ||||
|      */ | ||||
|     protected function _page_filter(array &$data) | ||||
|     { | ||||
|         SystemBase::mk()->items('身份权限', $data, 'usertype', 'userinfo'); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 添加系统用户 | ||||
|      * @auth true | ||||
|  | ||||
| @ -17,6 +17,7 @@ | ||||
| namespace app\admin\model; | ||||
| 
 | ||||
| use think\admin\Model; | ||||
| use think\model\relation\HasOne; | ||||
| 
 | ||||
| /** | ||||
|  * 系统用户模型 | ||||
| @ -58,6 +59,17 @@ class SystemUser extends Model | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 关联身份权限 | ||||
|      * @return HasOne | ||||
|      */ | ||||
|     public function userinfo(): HasOne | ||||
|     { | ||||
|         return $this->hasOne(SystemBase::class, 'code', 'usertype')->where([ | ||||
|             'type' => '身份权限', 'status' => 1, 'deleted' => 0, | ||||
|         ]); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 格式化登录时间 | ||||
|      * @param string $value | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user