更新后台用户相关,用户权限、用户信息等
This commit is contained in:
parent
034307d311
commit
2c8a41fc4f
@ -8,6 +8,7 @@ use think\facade\Db;
|
||||
|
||||
use app\admin\model\ShopUser;
|
||||
use app\admin\model\InformationUserMsg;
|
||||
use app\admin\model\InformationUserAddress;
|
||||
|
||||
/**
|
||||
* 文章
|
||||
@ -95,15 +96,9 @@ class User extends BaseController
|
||||
// ->join(['shop.eb_user' => 'u'], 'm.user_id=u.uid')u.avatar,u.group_id,u.status,
|
||||
->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();
|
||||
if ($data['householder_id']) {
|
||||
$count = InformationUserMsg::where('householder_id', $data['householder_id'])->count();
|
||||
} else {
|
||||
$count = '未绑定户主无法查询';
|
||||
}
|
||||
@ -392,6 +387,7 @@ class User extends BaseController
|
||||
public function read()
|
||||
{
|
||||
$params = get_params();
|
||||
|
||||
$find = Db::table('fa_szxc_information_usermsg')
|
||||
->withAttr('gender', function ($value, $data) {
|
||||
if ($value == 1) {
|
||||
@ -412,6 +408,7 @@ class User extends BaseController
|
||||
return Db::table('fa_category')->where('id', $value)->value('name');
|
||||
})
|
||||
->where('user_id', $params['id'])->find();
|
||||
|
||||
//家庭信息
|
||||
//用户id
|
||||
$user_id = $params['id'];
|
||||
@ -438,7 +435,7 @@ class User extends BaseController
|
||||
->order('id desc')
|
||||
->field("id,user_id,name,age,gender,family_num,political_outlook,householder_id,is_hz,address_name,family_relation,phone")
|
||||
->withAttr('avatar', function ($value, $data) {
|
||||
return Db::connect('shop')->table('eb_user')->where('uid', $data['user_id'])->value('avatar');
|
||||
return ShopUser::where('uid', $data['user_id'])->value('avatar');
|
||||
})
|
||||
->select()->toArray();
|
||||
if ($find['householder_id'] == $find['user_id']) {
|
||||
@ -545,6 +542,7 @@ class User extends BaseController
|
||||
{
|
||||
$params = get_params();
|
||||
if (request()->isPost()) {
|
||||
|
||||
$admin = Db::name('Admin')->where('user_id', $params['id'])->find();
|
||||
$user = Db::connect('shop')->table('eb_user')->where('uid', $params['id'])->find();
|
||||
|
||||
@ -574,7 +572,7 @@ class User extends BaseController
|
||||
$phone = Db::table('fa_szxc_information_usermsg')->where('user_id', $params['id'])->value('phone');
|
||||
|
||||
// 如果为工作人员 == 服务小组采购人员
|
||||
if($params['group_id'] == 3)
|
||||
if($params['group_id'] == 5)
|
||||
{
|
||||
Db::connect('shop')->table('eb_user')->where('phone', $phone)->update(['fa_supply_team_id' => 1]); // 默认分佣比例 1 为小组服务
|
||||
|
||||
@ -642,16 +640,19 @@ class User extends BaseController
|
||||
$salt = set_salt(20);
|
||||
$data = [
|
||||
'user_id' => $params['id'],
|
||||
'username' => $user['mobile'],
|
||||
// 'username' => $user['mobile'], // --- 原来的废弃
|
||||
'username' => $phone,
|
||||
'nickname' => $user['nickname'],
|
||||
'thumb' => $user['avatar'],
|
||||
'mobile' => $user['mobile'],
|
||||
// 'mobile' => $user['mobile'], // --- 原来的废弃
|
||||
'mobile' => $phone,
|
||||
'did' => 1,
|
||||
'position_id' => 3,
|
||||
'salt' => $salt,
|
||||
'pwd' => set_password(123456, $salt),
|
||||
'email' => '',
|
||||
];
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
$w['user_id'] = $params['id'];
|
||||
@ -726,8 +727,8 @@ class User extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
$user = Db::connect('shop')->table('eb_user')->where('uid', $params['id'])->field('uid id,nickname,group_id')->find();
|
||||
|
||||
// $user = Db::connect('shop')->table('eb_user')->where('uid', )->->find();
|
||||
$user = ShopUser::field('uid id,nickname,group_id')->find($params['id']);
|
||||
// $geo_brigade = Db::table('fa_geo_brigade')->select();
|
||||
|
||||
$useraddress = [
|
||||
@ -739,7 +740,9 @@ class User extends BaseController
|
||||
'admin_group' => 0,
|
||||
'auth_range' => 1,
|
||||
];
|
||||
$address = Db::table('fa_szxc_information_useraddress')->where('user_id', $params['id'])->find();
|
||||
|
||||
$address = InformationUserAddress::where('user_id', $params['id'])->find();
|
||||
|
||||
if ($address) {
|
||||
$useraddress['area_id'] = $address['area_id'];
|
||||
$useraddress['street_id'] = $address['street_id'];
|
||||
@ -752,6 +755,7 @@ class User extends BaseController
|
||||
$useraddress['admin_group'] = $admin['group_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//权限组信息
|
||||
$groupwhere[] = ['id', '<>', 1];
|
||||
if ($this->adminInfo['group_access'] != 1) { //不是超级管理员
|
||||
@ -789,10 +793,13 @@ class User extends BaseController
|
||||
->limit(30)
|
||||
->select();
|
||||
$groupdata[] = ['id' => 0, 'title' => '无后台权限'];
|
||||
|
||||
//前端权限
|
||||
$user_group = Db::connect('shop')->table('eb_user_group')
|
||||
$user_group = Db::connect('shop')
|
||||
->table('eb_user_group')
|
||||
->limit(30)
|
||||
->select();
|
||||
|
||||
View::assign('id', $params['id']);
|
||||
View::assign('user_group', $user_group);
|
||||
View::assign('groupdata', $groupdata);
|
||||
|
@ -85,7 +85,7 @@
|
||||
<div class="layui-input-block">
|
||||
<select name="group_id" lay-verify="required">
|
||||
{volist name='user_group' id='vo'}
|
||||
<option value="{$vo.id}" {if $vo.id==$user['group_id']} selected {/if}>{$vo.name}</option>
|
||||
<option value="{$vo.group_id}" {if $vo.group_id==$user['group_id']} selected {/if}>{$vo.group_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -197,13 +197,13 @@
|
||||
table.on('tool(article)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'read') {
|
||||
tool.side('{$url[4]}?id='+obj.data.id);
|
||||
tool.side('{$url[4]}?id='+obj.data.user_id);
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
tool.side('{$url[2]}?id='+obj.data.id);
|
||||
tool.side('{$url[2]}?id='+obj.data.user_id);
|
||||
}
|
||||
else if (obj.event === 'auths') {
|
||||
tool.side('/admin/nk.user/auths?id='+obj.data.id);
|
||||
tool.side('/admin/nk.user/auths?id='+obj.data.user_id);
|
||||
}
|
||||
else if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除该记录吗?', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user