Ver código fonte

feat(gameShield): 修改游戏盾配置项

- 将 GameShieldBackendArrayRequest 结构中的 Checked 字段类型从 int 改为 string- 在 formatter.go 中更新了游戏盾配置的逻辑,使用 item.Checked == "agent" 作为条件- 移除了 GameShieldBackendArrayRequest 结构中未使用的 SdkIp、Type 和 MaxBandwidth 字段
fusu 3 meses atrás
pai
commit
78dcfd3b87
2 arquivos alterados com 5 adições e 5 exclusões
  1. 4 4
      api/v1/gameShieldBackend.go
  2. 1 1
      internal/service/formatter.go

+ 4 - 4
api/v1/gameShieldBackend.go

@@ -13,15 +13,15 @@ type GameShieldBackendRequest struct {
 	SdkIp           string    `json:"sdk_ip" form:"sdk_ip"`
 	Type            string    `json:"type" form:"type"`
 	MaxBandwidth    string    `json:"max_bandwidth" form:"max_bandwidth"`
+	Checked         string    `json:"checked" form:"checked"`
 	CreatedAt       time.Time `json:"created_at" form:"created_at"`
 	UpdatedAt       time.Time `json:"updated_at" form:"updated_at"`
 }
 
 type GameShieldBackendArrayRequest struct {
-	Items   []GameShieldBackendRequest `json:"items" form:"items"`
-	Uid     int                        `json:"uid" form:"uid" binding:"required"`
-	Checked int                        `json:"checked" form:"checked"`
-	HostId  int                        `json:"host_id" form:"host_id" binding:"required"`
+	Items  []GameShieldBackendRequest `json:"items" form:"items"`
+	Uid    int                        `json:"uid" form:"uid" binding:"required"`
+	HostId int                        `json:"host_id" form:"host_id" binding:"required"`
 }
 
 type SendGameShieldBackend struct {

+ 1 - 1
internal/service/formatter.go

@@ -155,7 +155,7 @@ func (service *formatterService) TidyFormatBackendData(ctx context.Context, req
 
 			// 根据协议设置不同属性
 			if protocol != "udp" {
-				if req.Checked == 1 {
+				if item.Checked == "agent" {
 					itemMap.AgentAddr = fmt.Sprintf("%s:%s", sourceIP, "23350")
 				}
 				itemMap.ProxyAddr = userIp + ":32353"