96 lines
2.3 KiB
Go
96 lines
2.3 KiB
Go
package request
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitea.ddegame.cn/open/servicebase/pkg/common/HyTools"
|
|
)
|
|
|
|
// 技能下单
|
|
type CreateGuildSkillOrderRequest struct {
|
|
AccessToken string
|
|
GuildId string
|
|
BuyerUserId string
|
|
UserSkillId string
|
|
BeginTime string
|
|
OrderCount string
|
|
OrderExt string
|
|
BuyerMemo string
|
|
PriceId string // 价格ID
|
|
ChatroomId string // 从哪个聊天室进来的下单
|
|
DispatchOrderId string // 当前聊天室的派单ID
|
|
DispatchHostUserId string // 当前聊天室的派单人
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *CreateGuildSkillOrderRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.UserSkillId) == 0 {
|
|
err = errors.New("UserSkillId不能为空")
|
|
return
|
|
}
|
|
// if len(request.BeginTime) == 0 {
|
|
// err = errors.New("BeginTime不能为空")
|
|
// return
|
|
// }
|
|
if len(request.OrderCount) == 0 {
|
|
err = errors.New("OrderCount不能为空")
|
|
return
|
|
}
|
|
if len(request.PriceId) == 0 {
|
|
err = errors.New("PriceId不能为空")
|
|
return
|
|
}
|
|
if HyTools.StringToFloat64(request.OrderCount) < 0 || HyTools.StringToFloat64(request.OrderCount) > 999 {
|
|
err = errors.New("OrderCount不合法")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// 技能下单-再来一单
|
|
type ReplicateSkillOrderRequest struct {
|
|
BaseOrderIdRequest
|
|
OrderCount string
|
|
BuyerMemo string
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *ReplicateSkillOrderRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.OrderCount) == 0 {
|
|
err = errors.New("OrderCount不能为空")
|
|
return
|
|
}
|
|
if HyTools.StringToFloat64(request.OrderCount) < 0 || HyTools.StringToFloat64(request.OrderCount) > 999 {
|
|
err = errors.New("OrderCount不合法")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type CreateSkillOrderDispatchRequest struct {
|
|
AccessToken string
|
|
DispatchOrderId string // 当前聊天室的派单ID
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *CreateSkillOrderDispatchRequest) CheckParameter() (err error) {
|
|
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.DispatchOrderId) == 0 {
|
|
err = errors.New("DispatchOrderId不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|