From 5c3d209c7b7ed8ce406c61f797d41575a1e71dd1 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 13 Jun 2023 11:22:56 +0800 Subject: [PATCH] update --- ...shen_user_register_for_official_consume.go | 4 +- ...shen_user_register_for_operation_center.go | 69 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/consume/dou_shen_user_register_for_official_consume.go b/consume/dou_shen_user_register_for_official_consume.go index 8fd6c6a..bb47638 100644 --- a/consume/dou_shen_user_register_for_official_consume.go +++ b/consume/dou_shen_user_register_for_official_consume.go @@ -121,6 +121,9 @@ func handleDouShenUserRegisterConsumeForOfficial(msgData []byte) error { return err } for _, group := range *officialGroups { + if officialGroup != nil { + continue + } //统计当前群有多少人 userGroups, _ := db2.GroupUserFindByParams(db.ImDb, map[string]interface{}{ "key": "group_id", @@ -128,7 +131,6 @@ func handleDouShenUserRegisterConsumeForOfficial(msgData []byte) error { }) if len(*userGroups) < 500 { officialGroup = &group - break } } diff --git a/consume/dou_shen_user_register_for_operation_center.go b/consume/dou_shen_user_register_for_operation_center.go index 7374405..f27df4b 100644 --- a/consume/dou_shen_user_register_for_operation_center.go +++ b/consume/dou_shen_user_register_for_operation_center.go @@ -6,6 +6,7 @@ import ( db2 "applet/app/db/gim" "applet/app/db/gim/model" model2 "applet/app/db/model" + "applet/app/svc" utils2 "applet/app/utils" "applet/app/utils/logx" utils "applet/app/utils/rpc" @@ -212,40 +213,40 @@ func handleDouShenUserRegisterConsumeForOperationCenter(msgData []byte) error { }) //发送专属红包 - //gimSendSpeciallyRedPackageUser, err := db2.DbSysCfg.SysCfgGetOne("send_specially_red_package_user", msg.MasterId) - //if err != nil { - // return err - //} - //if gimSendSpeciallyRedPackageUser == nil { - // return errors.New("暂未设置专属红包发送用户") - //} - //sendSpeciallyRedPackageUser, err := db.SysCfgGetOne(db.DBs[msg.MasterId], "send_specially_red_package_user") - //if err != nil { - // return err - //} - //amount, err := getSendAmount(msg.MasterId) - //if err != nil { - // return err - //} - //args := md.SendRedPackageReq{ - // UserId: gimSendSpeciallyRedPackageUser.Val, - // DeviceId: "", - // Token: "", - // Amount: amount, - // RedPacketType: 5, - // RedPacketNums: 1, - // RedPacketContent: "抖省赚钱,大吉大利", - // RedPacketSmallContent: gimUser.Nickname + "的专属红包", - // ReceiverType: 2, - // ReceiverId: int64(OperationGroup.GroupId), - // SendTime: utils2.UnixMilliTime(time.Now()), - // ToUserIds: []int64{gimUser.Id}, - // RedPackageCover: "", - //} - //err, _ = svc.CurlSendRedPackage(args, msg.MasterId, sendSpeciallyRedPackageUser.Val) - //if err != nil { - // return err - //} + gimSendSpeciallyRedPackageUser, err := db2.DbSysCfg.SysCfgGetOne("send_specially_red_package_user", msg.MasterId) + if err != nil { + return err + } + if gimSendSpeciallyRedPackageUser == nil { + return errors.New("暂未设置专属红包发送用户") + } + sendSpeciallyRedPackageUser, err := db.SysCfgGetOne(db.DBs[msg.MasterId], "send_specially_red_package_user") + if err != nil { + return err + } + amount, err := getSendAmount(msg.MasterId) + if err != nil { + return err + } + args := md.SendRedPackageReq{ + UserId: gimSendSpeciallyRedPackageUser.Val, + DeviceId: "", + Token: "", + Amount: amount, + RedPacketType: 5, + RedPacketNums: 1, + RedPacketContent: "抖省赚钱,大吉大利", + RedPacketSmallContent: gimUser.Nickname + "的专属红包", + ReceiverType: 2, + ReceiverId: int64(OperationGroup.GroupId), + SendTime: utils2.UnixMilliTime(time.Now()), + ToUserIds: []int64{gimUser.Id}, + RedPackageCover: "", + } + err, _ = svc.CurlSendRedPackage(args, msg.MasterId, sendSpeciallyRedPackageUser.Val) + if err != nil { + return err + } return nil }