Browse Source

update

master
shenjiachi 1 week ago
parent
commit
04a9032164
3 changed files with 25 additions and 12 deletions
  1. +12
    -1
      app/md/member_center/md_user_management.go
  2. +12
    -10
      app/svc/member_center/svc_user_management.go
  3. +1
    -1
      go.mod

+ 12
- 1
app/md/member_center/md_user_management.go View File

@@ -95,7 +95,7 @@ type UserManagementUpdateUserInfoReq struct {

type TagNode struct {
TagID int `json:"tag_id"` // 标签 ID
TagName string `json:"tag_name"` // 标签 名称
TagName string `json:"tag_name"` // 标签名称
}

type BasicInfoNode struct {
@@ -179,3 +179,14 @@ type UserManagementGetVirtualCoinDetailResp struct {
List []VirtualCoinDetailNode `json:"list"`
Paginate Paginate `json:"paginate"`
}

type UserManagementAddTagReq struct {
Uid int64 `json:"uid"` // 用户 ID
TagId string `json:"tag_id"` // 标签 ID
Memo string `json:"memo"` // 标签备注
}

type UserManagementDelTagReq struct {
Uid int64 `json:"uid"` // 用户 ID
TagId string `json:"tag_id"` // 标签 ID
}

+ 12
- 10
app/svc/member_center/svc_user_management.go View File

@@ -133,16 +133,19 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd
if err != nil {
return 0, err
}
if records != nil {
recordIds := make([]int, 0)
for _, record := range *records {
recordIds = append(recordIds, record.Id)
}

// 删除所有用户的所有标签记录
oldRecordIds := make([]string, 0)
for _, record := range *records {
oldRecordIds = append(oldRecordIds, utils.IntToStr(record.Id))
}
newRecordIds := strings.Split(req.Tag, ",")
// 需要删除的标签
delTags := utils.DiffArray(oldRecordIds, newRecordIds)
addTags := utils.DiffArray(newRecordIds, oldRecordIds)
if delTags != nil {
// 删除不需要的标签记录
_, err := recordsDb.UserTagRecordsDeleteBySession(session, map[string]interface{}{
"key": "id",
"value": recordIds,
"value": delTags,
})
if err != nil {
return 0, err
@@ -153,8 +156,7 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd
if req.Tag != "" {
newRecords := make([]*model.UserTagRecords, 0)
now := time.Now()
tags := strings.Split(req.Tag, ",")
for _, tag := range tags {
for _, tag := range addTags {
newRecord := &model.UserTagRecords{
TagId: utils.StrToInt(tag),
Uid: req.UID,


+ 1
- 1
go.mod View File

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

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206115326-8cbc93c7c64d
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241207021144-5eb7d8513c6a
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


Loading…
Cancel
Save