Compare commits

...

2 Commits

Author SHA1 Message Date
weiz 19363319cf Merge pull request 'update' (#37) from zhangwei into dev
Reviewed-on: #37
2023-12-04 11:58:23 +08:00
weiz b205950ac3 update 2023-12-04 11:57:33 +08:00
1 changed files with 7 additions and 0 deletions

View File

@ -41,6 +41,9 @@
return $this->fail('操作内容格式错误');
}
foreach($this->actionFields[$params['type']] as $v) {
if($v == 'remark'){
continue;
}
if(empty($detail[$v])){
return $this->fail($this->actionMessage[$params['type']].'缺少必要参数');
}
@ -103,6 +106,8 @@
$data = Db::query("SELECT * FROM zzsy_land_plant_action WHERE id IN (SELECT max( id ) FROM zzsy_land_plant_action WHERE plant_id = {$params['plant_id']} GROUP BY type)");
foreach($data as $k=>$v){
$data[$k]['detail'] = json_decode($v['detail'],true);
$data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
$data[$k]['update_time'] = date('Y-m-d H:i:s',$v['update_time']);
}
return $this->success('请求成功',$data);
}
@ -116,6 +121,8 @@
}
$data = Action::where('plant_id',$params['plant_id'])->where('type',$params['type'])->order('create_time desc')->select()->each(function($item){
$item['detail'] = json_decode($item['detail'],true);
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
$item['update_time'] = date('Y-m-d H:i:s',$item['update_time']);
return $item;
})->toArray();
return $this->success('请求成功',$data);