This commit is contained in:
weiz 2023-10-30 09:58:42 +08:00
parent 48d92060a4
commit b00e7e6bc6
1 changed files with 30 additions and 0 deletions

View File

@ -151,6 +151,21 @@ class UserController extends BaseApiController
$arr1[$value['type_name']]['actions'] = $ar2; $arr1[$value['type_name']]['actions'] = $ar2;
$ar2 =[]; $ar2 =[];
} }
if($params['type'] == 4) {
foreach($arr1 as $k=>$v) {
$actionIds = array_column($v['actions'],'id');
$actionsInfo = $v['actions'];
$arr1[$k]['action_record'] = Db::name('farmer_pond_record')->where('action_id','in',$actionIds)->order('id desc')->limit(5)->select()->each(function($item)use($actionsInfo){
foreach ($actionsInfo as $val){
if($item['action_id'] == $val['id']){
$item['action_name'] = $val['name'];
}
}
$item['create_time'] = date('Y-m-d H:i:s');
return $item;
});
}
}
if($params['type'] == 3){ if($params['type'] == 3){
foreach($arr1 as $k=>$v) { foreach($arr1 as $k=>$v) {
$actionIds = array_column($v['actions'],'id'); $actionIds = array_column($v['actions'],'id');
@ -181,6 +196,21 @@ class UserController extends BaseApiController
}); });
} }
} }
if($params['type'] == 1) {
foreach($arr1 as $k=>$v) {
$actionIds = array_column($v['actions'],'id');
$actionsInfo = $v['actions'];
$arr1[$k]['action_record'] = Db::name('farmer_land_crop_record')->where('action_id','in',$actionIds)->order('id desc')->limit(5)->select()->each(function($item)use($actionsInfo){
foreach ($actionsInfo as $val){
if($item['action_id'] == $val['id']){
$item['action_name'] = $val['name'];
}
}
$item['create_time'] = date('Y-m-d H:i:s');
return $item;
});
}
}
return $this->success('请求成功',$arr1); return $this->success('请求成功',$arr1);
} }