$params['project_id'], 'type' => $params['type'], 'partial_project' => $params['partial_project'], 'planned_construction_time' => !empty($params['planned_construction_time']) ? strtotime($params['planned_construction_time']) : 0, 'check_item_id' => $params['check_item_id'], 'position' => $params['position'], 'project_characteristics' => $params['project_characteristics'], 'supervisor' => $params['supervisor'], 'responsible_person' => $params['responsible_person'] ]); 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/04 11:05 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionDangerousEngineeringMonitoring::where('id', $params['id'])->update([ 'project_id' => $params['project_id'], 'type' => $params['type'], 'partial_project' => $params['partial_project'], 'planned_construction_time' => !empty($params['planned_construction_time']) ? strtotime($params['planned_construction_time']) : 0, 'check_item_id' => $params['check_item_id'], 'position' => $params['position'], 'project_characteristics' => $params['project_characteristics'], 'supervisor' => $params['supervisor'], 'responsible_person' => $params['responsible_person'], '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/04 11:05 */ public static function delete(array $params): bool { // todo return SupervisionDangerousEngineeringMonitoring::destroy($params['id']); } /** * @notes 获取工程监理--危大工程监控详情 * @param $params * @return array * @author likeadmin * @date 2024/03/04 11:05 */ public static function detail($params): array { $data = SupervisionDangerousEngineeringMonitoring::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $project = SupervisionProject::field('project_name')->where('id',$data['project_id'])->findOrEmpty(); $node = SupervisionCheckItem::field('node_name')->where('id',$data['check_item_id'])->findOrEmpty(); $data['project_name'] = $project['project_name']; $data['node_name'] = $node['node_name']; $data['partial_project_text'] = $data->partial_project_text; $data['type_text'] = $data->type_text; return $data->toArray(); } }