fixed
This commit is contained in:
parent
ea1f5ca2c1
commit
c2306073a0
|
@ -119,13 +119,29 @@ class UserController extends BaseApiController
|
|||
if($params['type'] == 3){
|
||||
foreach($arr1 as $k=>$v) {
|
||||
$actionIds = array_column($v['actions'],'id');
|
||||
$arr1[$k]['action_record'] = Db::name('farmer_animal_record')->where('action_id','in',$actionIds)->order('id desc')->limit(5)->select();
|
||||
$actionsInfo = $v['actions'];
|
||||
$arr1[$k]['action_record'] = Db::name('farmer_animal_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'];
|
||||
}
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
}
|
||||
if($params['type'] == 2) {
|
||||
foreach($arr1 as $k=>$v) {
|
||||
$actionIds = array_column($v['actions'],'id');
|
||||
$arr1[$k]['action_record'] = Db::name('farmer_poultry_record')->where('action_id','in',$actionIds)->order('id desc')->limit(5)->select();
|
||||
$actionsInfo = $v['actions'];
|
||||
$arr1[$k]['action_record'] = Db::name('farmer_poultry_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'];
|
||||
}
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
}
|
||||
return $this->success('请求成功',$arr1);
|
||||
|
|
Loading…
Reference in New Issue