Commit 916acd72 authored by chenweijian's avatar chenweijian

家族小助手

parent 28fd870d
......@@ -4,11 +4,14 @@ import (
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils"
"hilo-group/_const/enum/groupPower_e"
"hilo-group/cv/group_power_cv"
"hilo-group/domain/event/group_power_ev"
"hilo-group/domain/model/groupPower_m"
"hilo-group/domain/model/msg_m"
"hilo-group/domain/model/noble_m"
"hilo-group/domain/model/user_m"
)
type GroupPowerService struct {
......@@ -93,3 +96,34 @@ func GetGroupPowerMaxMemberNum(model *domain.Model, familyId uint64, groupPowerG
}
return
}
// 检查需不需要通知用户拉取家族小助手消息
func CheckoutSendMsgToMgr(myContext *mycontext.MyContext, groupPowerId uint64) {
defer utils.CheckGoPanic()
model := domain.CreateModelContext(myContext)
//// 申请人数
//cnt, err := groupPower_m.CountGroupPowerApply(model, groupPowerId, 0)
//if err != nil {
// model.Log.Errorf("CheckoutSendMsgToMgr err:%v, id:%v", err, groupPowerId)
// return
//}
//if cnt <= 0 {
// return
//}
// 找到家族管理员们
mgrList, err := groupPower_m.GetGroupPowerMgrList(model, groupPowerId)
if err != nil {
model.Log.Errorf("CheckoutSendMsgToMgr err:%v, id:%v", err, groupPowerId)
return
}
userMap, err := user_m.GetUserMapByIds(model, mgrList)
if err != nil {
model.Log.Errorf("CheckoutSendMsgToMgr err:%v, id:%v", err, groupPowerId)
return
}
for _, v := range mgrList {
if user, ok := userMap[v]; ok {
msg_m.SendEmasMsgAssistant(model, user.ExternalId, user.DeviceType)
}
}
}
......@@ -1099,6 +1099,8 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
return myContext, err
}
resp.ResponseOk(c, nil)
// 家族小助手通知
go group_power_s.CheckoutSendMsgToMgr(myContext, myGroupPUser.GroupPowerId)
return myContext, nil
}
// 判断家族是否满人了
......@@ -1156,6 +1158,8 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
if err != nil {
model.Log.Errorf("GroupPowerApplyPass msg err:%v", err)
}
// 家族小助手通知
go group_power_s.CheckoutSendMsgToMgr(myContext, myGroupPUser.GroupPowerId)
resp.ResponseOk(c, nil)
return myContext, nil
......@@ -1590,7 +1594,6 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
if err != nil {
return myContext, myerr.WrapErr(err)
}
groupPowerGrade, err := groupPower_m.MGetGroupPowerGrade(model, []mysql.ID{gp.ID})
gradeM, err := groupPower_m.MGetGroupPowerGrade(model, []mysql.ID{gp.ID})
if err != nil {
return myContext, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment