From c2492d2879a9d63440f3f1efac1f3e89bb1e70f0 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Wed, 22 Mar 2023 17:16:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=B6=E6=97=8F=E5=A4=B4=E5=83=8F=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/group_power_r/group_power.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/route/group_power_r/group_power.go b/route/group_power_r/group_power.go index 3436174..db64d42 100644 --- a/route/group_power_r/group_power.go +++ b/route/group_power_r/group_power.go @@ -5,8 +5,11 @@ import ( "fmt" "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/mycontext" + "git.hilo.cn/hilo-common/resource/config" "git.hilo.cn/hilo-common/resource/mysql" "git.hilo.cn/hilo-common/resource/redisCli" + "git.hilo.cn/hilo-common/sdk/aws" + "git.hilo.cn/hilo-common/sdk/tencentyun" "git.hilo.cn/hilo-common/utils" "github.com/gin-gonic/gin" "github.com/jinzhu/now" @@ -1461,6 +1464,24 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) { return myContext, bizerr.GroupPowerCannotRepeated } } + if para.Icon != "" { + switch config.GetConfigApp().MODERATE { + case "AWS": + passed, err := aws.ModerateLabels(model.Log, userId, para.Icon) + if err == nil { + if !passed { + return myContext, bizerr.ImagePolicyViolation + } + } else { + model.Log.Warnf("ModerateLabels err:%v", err) + } + case "TENCENT": + label, err := tencentyun.ModerateImage(model, userId, "", utils.StripAwsPrefix(para.Icon), para.Icon) + if err == nil && label != "Pass" { + return myContext, bizerr.ImagePolicyViolation + } + } + } // 修改家族信息 err = groupPower_m.UpdateFamily(model, para.Id, para.Name, para.Nameplate, para.Declaration, para.Icon) -- 2.22.0