package inner import "errors" type OpenBoxRequest struct { AccessToken string OpenCount string } // 参数合法性检验 func (request *OpenBoxRequest) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.OpenCount) == 0 { err = errors.New("OpenCount不能为空") return } if request.OpenCount != "1" && request.OpenCount != "10" && request.OpenCount != "100" { err = errors.New("OpenCount非法") return } return }