@@ -179,7 +179,7 @@ func (h *TunnelHandler) HandleCreateTunnel(c *gin.Context) {
179179 Min json.RawMessage `json:"min"`
180180 Max json.RawMessage `json:"max"`
181181 Slot json.RawMessage `json:"slot"` // 新增:最大连接数限制
182- Mode * string `json:"mode,omitempty"` // 新增:运行模式 (0, 1, 2)
182+ Mode * int `json:"mode,omitempty"` // 新增:运行模式 (0, 1, 2)
183183 Read * string `json:"read,omitempty"` // 新增:数据读取超时时间
184184 Rate * string `json:"rate,omitempty"` // 新增:带宽速率限制
185185 EnableSSEStore * bool `json:"enable_sse_store,omitempty"` // 新增:是否启用SSE存储
@@ -582,7 +582,7 @@ func (h *TunnelHandler) HandleUpdateTunnel(c *gin.Context) {
582582 Min json.RawMessage `json:"min"`
583583 Max json.RawMessage `json:"max"`
584584 Slot json.RawMessage `json:"slot"` // 新增:最大连接数限制
585- Mode * string `json:"mode,omitempty"` // 新增:运行模式
585+ Mode * int `json:"mode,omitempty"` // 新增:运行模式
586586 Read * string `json:"read,omitempty"` // 新增:数据读取超时时间
587587 Rate * string `json:"rate,omitempty"` // 新增:带宽速率限制
588588 EnableSSEStore * bool `json:"enable_sse_store,omitempty"` // 新增:是否启用SSE存储
@@ -662,8 +662,7 @@ func (h *TunnelHandler) HandleUpdateTunnel(c *gin.Context) {
662662 // 处理Mode字段的类型转换
663663 var modePtr * tunnel.TunnelMode
664664 if rawCreate .Mode != nil {
665- mode := tunnel .TunnelMode (* rawCreate .Mode )
666- modePtr = & mode
665+ modePtr = (* tunnel .TunnelMode )(rawCreate .Mode )
667666 }
668667
669668 createReq := tunnel.CreateTunnelRequest {
@@ -1153,9 +1152,16 @@ func (h *TunnelHandler) HandleGetTunnelDetails(c *gin.Context) {
11531152 targetPort , _ := strconv .Atoi (tunnelRecord .TargetPort )
11541153
11551154 // 处理新字段的NULL值
1156- mode := ""
1155+ var mode interface {}
11571156 if tunnelRecord .Mode .Valid {
1158- mode = tunnelRecord .Mode .String
1157+ modeInt , err := strconv .Atoi (tunnelRecord .Mode .String )
1158+ if err != nil {
1159+ mode = nil
1160+ } else {
1161+ mode = modeInt
1162+ }
1163+ } else {
1164+ mode = nil
11591165 }
11601166 read := ""
11611167 if tunnelRecord .Read .Valid {
@@ -3006,7 +3012,7 @@ func (h *TunnelHandler) HandleUpdateTunnelV2(c *gin.Context) {
30063012 Min json.RawMessage `json:"min"`
30073013 Max json.RawMessage `json:"max"`
30083014 Slot json.RawMessage `json:"slot"` // 新增:最大连接数限制
3009- Mode * string `json:"mode,omitempty"` // 新增:运行模式
3015+ Mode * int `json:"mode,omitempty"` // 新增:运行模式
30103016 Read * string `json:"read,omitempty"` // 新增:数据读取超时时间
30113017 Rate * string `json:"rate,omitempty"` // 新增:带宽速率限制
30123018 EnableSSEStore * bool `json:"enable_sse_store,omitempty"` // 新增:是否启用SSE存储
@@ -3155,8 +3161,7 @@ func (h *TunnelHandler) HandleUpdateTunnelV2(c *gin.Context) {
31553161 // 处理Mode字段的类型转换
31563162 var modePtr * tunnel.TunnelMode
31573163 if raw .Mode != nil {
3158- mode := tunnel .TunnelMode (* raw .Mode )
3159- modePtr = & mode
3164+ modePtr = (* tunnel .TunnelMode )(raw .Mode )
31603165 }
31613166
31623167 createReq := tunnel.CreateTunnelRequest {
0 commit comments