档案接口
This commit is contained in:
parent
7c264c1170
commit
38f124cfce
@ -61,8 +61,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
|||||||
$where[]=['company_id','=',$company_id];
|
$where[]=['company_id','=',$company_id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,create_time";
|
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||||
$lists = User::withSearch($this->setSearch(), $this->params)
|
$lists = User::withSearch($this->setSearch(), $this->params)
|
||||||
|
->with(['company'])
|
||||||
->where($where)
|
->where($where)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->field($field)
|
->field($field)
|
||||||
|
@ -37,17 +37,18 @@ class UserLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail(int $userId): array
|
public static function detail(int $userId): array
|
||||||
{
|
{
|
||||||
$field = [
|
// $field = [
|
||||||
'id', 'sn', 'account', 'nickname', 'avatar', 'real_name',
|
// 'id', 'sn', 'account', 'nickname', 'avatar', 'real_name',
|
||||||
'sex', 'mobile', 'create_time', 'login_time', 'channel',
|
// 'sex', 'mobile', 'create_time', 'login_time', 'channel',
|
||||||
'user_money',
|
// 'user_money',
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$user = User::where(['id' => $userId])->field($field)
|
$user = User::where(['id' => $userId])
|
||||||
->findOrEmpty();
|
->findOrEmpty();
|
||||||
|
|
||||||
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
$user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']);
|
||||||
$user->sex = $user->getData('sex');
|
$user->sex = $user->getData('sex');
|
||||||
|
$user['qualification']=json_decode($user->qualification,true);
|
||||||
return $user->toArray();
|
return $user->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,4 +29,13 @@ class InformationController extends BaseApiController
|
|||||||
}
|
}
|
||||||
return $this->success('成功');
|
return $this->success('成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function details(){
|
||||||
|
$param = Request()->param();
|
||||||
|
$res = UserInformationg::details($param['id']);
|
||||||
|
if ($res != true) {
|
||||||
|
return $this->fail( BaseLogic::getError());
|
||||||
|
}
|
||||||
|
return $this->success('成功',$res->toArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,28 +6,16 @@ use app\common\model\BaseModel;
|
|||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Log;
|
use think\facade\Log;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\Company;
|
||||||
|
|
||||||
class UserInformationg extends BaseModel
|
class UserInformationg extends BaseModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public static function list($param,$page=1,$size=10){
|
public static function list($param,$page=1,$size=10){
|
||||||
return self::where($param)->page($page)->limit($size)->select()->each(function($item, $key){
|
return self::where($param)->with('company')
|
||||||
$item['family'] = json_decode($item['family'],true);
|
->field('id,area_id,area_id as area_name,street_id,street_id as street_name,village_id,village_id as village_name, street_id as street_name,brigade_id,brigade_id as brigade_name,name,phone,age,address,create_time,update_time')
|
||||||
$item['child_arr'] = json_decode($item['child_arr'],true);
|
->page($page)->limit($size)->select();
|
||||||
$data=UserInformationgDemand::where('create_user_id',$item['create_user_id'])->select();
|
|
||||||
$item['datas']=[];
|
|
||||||
if($data){
|
|
||||||
foreach($data as $k=>$v){
|
|
||||||
$datas=[];
|
|
||||||
$a=json_decode($v['data'],true);
|
|
||||||
if($a){
|
|
||||||
array_push($datas,$a);
|
|
||||||
}
|
|
||||||
$item['datas']=$datas;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($param)
|
public static function add($param)
|
||||||
@ -84,4 +72,49 @@ class UserInformationg extends BaseModel
|
|||||||
];
|
];
|
||||||
UserInformationgDemand::create($data);
|
UserInformationgDemand::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function details($id){
|
||||||
|
$item=self::where('id',$id)->find();
|
||||||
|
$item['family'] = json_decode($item['family'],true);
|
||||||
|
$item['child_arr'] = json_decode($item['child_arr'],true);
|
||||||
|
$data=UserInformationgDemand::where('create_user_id',$item['create_user_id'])->select();
|
||||||
|
$item['datas']=[];
|
||||||
|
if($data){
|
||||||
|
foreach($data as $k=>$v){
|
||||||
|
$datas=[];
|
||||||
|
$a=json_decode($v['data'],true);
|
||||||
|
$arr=[
|
||||||
|
'category_id'=>$v['category_id'],
|
||||||
|
'category_child'=>$v['category_child'],
|
||||||
|
'datas'=>$a
|
||||||
|
];
|
||||||
|
if($a){
|
||||||
|
array_push($datas,$arr);
|
||||||
|
}
|
||||||
|
$item['datas']=$datas;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function company()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Company::class, 'id', 'company_id')->field(['id','company_name','admin_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCityNameAttr($value)
|
||||||
|
{
|
||||||
|
return Db::name('geo_city')->where(['city_code' => $this->city])->value('city_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAreaNameAttr($value)
|
||||||
|
{
|
||||||
|
return Db::name('geo_area')->where(['area_code' => $this->area])->value('area_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStreetNameAttr($value)
|
||||||
|
{
|
||||||
|
return Db::name('geo_street')->where(['street_code' => $this->street])->value('street_name');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user