From aadde4c368481293d37f6d4b54799e135597adb6 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 9 Dec 2024 14:34:35 +0800 Subject: [PATCH] update --- app/hdl/member_center/hdl_tag__management.go | 15 +++++++++++++-- go.mod | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/hdl/member_center/hdl_tag__management.go b/app/hdl/member_center/hdl_tag__management.go index 89bc7e1..f1d7878 100644 --- a/app/hdl/member_center/hdl_tag__management.go +++ b/app/hdl/member_center/hdl_tag__management.go @@ -7,6 +7,7 @@ import ( "applet/app/utils" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "errors" "github.com/gin-gonic/gin" "time" ) @@ -126,7 +127,7 @@ func UpdateTag(c *gin.Context) { Memo: req.Memo, } - forceColumns := []string{"tag_name", "memo", "is_punish"} + forceColumns := []string{"tag_name", "memo"} tagDb := implement.NewUserTagDb(db.Db) affected, err := tagDb.UserTagUpdate(tagID, tag, forceColumns...) @@ -160,7 +161,17 @@ func DeleteTag(c *gin.Context) { session := db.Db.NewSession() defer session.Close() - _, err := tagDb.UserTagDeleteBySession(session, req.TagID) + isUsed, err := recordsDb.UserTagRecordsIsUsedBySession(session, utils.StrToInt(req.TagID)) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if isUsed { + e.OutErr(c, e.ERR, errors.New("该标签已被使用,无法删除").Error()) + return + } + + _, err = tagDb.UserTagDeleteBySession(session, req.TagID) if err != nil { session.Rollback() e.OutErr(c, e.ERR_DB_ORM, err.Error()) diff --git a/go.mod b/go.mod index 34c8776..94ffe78 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241207095049-e0ad89412565 + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241209061118-ae1be0db6a70 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205075006-9c0bf995c788 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5