40 lines
739 B
Go
40 lines
739 B
Go
package inner
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitea.ddegame.cn/open/servicebase/pkg/common/HyTools"
|
|
)
|
|
|
|
type AttackBossRequest struct {
|
|
AccessToken string
|
|
RoomId string
|
|
BossId string
|
|
AttackCount string
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *AttackBossRequest) CheckParameter() (err error) {
|
|
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("UserId不能为空")
|
|
return
|
|
}
|
|
if len(request.BossId) == 0 {
|
|
err = errors.New("BossId不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.AttackCount) == 0 {
|
|
err = errors.New("AttackCount不能为空")
|
|
return
|
|
}
|
|
|
|
if HyTools.StringToInt(request.AttackCount) < 1 || HyTools.StringToInt(request.AttackCount) > 100000 {
|
|
err = errors.New("AttackCount不合法")
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|