数据模型使用指针类型字段以避免空值自动更新的问题

This commit is contained in:
2025-05-26 10:57:39 +08:00
parent 1e7b5777a2
commit c08d625975
43 changed files with 457 additions and 397 deletions

View File

@@ -122,7 +122,7 @@ func CreateChannel(c *fiber.Ctx) error {
if err != nil {
return err
}
if user.IDToken == "" {
if user.IDToken == nil || *user.IDToken == "" {
return fiber.NewError(fiber.StatusForbidden, "账号未实名")
}
@@ -178,8 +178,8 @@ func CreateChannel(c *fiber.Ctx) error {
Port: channel.ProxyPort,
}
if req.AuthType == s.ChannelAuthTypePass {
resp[i].Username = &channel.Username
resp[i].Password = &channel.Password
resp[i].Username = channel.Username
resp[i].Password = channel.Password
}
}
return c.JSON(resp)