| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- package proto
- import (
- "bet24.com/log"
- "bet24.com/servers/micros/common"
- "context"
- )
- type CreateSimpleMatch_req struct {
- Request
- GameId int
- GameRule string
- TotalUser int
- TableUser int
- Target int
- EnrollFee int
- Prize int
- PlayTime int
- ElimiantedByScore bool
- WinnerCount int
- }
- type SimpleMatch_req struct {
- Request
- MatchNo int
- }
- type EnrollSimpleMatch_req struct {
- SimpleMatch_req
- NickName string
- FaceId int
- FaceUrl string
- }
- func CreateSimpleMatch(userId int, gameId int, gameRule string, totalUserCount int,
- target int, tableUserCount int, enrollFee int, prize int, playTime int) (int, string) {
- var req CreateSimpleMatch_req
- req.UserId = userId
- req.GameId = gameId
- req.GameRule = gameRule
- req.TotalUser = totalUserCount
- req.TableUser = tableUserCount
- req.Target = target
- req.EnrollFee = enrollFee
- req.Prize = prize
- req.PlayTime = playTime
- reply := &Response{}
- err := getClient().Call(context.Background(), "CreateSimpleMatch", &req, reply)
- if err != nil {
- log.Debug("matches.CreateSimpleMatch failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return 0, "server error"
- }
- return reply.RetCode, reply.Data
- }
- func CloseSimpleMatch(userId int, matchNo int) (int, string) {
- var req SimpleMatch_req
- req.UserId = userId
- req.MatchNo = matchNo
- reply := &Response{}
- err := getClient().Call(context.Background(), "CloseSimpleMatch", &req, reply)
- if err != nil {
- log.Debug("matches.CloseSimpleMatch failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return 0, "server error"
- }
- return reply.RetCode, reply.Data
- }
- func EnrollSimpleMatch(userId int, matchNo int, nickname string, faceId int, faceUrl string) (int, string) {
- var req EnrollSimpleMatch_req
- req.UserId = userId
- req.MatchNo = matchNo
- req.NickName = nickname
- req.FaceId = faceId
- req.FaceUrl = faceUrl
- reply := &Response{}
- err := getClient().Call(context.Background(), "EnrollSimpleMatch", &req, reply)
- if err != nil {
- log.Debug("matches.EnrollSimpleMatch failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return 0, "server error"
- }
- return reply.RetCode, reply.Data
- }
- func QuitSimpleMatch(userId int, matchNo int) bool {
- var req SimpleMatch_req
- req.UserId = userId
- req.MatchNo = matchNo
- reply := &Response{}
- err := getClient().Call(context.Background(), "QuitSimpleMatch", &req, reply)
- if err != nil {
- log.Debug("matches.QuitSimpleMatch failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return false
- }
- return reply.BoolValue
- }
- func GetSimpleMatchInfo(matchNo int) string {
- log.Debug("GetSimpleMatchInfo %d", matchNo)
- var req SimpleMatch_req
- req.MatchNo = matchNo
- reply := &Response{}
- err := getClient().Call(context.Background(), "GetSimpleMatchInfo", &req, reply)
- if err != nil {
- log.Debug("matches.GetSimpleMatchInfo failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return ""
- }
- return reply.Data
- }
- func GetUserSimpleMatches(userId int) string {
- log.Debug("GetUserSimpleMatches %d", userId)
- var req Request
- req.UserId = userId
- reply := &Response{}
- err := getClient().Call(context.Background(), "GetUserSimpleMatches", &req, reply)
- if err != nil {
- log.Debug("matches.GetUserSimpleMatches failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return ""
- }
- return reply.Data
- }
- func GetSimpleMatchConfigs() string {
- reply := &Response{}
- err := getClient().Call(context.Background(), "GetSimpleMatchConfigs", nil, reply)
- if err != nil {
- log.Debug("matches.GetSimpleMatchConfigs failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return ""
- }
- return reply.Data
- }
- func GetEnrolledSimpleMatch(userId int) string {
- var req Request
- req.UserId = userId
- reply := &Response{}
- err := getClient().Call(context.Background(), "GetEnrolledSimpleMatch", req, reply)
- if err != nil {
- log.Debug("matches.GetEnrolledSimpleMatch failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return ""
- }
- return reply.Data
- }
- func GetSimpleMatchHistory(userId int) string {
- var req Request
- req.UserId = userId
- reply := &Response{}
- err := getClient().Call(context.Background(), "GetSimpleMatchHistory", req, reply)
- if err != nil {
- log.Debug("matches.GetSimpleMatchHistory failed to call: %v", err)
- common.GetClientPool().RemoveClient(ServiceName)
- return ""
- }
- return reply.Data
- }
|