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.
82 lines
2.7 KiB
82 lines
2.7 KiB
4 months ago
|
package serviceGame
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"strconv"
|
||
|
"tyj_admin/api/v1/game"
|
||
|
"tyj_admin/internal/serviceGame/internal"
|
||
|
)
|
||
|
|
||
|
type IGameSet interface {
|
||
|
DelAuditMode(ctx context.Context, req *game.DelAuditModeReq) (res *game.DelAuditModeRes, err error)
|
||
|
SetAuditMode(ctx context.Context, req *game.SetAuditModeReq) (res *game.SetAuditModeRes, err error)
|
||
|
GetAuditMode(ctx context.Context, req *game.AuditModeReq) (res *game.AuditModeRes, err error)
|
||
|
GetAllAuditMode(ctx context.Context, req *game.GetAllAuditModeReq) (res *game.GetAllAuditModeRes, err error)
|
||
|
}
|
||
|
|
||
|
type gameSetImpl struct {
|
||
|
}
|
||
|
|
||
|
var gameSetService = gameSetImpl{}
|
||
|
|
||
|
func GameSet() IGameSet {
|
||
|
return &gameSetService
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) DelAuditMode(ctx context.Context, req *game.DelAuditModeReq) (res *game.DelAuditModeRes, err error) {
|
||
|
res = new(game.DelAuditModeRes)
|
||
|
if req.Name == "" {
|
||
|
req.Name = "enableHotfix"
|
||
|
}
|
||
|
err = internal.DelAuditMode(ctx, req.Name, req.Label)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) SetAuditMode(ctx context.Context, req *game.SetAuditModeReq) (res *game.SetAuditModeRes, err error) {
|
||
|
res = new(game.SetAuditModeRes)
|
||
|
if req.Name == "" {
|
||
|
req.Name = "enableHotfix"
|
||
|
}
|
||
|
err = internal.SetSetEnable(ctx, req.Name, req.Channel+req.Version, req.AuditMode)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) GetAuditMode(ctx context.Context, req *game.AuditModeReq) (res *game.AuditModeRes, err error) {
|
||
|
res = new(game.AuditModeRes)
|
||
|
if internal.GetEnableHotfix(ctx, req.Channel+req.Version) != "" {
|
||
|
data, _ := strconv.Atoi(internal.GetEnableHotfix(ctx, req.Channel+req.Version))
|
||
|
res.AuditMode = int32(data)
|
||
|
} else if internal.GetEnableHotfix(ctx, req.Channel) != "" {
|
||
|
data, _ := strconv.Atoi(internal.GetEnableHotfix(ctx, req.Channel))
|
||
|
res.AuditMode = int32(data)
|
||
|
}
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) GetAllAuditMode(ctx context.Context, req *game.GetAllAuditModeReq) (res *game.GetAllAuditModeRes, err error) {
|
||
|
res = new(game.GetAllAuditModeRes)
|
||
|
if req.Name == "" {
|
||
|
req.Name = "enableHotfix"
|
||
|
}
|
||
|
res.List, err = internal.GetAllSetEnable(ctx, req.Name)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) GetAllowChannel(ctx context.Context, req *game.GetAllowChannelReq) (res *game.GetAllowChannelRes, err error) {
|
||
|
res = new(game.GetAllowChannelRes)
|
||
|
res.List, err = internal.GetAllowChannel(ctx)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) DelAllowChannel(ctx context.Context, req *game.DelAllowChannelReq) (res *game.DelAllowChannelRes, err error) {
|
||
|
res = new(game.DelAllowChannelRes)
|
||
|
err = internal.DelAllowChannel(ctx, req.Label)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
func (c *gameSetImpl) SetAllowChannel(ctx context.Context, req *game.SetAllowChannelReq) (res *game.SetAllowChannelRes, err error) {
|
||
|
res = new(game.SetAllowChannelRes)
|
||
|
err = internal.SetAllowChannel(ctx, req.Channel+req.Version, 1)
|
||
|
return
|
||
|
}
|