diff --git a/app/admin/controller/nk/User.php b/app/admin/controller/nk/User.php index 16abf18..1f416cf 100644 --- a/app/admin/controller/nk/User.php +++ b/app/admin/controller/nk/User.php @@ -6,6 +6,7 @@ use app\admin\BaseController; use think\facade\View; use think\facade\Db; +use app\admin\model\ShopUser; use app\admin\model\InformationUserMsg; /** @@ -81,6 +82,7 @@ class User extends BaseController $mmm['brigade_id'] = $post['brigade_id']; } } + //权限组信息 $total = InformationUserMsg::alias('m') ->where($mmm) @@ -91,13 +93,14 @@ class User extends BaseController ->where($mmm) ->where($map) // ->join(['shop.eb_user' => 'u'], 'm.user_id=u.uid')u.avatar,u.group_id,u.status, - ->field('m.user_id id,m.name,m.phone,m.gender,m.age,m.householder_id,m.user_id') - ->withAttr('shop_info', function ($value, $data) { - $find=Db::connect('shop')->name('user')->where('uid',$data['user_id'])->field('uid,avatar,status,group_id')->find(); - if (!$find) return false; - $find['group_name']=Db::connect('shop')->name('user_group')->where('group_id',$find['group_id'])->value('group_name'); - return $find; - }) + ->with(['user.userGroup']) + // ->field('m.user_id id,m.name,m.phone,m.gender,m.age,m.householder_id,m.user_id') + // ->withAttr('shop_info', function ($value, $data) { + // $find=Db::connect('shop')->name('user')->where('uid',$data['user_id'])->field('uid,avatar,status,group_id')->find(); + // if (!$find) return false; + // $find['group_name']=Db::connect('shop')->name('user_group')->where('group_id',$find['group_id'])->value('group_name'); + // return $find; + // }) ->withAttr('count', function ($value, $data) { if ($data['householder_id'] != 0) { $count = Db::table('fa_szxc_information_usermsg')->where('householder_id', $data['householder_id'])->count(); diff --git a/app/admin/view/nk/user/index.html b/app/admin/view/nk/user/index.html index 68a3dd1..f504568 100644 --- a/app/admin/view/nk/user/index.html +++ b/app/admin/view/nk/user/index.html @@ -151,7 +151,7 @@ },{ field: 'group_name', title: '角色组', - templet: '
{{ d.shop_info.group_name }}
', + templet: '
{{ d.user.userGroup.group_name }}
', },{ field: 'name', @@ -165,7 +165,7 @@ field: 'user', title: '头像', align: 'center', - templet: '
', + templet: '
', },{ field: 'gender', title: '性别', @@ -178,7 +178,7 @@ fixed: 'right', field: 'right', title: '操作', - toolbar: '#barDemo', + toolbar: '#barDemo', align: 'center' } ]