$params['node_id'], 'check_type' => $params['check_type'], 'check_content' => $params['check_content'], 'must_check' => $params['must_check'], ]); 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/02/26 15:34 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionCheckItemDetail::where('id', $params['id'])->update([ 'node_id' => $params['node_id'], 'check_type' => $params['check_type'], 'check_content' => $params['check_content'], 'must_check' => $params['must_check'], '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/02/26 15:34 */ public static function delete(array $params): bool { return SupervisionCheckItemDetail::destroy($params['id']); } /** * @notes 获取工程监理--新增检查项明细详情 * @param $params * @return array * @author likeadmin * @date 2024/02/26 15:34 */ public static function detail($params): array { $data = SupervisionCheckItemDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $data['must_check_text'] = $data->must_check_text; return $data->toArray(); } }