mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 07:56:38 +08:00
feat: 检测vertex渠道部署地区是否填写
This commit is contained in:
parent
e60f200192
commit
01fd8b53a6
@ -212,7 +212,7 @@ func AddChannel(c *gin.Context) {
|
|||||||
if regionMap["default"] == nil {
|
if regionMap["default"] == nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"success": false,
|
"success": false,
|
||||||
"message": "必须包含default字段",
|
"message": "部署地区必须包含default字段",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -319,6 +319,27 @@ func UpdateChannel(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if channel.Type == common.ChannelTypeVertexAi {
|
||||||
|
if channel.Other == "" {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"message": "部署地区不能为空",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if common.IsJsonStr(channel.Other) {
|
||||||
|
// must have default
|
||||||
|
regionMap := common.StrToMap(channel.Other)
|
||||||
|
if regionMap["default"] == nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"message": "部署地区必须包含default字段",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
err = channel.Update()
|
err = channel.Update()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
Loading…
Reference in New Issue
Block a user