|
|
@@ -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 |
|
|
|
} |