32 lines
758 B
Go
32 lines
758 B
Go
package request
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitea.ddegame.cn/open/servicebase/pkg/htools"
|
|
)
|
|
|
|
// RevenueExchangeDiamondRequest 魅力值兑换钻石请求
|
|
type RevenueExchangeDiamondRequest struct {
|
|
AccessToken string
|
|
FromAmountType string
|
|
ToAmountType string
|
|
RevenueAmount string
|
|
}
|
|
|
|
// CheckParameter 参数合法性检验
|
|
func (request *RevenueExchangeDiamondRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
return errors.New("AccessToken不能为空")
|
|
}
|
|
if len(request.RevenueAmount) == 0 {
|
|
return errors.New("PageNo不能为空")
|
|
}
|
|
revenueInt := htools.StringToInt(request.RevenueAmount)
|
|
// 最多每次兑换500000
|
|
if revenueInt <= 0 || revenueInt > 1000000 {
|
|
return errors.New("参数不合法")
|
|
}
|
|
return
|
|
}
|