Browse Source

update

master
shenjiachi 1 week ago
parent
commit
aadde4c368
2 changed files with 14 additions and 3 deletions
  1. +13
    -2
      app/hdl/member_center/hdl_tag__management.go
  2. +1
    -1
      go.mod

+ 13
- 2
app/hdl/member_center/hdl_tag__management.go View File

@@ -7,6 +7,7 @@ import (
"applet/app/utils" "applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"errors"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"time" "time"
) )
@@ -126,7 +127,7 @@ func UpdateTag(c *gin.Context) {
Memo: req.Memo, Memo: req.Memo,
} }


forceColumns := []string{"tag_name", "memo", "is_punish"}
forceColumns := []string{"tag_name", "memo"}


tagDb := implement.NewUserTagDb(db.Db) tagDb := implement.NewUserTagDb(db.Db)
affected, err := tagDb.UserTagUpdate(tagID, tag, forceColumns...) affected, err := tagDb.UserTagUpdate(tagID, tag, forceColumns...)
@@ -160,7 +161,17 @@ func DeleteTag(c *gin.Context) {
session := db.Db.NewSession() session := db.Db.NewSession()
defer session.Close() 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 { if err != nil {
session.Rollback() session.Rollback()
e.OutErr(c, e.ERR_DB_ORM, err.Error()) e.OutErr(c, e.ERR_DB_ORM, err.Error())


+ 1
- 1
go.mod View File

@@ -33,7 +33,7 @@ require (
) )


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/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_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5


Loading…
Cancel
Save