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.

45 lines
1.1 KiB

4 months ago
package controller
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"tyj_admin/api/v1/game"
"tyj_admin/internal/serviceGame"
"tyj_admin/library/libUtils"
"tyj_admin/utils"
)
var OutCCD = outCcdController{}
type outCcdController struct {
BaseController
}
func (c *outCcdController) AddCCD(ctx context.Context, req *game.AddOutCCDReq) (res *game.AddOutCCDRes, err error) {
ip := libUtils.GetClientIp(ctx)
//fmt.Println("AddCCD ---》 ip: ", ip)
if !utils.TopIpWhiteList(ip) {
return nil, gerror.New("ip黑名单!")
}
/*
req1 := new(game.GetGameNoticeReq)
res1 := new(game.GetGameNoticeRes)
req1.NoticeType = 3
req1.Channel = req.ChannelType
res1, err = serviceGame.GameNotice().GetGameNotice(ctx, req1)
if res1.Status != 1 {
return nil, gerror.New("ip黑名单!")
}
*/
reqn := new(game.AddCCDReq)
reqn.Ip = req.Ip
reqn.ChannelType = req.ChannelType
reqn.HotfixVersion = req.HotfixVersion
reqn.VersionName = req.VersionName
reqn.Platform = req.Platform
reqn.VersionCode = req.VersionCode
reqn.State = req.State
_, err = serviceGame.GameCCD().AddCCD(ctx, reqn)
return
}