package request import ( "errors" "unicode/utf8" ) type BuyerRateSkillOrderRequest struct { AccessToken string OrderId string RateScore string RateContent string IsHidden string ImageUrl string } // 参数合法性检验 func (request *BuyerRateSkillOrderRequest) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.OrderId) == 0 { err = errors.New("OrderId不能为空") return } if len(request.RateScore) == 0 { err = errors.New("RateScore不能为空") return } return } type BuyerDelRateSkillOrderRequest struct { AccessToken string RateID string } // 参数合法性检验 func (request *BuyerDelRateSkillOrderRequest) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.RateID) == 0 { err = errors.New("RateID不能为空") return } return } type ReplyRateSkillOrderReq struct { AccessToken string RateId string OrderId string Content string ToReplyID string ReplyRole string // seller、buyer ImageUrl string } // CheckParameter 参数合法性检验 func (request *ReplyRateSkillOrderReq) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.RateId) == 0 { err = errors.New("RateId不能为空") return } if len(request.OrderId) == 0 { err = errors.New("OrderID不能为空") return } if len(request.Content) == 0 { err = errors.New("Content不能为空") return } if utf8.RuneCountInString(request.Content) > 300 { err = errors.New("Content不能超过300字") return } if request.ReplyRole != "seller" && request.ReplyRole != "buyer" { err = errors.New("ReplyRole错误") return } return } type DelReplyRateSkillOrderReq struct { AccessToken string ReplyID string } // CheckParameter 参数合法性检验 func (request *DelReplyRateSkillOrderReq) CheckParameter() (err error) { if len(request.AccessToken) == 0 { err = errors.New("AccessToken不能为空") return } if len(request.ReplyID) == 0 { err = errors.New("ReplyID不能为空") return } return }