Browse Source

注销

master
huangjiajun 2 days ago
parent
commit
08a9ee5bbd
2 changed files with 45 additions and 4 deletions
  1. +44
    -3
      consume/user_delete_consume.go
  2. +1
    -1
      go.mod

+ 44
- 3
consume/user_delete_consume.go View File

@@ -3,11 +3,11 @@ package consume
import (
"applet/app/cfg"
"applet/app/db"
model2 "applet/app/db/model"
utils2 "applet/app/utils"
"applet/app/utils/logx"
"applet/consume/md"
db2 "code.fnuoos.com/EggPlanet/egg_models.git/src"
imModel "code.fnuoos.com/EggPlanet/egg_models.git/src/im/model"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"code.fnuoos.com/EggPlanet/egg_system_rules.git"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule"
@@ -86,9 +86,11 @@ func handleUserDeleteConsume(backEg *xorm.Engine, ch *rabbit.Channel, msgData []
}
eg := db.Db
//1.用户信息
var user model2.User
var user model.User
exist, err := eg.Where("id=?", msg.Uid).Get(&user)
phone := ""
if exist {
phone = user.Phone
backEg.Insert(&user)
user.Phone = ""
user.State = 2
@@ -148,7 +150,7 @@ func handleUserDeleteConsume(backEg *xorm.Engine, ch *rabbit.Channel, msgData []
}
}
}
eg.Where("parent_uid=?", msg.Uid).Cols("parent_uid").Update(&model2.User{ParentUid: utils2.StrToInt64(msg.ParentUid)})
eg.Where("parent_uid=?", msg.Uid).Cols("parent_uid").Update(&model.User{ParentUid: utils2.StrToInt64(msg.ParentUid)})
_, err = eg.Where("parent_uid=?", msg.Uid).Delete(&model.UserRelate{})
_, err = eg.Where("uid=?", msg.Uid).Delete(&model.UserRelate{})

@@ -165,5 +167,44 @@ func handleUserDeleteConsume(backEg *xorm.Engine, ch *rabbit.Channel, msgData []
backEg.Insert(&publicPlatoonUserRelation)
}
rule.DealPublicPlatoon(eg, utils2.StrToInt64(msg.Uid), "注销")

//删除im
if phone != "" {
var imUser imModel.User
db.DbIm.Where("phone_number=?", phone).Get(&imUser)
if imUser.Id == 0 {
return nil
}
//查下群组
var imGroup []imModel.GroupUser
db.DbIm.Where("user_id=?", imUser.Id).Find(&imGroup)
groupIds := make([]int64, 0)
for _, v := range imGroup {
if v.MemberType == 1 { //群主的要删群
groupIds = append(groupIds, v.GroupId)
}
db.DbIm.Where("id=?", v.Id).Delete(&imModel.GroupUser{})
}
//查下群删掉
if len(groupIds) > 0 {
db.DbIm.In("id", groupIds).Delete(&imModel.Group{})
}
//查下群记录
db.DbIm.Where("user_id=?", imUser.Id).Delete(&imModel.GroupNotice{})
db.DbIm.Where("user_id=?", imUser.Id).Delete(&imModel.GroupNoticeWithLikeRecords{})
db.DbIm.Where("user_id=?", imUser.Id).Delete(&imModel.GroupComplain{})
if len(groupIds) > 0 {
db.DbIm.In("group_id", groupIds).Delete(&imModel.GroupNotice{})
db.DbIm.In("group_id", groupIds).Delete(&imModel.GroupNoticeWithLikeRecords{})
db.DbIm.In("group_id", groupIds).Delete(&imModel.GroupComplain{})
}
//删除红包
db.DbIm.Where("im_uid=?", imUser.Id).Delete(&imModel.ImSendRedPackageOrd{})
//删除好友
db.DbIm.Where("user_id=?", imUser.Id).Delete(&imModel.Friend{})
db.DbIm.Where("friend_id=?", imUser.Id).Delete(&imModel.Friend{})
db.DbIm.Where("phone_number=?", phone).Delete(&imModel.User{})

}
return nil
}

+ 1
- 1
go.mod View File

@@ -7,7 +7,7 @@ go 1.19
// replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241229040905-b840e6fb411a
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20250102033457-e7921b94d2fb
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20250102013515-7dc14a5d08f2
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