diff --git a/app/admin/controller/nk/User.php b/app/admin/controller/nk/User.php
index 234e284..5b01dff 100644
--- a/app/admin/controller/nk/User.php
+++ b/app/admin/controller/nk/User.php
@@ -6,6 +6,8 @@ use app\admin\BaseController;
use think\facade\View;
use think\facade\Db;
+use app\admin\model\InformationUserMsg;
+
/**
* 文章
*
@@ -46,7 +48,9 @@ class User extends BaseController
}
//权限组信息
if ($this->adminInfo['group_access'] != 1) {
+
$find = Db::table('fa_szxc_information_useraddress')->where('admin_id', $this->adminInfo['id'])->find();
+
if ($find) {
if ($find['auth_range'] == 1) {
$mmm['area_id'] = $find['area_id'];
@@ -78,18 +82,18 @@ class User extends BaseController
}
}
//权限组信息
- $total = Db::table('fa_szxc_information_usermsg')
- ->alias('m')
+ $total = InformationUserMsg::alias('m')
->where($mmm)
->where($map)
->count();
- $list = Db::table('fa_szxc_information_usermsg')
- ->alias('m')
+
+ $list = InformationUserMsg::alias('m')
->where($mmm)
->where($map)
- ->join(['fa_user' => 'u'], 'm.user_id=u.id')
- ->join(['fa_user_group' => 'g'], 'g.id=u.group_id')
- ->field('u.id,m.name,m.phone,u.avatar,u.group_id,u.status,m.gender,m.age,g.name group_name,m.householder_id')
+ // ->join(['shop.eb_user' => 'u'], 'm.user_id=u.id')
+ // ->join(['shop.eb_user_group' => 'g'], 'g.id=u.group_id')
+ // ->field('u.id,m.name,m.phone,u.avatar,u.group_id,u.status,m.gender,m.age,g.name group_name,m.householder_id')
+ ->with(['user.userGroup'])
->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/model/InformationUserMsg.php b/app/admin/model/InformationUserMsg.php
index 216316e..18c01bb 100644
--- a/app/admin/model/InformationUserMsg.php
+++ b/app/admin/model/InformationUserMsg.php
@@ -19,4 +19,15 @@ class InformationUserMsg extends Model
// 设置当前模型对应的完整数据表名称
protected $table = 'fa_szxc_information_usermsg';
+ /**
+ *
+ * 关联用户表
+ *
+ */
+ public function user()
+ {
+ return $this->hasOne(ShopUser::class, 'uid', 'user_id');
+ }
+
+
}
\ No newline at end of file
diff --git a/app/admin/model/ShopUser.php b/app/admin/model/ShopUser.php
index 76f66ee..3794112 100644
--- a/app/admin/model/ShopUser.php
+++ b/app/admin/model/ShopUser.php
@@ -41,4 +41,14 @@ class ShopUser extends Model
{
return $this->hasOne(InformationUserMsg::class, 'user_id', 'uid');
}
+
+ /**
+ *
+ * 关联用户分组表
+ *
+ */
+ public function userGroup()
+ {
+ return $this->hasOne(ShopUserGroup::class, 'group_id', 'group_id');
+ }
}
\ No newline at end of file
diff --git a/app/admin/model/ShopUserGroup.php b/app/admin/model/ShopUserGroup.php
new file mode 100644
index 0000000..ff880a1
--- /dev/null
+++ b/app/admin/model/ShopUserGroup.php
@@ -0,0 +1,25 @@
+',
+ templet: function (d){
+ return `