From 01fd8b53a68c2bbd53f3851abd72b3ba8f4a475e Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Wed, 28 Aug 2024 18:47:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A3=80=E6=B5=8Bvertex=E6=B8=A0?= =?UTF-8?q?=E9=81=93=E9=83=A8=E7=BD=B2=E5=9C=B0=E5=8C=BA=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/controller/channel.go b/controller/channel.go index 5d1af01..7852595 100644 --- a/controller/channel.go +++ b/controller/channel.go @@ -212,7 +212,7 @@ func AddChannel(c *gin.Context) { if regionMap["default"] == nil { c.JSON(http.StatusOK, gin.H{ "success": false, - "message": "必须包含default字段", + "message": "部署地区必须包含default字段", }) return } @@ -319,6 +319,27 @@ func UpdateChannel(c *gin.Context) { }) 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() if err != nil { c.JSON(http.StatusOK, gin.H{