You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
4.1 KiB
158 lines
4.1 KiB
package all |
|
|
|
import ( |
|
"reflect" |
|
"server/call" |
|
"server/common" |
|
"server/db" |
|
"server/modules/web/providers/base" |
|
"server/modules/web/providers/gs" |
|
"server/modules/web/providers/jili2" |
|
"server/modules/web/providers/jin" |
|
"server/modules/web/providers/jin2" |
|
"server/modules/web/providers/pg2" |
|
"server/modules/web/providers/pg3" |
|
"server/modules/web/providers/pg4" |
|
"server/modules/web/providers/pgsoft" |
|
"server/modules/web/providers/sn" |
|
"server/modules/web/providers/tada" |
|
|
|
"github.com/gin-gonic/gin" |
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
type AllProvider struct { |
|
Invalid struct{} |
|
InHouse func(b *base.Base) |
|
Tada func(b *base.Base) |
|
Sexy func(b *base.Base) |
|
PGSoft func(b *base.Base) |
|
EvolutionGaming func(b *base.Base) |
|
AllBet func(b *base.Base) |
|
BigGaming func(b *base.Base) |
|
SAGaming func(b *base.Base) |
|
PragmaticPlay func(b *base.Base) |
|
CQ9 func(b *base.Base) |
|
PlayTech func(b *base.Base) |
|
Joker func(b *base.Base) |
|
DragonSoft func(b *base.Base) |
|
TFGaming func(b *base.Base) |
|
WMCasino func(b *base.Base) |
|
King855 func(b *base.Base) |
|
AMAYA func(b *base.Base) |
|
Habanero func(b *base.Base) |
|
IBC func(b *base.Base) |
|
Reevo func(b *base.Base) |
|
EvoPlay func(b *base.Base) |
|
PlayStar func(b *base.Base) |
|
DreamGaming func(b *base.Base) |
|
Nexus4D func(b *base.Base) |
|
SlotXo func(b *base.Base) |
|
BTI func(b *base.Base) |
|
Ezugi func(b *base.Base) |
|
Jili func(b *base.Base) |
|
JDB func(b *base.Base) |
|
CMD368 func(b *base.Base) |
|
SBO func(b *base.Base) |
|
PG2 func(b *base.Base) |
|
Jili2 func(b *base.Base) |
|
PG3 func(b *base.Base) |
|
Jin func(b *base.Base) |
|
Jin2 func(b *base.Base) |
|
Sn func(b *base.Base) |
|
PG4 func(b *base.Base) |
|
} |
|
|
|
var All = &AllProvider{} |
|
|
|
func initAll() { |
|
All.Tada = tada.NewSub |
|
All.Sexy = gs.NewSub |
|
pg := call.GetConfigGameProvider(common.ProviderPGSoft) |
|
if pg != nil && pg.Callback == "gs" { |
|
All.PGSoft = gs.NewSub |
|
} else { |
|
All.PGSoft = pgsoft.NewSub |
|
} |
|
All.EvolutionGaming = gs.NewSub |
|
All.AllBet = gs.NewSub |
|
All.BigGaming = gs.NewSub |
|
All.SAGaming = gs.NewSub |
|
All.PragmaticPlay = gs.NewSub |
|
All.CQ9 = gs.NewSub |
|
All.PlayTech = gs.NewSub |
|
All.Joker = gs.NewSub |
|
All.DragonSoft = gs.NewSub |
|
All.TFGaming = gs.NewSub |
|
All.WMCasino = gs.NewSub |
|
All.King855 = gs.NewSub |
|
All.AMAYA = gs.NewSub |
|
All.Habanero = gs.NewSub |
|
All.IBC = gs.NewSub |
|
All.Reevo = gs.NewSub |
|
All.EvoPlay = gs.NewSub |
|
All.PlayStar = gs.NewSub |
|
All.DreamGaming = gs.NewSub |
|
All.Nexus4D = gs.NewSub |
|
All.SlotXo = gs.NewSub |
|
All.BTI = gs.NewSub |
|
All.Ezugi = gs.NewSub |
|
All.Jili = gs.NewSub |
|
All.JDB = gs.NewSub |
|
All.CMD368 = gs.NewSub |
|
All.SBO = gs.NewSub |
|
All.PG2 = pg2.NewSub |
|
All.Jili2 = jili2.NewSub |
|
All.PG3 = pg3.NewSub |
|
All.Jin = jin.NewSub |
|
All.Jin2 = jin2.NewSub |
|
All.Sn = sn.NewSub |
|
All.PG4 = pg4.NewSub |
|
} |
|
|
|
func InitRouter(r *gin.RouterGroup) { |
|
initAll() |
|
pathMap := map[string]struct{}{} |
|
for i := common.ProviderZero + 2; i < common.ProviderAll; i++ { |
|
b := &base.Base{Provider: call.GetConfigGameProvider(i)} |
|
if b.Provider == nil { |
|
continue |
|
} |
|
path := b.Provider.Callback |
|
if path == "" { |
|
path = b.Provider.ProviderName |
|
} |
|
if _, ok := pathMap[path]; ok { |
|
continue |
|
} |
|
pathMap[path] = struct{}{} |
|
NewSub(b, i) |
|
b.Sub.Init() |
|
sub := r.Group(path) |
|
b.SubInitRouter(sub) |
|
} |
|
} |
|
|
|
func EnterGame(req *base.EnterGameReq) string { |
|
provider := call.GetConfigGameProvider(req.ProviderID) |
|
if provider == nil { |
|
return "" |
|
} |
|
if err := db.Redis().SetData(common.GetRedisKeyGameCurrency(req.UID), int(req.CurrencyType), common.RedisExpireGameEnter); err != nil { |
|
log.Error("err:%v", err) |
|
return "" |
|
} |
|
b := &base.Base{Provider: provider} |
|
b.EnterGameReq = req |
|
NewSub(b, req.ProviderID) |
|
return b.Sub.EnterGame() |
|
} |
|
|
|
func NewSub(b *base.Base, index int) { |
|
ref := reflect.ValueOf(All).Elem().Field(index) |
|
if !ref.IsValid() { |
|
log.Error("invalid index:%v", index) |
|
return |
|
} |
|
ref.Call([]reflect.Value{reflect.ValueOf(b)}) |
|
}
|
|
|