$params['project_id'], 'check_user' => $params['check_user'], 'check_date' => !empty($params['check_date']) ? strtotime($params['check_date']) : 0, 'check_area' => $params['check_area'], 'problem_desc' => $params['problem_desc'], 'remark' => $params['remark'], 'annex' => $params['annex'] ? json_encode($params['annex']) : null, ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑工程监理--现场安全警示标志 * @param array $params * @return bool * @author likeadmin * @date 2024/03/01 15:41 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionSafetyWarningSign::where('id', $params['id'])->update([ 'project_id' => $params['project_id'], 'check_user' => $params['check_user'], 'check_date' => !empty($params['check_date']) ? strtotime($params['check_date']) : 0, 'check_area' => $params['check_area'], 'problem_desc' => $params['problem_desc'], 'remark' => $params['remark'], 'annex' => $params['annex'] ? json_encode($params['annex']) : null, 'update_time' => time() ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除工程监理--现场安全警示标志 * @param array $params * @return bool * @author likeadmin * @date 2024/03/01 15:41 */ public static function delete(array $params): bool { return SupervisionSafetyWarningSign::destroy($params['id']); } /** * @notes 获取工程监理--现场安全警示标志详情 * @param $params * @return array * @author likeadmin * @date 2024/03/01 15:41 */ public static function detail($params): array { $data = SupervisionSafetyWarningSign::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; return $data->toArray(); } }