package gm_services

import (
	"gadmin/internal/admin/forms"
	"github.com/gin-gonic/gin"
)

func UpdateSwitcher(ctx *gin.Context, params forms.UpdateSwitcherReq) (err error) {

	/*if params.ServerId <= 0 {
		err = errors.New("请选择一个有效的服务器")
		return
	}

	DB, err := player.GetDBByServerID(params.ServerId)
	if err != nil {
		return
	}

	if params.IosPay >= 0 && params.PlayerLevel >= 1 && params.AndroidPay >= 0 && params.AndroidOpenLevel >= 1 {
		data := msg2.GmIosPay{
			MsgId:            character.GenerateMsgId(),
			IosPay:           params.IosPay,
			OpenLevel:        params.PlayerLevel,
			AndroidPay:       params.AndroidPay,
			AndroidOpenLevel: params.AndroidOpenLevel,
			OperatorId:       token.GetUID(ctx),
		}
		//err = gate.SendToWorld(0, &msg)
		//if err == nil {
		//	rpc_share.MsgMap[msg.MsgId] = fmt.Sprintf("%s,GM为修改支付开关 ios: %d, openLevel: %d", utility.FormatSecond(time.Now()), params.IosPay, params.PlayerLevel)
		//}

		rpc_share.MsgMap[data.MsgId] = fmt.Sprintf("%s,GM为修改支付开关 ios: %d, openLevel: %d", utility.FormatSecond(time.Now()), params.IosPay, params.PlayerLevel)

		var resp *msg2.ResponseGmIosPay
		res, err := config.GmNats.GmRequest(DB, "GmIosPay", data)
		if err != nil {
			return err
		}

		if err = json.Unmarshal(res, &resp); err != nil {
			return err
		}

		rpc_share.LogChan <- rpc_share.LogMsg{
			MsgID: data.MsgId,
			Data:  resp,
		}

	} else if params.DoubleAd >= 0 && params.AdOpenLevel >= 1 {
		data := msg2.GmDoubleAd{
			MsgId:      character.GenerateMsgId(),
			OpenLevel:  params.AdOpenLevel,
			AdCount:    params.DoubleAd,
			OperatorId: token.GetUID(ctx),
		}
		//err = gate.SendToWorld(0, &msg)
		//if err == nil {
		//	rpc_share.MsgMap[data.MsgId] = fmt.Sprintf("%s,GM为修改广告 adOpenLevel: %d, adCount: %d", utility.FormatSecond(time.Now()), params.AdOpenLevel, params.DoubleAd)
		//}

		rpc_share.MsgMap[data.MsgId] = fmt.Sprintf("%s,GM为修改广告 adOpenLevel: %d, adCount: %d", utility.FormatSecond(time.Now()), params.AdOpenLevel, params.DoubleAd)

		var resp *msg2.ResponseGmDoubleAd
		res, err := config.GmNats.GmRequest(DB, "GmDoubleAd", data)
		if err != nil {
			return err
		}

		if err = json.Unmarshal(res, &resp); err != nil {
			return err
		}

		rpc_share.LogChan <- rpc_share.LogMsg{
			MsgID: data.MsgId,
			Data:  resp,
		}

	} else {
		err = errors.New("参数不可用")
	}*/
	return
}
