后台修改1

This commit is contained in:
彭桃 2023-02-14 10:22:19 +08:00
parent 79fe751dde
commit 517c078f86
2 changed files with 42 additions and 8 deletions

View File

@ -402,17 +402,51 @@ class User extends BaseController
})
->where('user_id', $params['id'])->find();
//家庭信息
if ($find == null || $find['householder_id'] == 0) {
$family['list'] = [];
//用户id
$user_id = $params['id'];
// 获取户主id
$f_where[] = ['user_ids','find in set',$user_id];
$family_arr = Db::table('fa_szxc_family')->where($f_where)->find();
if ($family_arr) {
$map[] = ['user_id','in',$family_arr['user_ids']];
} else {
if ($find['householder_id'] == $find['user_id']) {
$family['name'] = '本人';
$where['user_id'] = $user_id;
$where['status'] = 1;
$householder_id = Db::table('fa_szxc_information_usermsg')->where($where)->value('householder_id');
if ($householder_id) {
$map[] = ['householder_id','=',$householder_id];
$map[] = ['status','=',1];
} else {
$family['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $find['householder_id'])->value('name');
$family['relation'] = Db::table('fa_category')->where('id', $find['family_relation'])->value('name');
$map[] = ['user_id','=',$user_id];
$map[] = ['status','=',1];
}
$family['list'] = Db::table('fa_szxc_information_usermsg')->where('householder_id', $find['householder_id'])->where('user_id', '<>', $find['householder_id'])->field('user_id,name,age,gender,phone')->select();
}
// 获取家庭的人员信息
$family['list'] = Db::table('fa_szxc_information_usermsg')->where($map)
->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::table('fa_user')->where('id', $data['user_id'])->value('avatar');
})
->select()->toArray();
if ($find['householder_id'] == $find['user_id']) {
$family['name'] = '本人';
} else {
$family['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $find['householder_id'])->value('name');
$family['relation'] = Db::table('fa_category')->where('id', $find['family_relation'])->value('name');
}
// if ($find == null || $find['householder_id'] == 0) {
// $family['list'] = [];
// } else {
// if ($find['householder_id'] == $find['user_id']) {
// $family['name'] = '本人';
// } else {
// $family['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $find['householder_id'])->value('name');
// $family['relation'] = Db::table('fa_category')->where('id', $find['family_relation'])->value('name');
// }
// $family['list'] = Db::table('fa_szxc_information_usermsg')->where('householder_id', $find['householder_id'])->where('user_id', '<>', $find['householder_id'])->field('user_id,name,age,gender,phone')->select();
// }
//种植信息
if ($find || $find['householder_id'] == $params['id']) {
$Planting['is'] = 1;

View File

@ -96,7 +96,7 @@
</tr>
</table>
<h3 style="padding: 5px;">其他家庭成员</h3>
<h3 style="padding: 5px;">家庭成员</h3>
{volist name="family.list" id="vo"}
<table class="layui-table layui-table-form" id="test1">
<tr>