Commit 7ea268ea authored by hujiebin's avatar hujiebin

Update user_center_func.go

parent 9b79a3d3
......@@ -330,3 +330,32 @@ func SendCpInviteNotice(userId uint64, code, name, avatar, content, extId string
}
return nil
}
// cp升级
func SendCpUpgrade(nick1, nick2, avatar1, avatar2 string, cpLevel uint32, content string) error {
msg := &userProxy.CpUpgrade{
User1: &userProxy.User{Nick: nick1, Avatar: avatar1},
User2: &userProxy.User{Nick: nick2, Avatar: avatar2},
CpLevel: cpLevel,
Content: content,
}
if buffer, err := proto.Marshal(msg); err == nil {
rspUids, err := broadcast(MsgTypeCpUpgrade, buffer)
//记录socket,注意闭包问题
go func(userId uint64, msg *userProxy.CpUpgrade, rspUids []uint64, err error) {
buf, _ := json.Marshal(msg)
AddRpcLog(MsgTypeCpUpgrade, userId, string(buf[:]), rspUids, err)
}(0, msg, rspUids, err)
if err != nil {
mylogrus.MyLog.Errorf("grpc SendCpUpgrade send fail")
return err
} else {
mylogrus.MyLog.Info("grpc SendCpUpgrade send success")
}
} else {
return err
}
return nil
}
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