$params['device_id'], 'name' => $params['name'], 'is_show' => $params['is_show'], ]); 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/23 15:20 */ public static function edit(array $params): bool { Db::startTrans(); try { SupervisionMonitoringEquipmentDetail::where('id', $params['id'])->update([ 'device_id' => $params['device_id'], 'name' => $params['name'], 'is_show' => $params['is_show'], '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/23 15:20 */ public static function delete(array $params): bool { return SupervisionMonitoringEquipmentDetail::destroy($params['id']); } /** * @notes 获取工程监理--监控设备明细详情 * @param $params * @return array * @author likeadmin * @date 2024/02/23 15:20 */ public static function detail($params): array { $data = SupervisionMonitoringEquipmentDetail::withoutField('create_time,update_time,delete_time')->findOrEmpty($params['id']); $device = SupervisionMonitoringEquipment::field('device_name')->where('id',$data['device_id'])->findOrEmpty(); $data['device_name'] = $device['device_name']; $data['is_show_text'] = $data->is_show_text; return $data->toArray(); } }