diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index cc8f5963581e61c9bfaabf98f0c138485066d429..526ec63c78e7854e47fdb9c7dfc8e2405840dab2 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -35,6 +35,32 @@ func SendFruitMachine(date string, round uint32) error { return nil } +func SendFruitMachineToUser(date string, round uint32, userIds []uint64) error { + msg := &userProxy.FruitMachine{ + Date: date, + Round: round, + } + if buffer, err := proto.Marshal(msg); err == nil { + rspUids, err := multicast(userIds, MsgFruitMachine, buffer) + + //记录socket,注意闭包问题 + go func(userId uint64, msg *userProxy.FruitMachine, rspUids []uint64, err error) { + buf, _ := json.Marshal(msg) + AddRpcLog(MsgFruitMachine, userId, string(buf[:]), rspUids, err) + }(0, msg, rspUids, err) + + if err != nil { + mylogrus.MyLog.Errorf("grpc SendFruitMachine send fail") + return err + } else { + mylogrus.MyLog.Info("grpc SendFruitMachine send success") + } + } else { + return err + } + return nil +} + func SendGlobalRocketNotice(groupId string, period string, round uint32, stage uint32, fromUserId uint64, topUserIcon string, nick string, code string, avatar string) error { msg := &userProxy.GlobalRocketNotice{ GroupId: groupId,