update #37

Merged
weiz merged 1 commits from zhangwei into dev 2023-12-04 11:58:24 +08:00
1 changed files with 7 additions and 0 deletions
Showing only changes of commit b205950ac3 - Show all commits

View File

@ -41,6 +41,9 @@
return $this->fail('操作内容格式错误'); return $this->fail('操作内容格式错误');
} }
foreach($this->actionFields[$params['type']] as $v) { foreach($this->actionFields[$params['type']] as $v) {
if($v == 'remark'){
continue;
}
if(empty($detail[$v])){ if(empty($detail[$v])){
return $this->fail($this->actionMessage[$params['type']].'缺少必要参数'); 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)"); $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){ foreach($data as $k=>$v){
$data[$k]['detail'] = json_decode($v['detail'],true); $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); 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){ $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['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; return $item;
})->toArray(); })->toArray();
return $this->success('请求成功',$data); return $this->success('请求成功',$data);