印度包网
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.

131 lines
3.3 KiB

1 year ago
package all
import (
"reflect"
"server/call"
"server/common"
"server/db"
"server/modules/web/providers/awc"
"server/modules/web/providers/base"
"server/modules/web/providers/gs"
"server/modules/web/providers/pgsoft"
"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)
}
var All = &AllProvider{}
func initAll() {
All.Tada = tada.NewSub
All.Sexy = awc.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
}
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)})
}