66 lines
1.3 KiB
Go
66 lines
1.3 KiB
Go
package request
|
||
|
||
import (
|
||
"errors"
|
||
|
||
"gitea.ddegame.cn/open/servicebase/pkg/common/HyTools"
|
||
)
|
||
|
||
// 聊天室赠送活动礼物的请求
|
||
type PresentActivityGiftFromChatRoomRequest struct {
|
||
BaseRequest
|
||
ChatroomId string
|
||
ReceiveUserIds string // 赠送的目标用户ID列表,json字符串数组
|
||
Count string // 礼物数量
|
||
ActId string
|
||
ActPrice string
|
||
HostUserId string // 主持人ID
|
||
IsBatch string // 0=打赏个人 1= 打赏全麦
|
||
}
|
||
|
||
// 注册用户信息签名验证
|
||
func (request *PresentActivityGiftFromChatRoomRequest) CheckParameter() (err error) {
|
||
|
||
if len(request.AccessToken) == 0 {
|
||
err = errors.New("AccessToken不能为空")
|
||
return
|
||
}
|
||
|
||
if len(request.ChatroomId) == 0 {
|
||
err = errors.New("ChatroomRoomId不能为空")
|
||
return
|
||
}
|
||
|
||
if len(request.ReceiveUserIds) == 0 {
|
||
err = errors.New("ReceiveUserIds不能为空")
|
||
return
|
||
}
|
||
|
||
if len(request.Count) == 0 {
|
||
err = errors.New("Count不能为空")
|
||
return
|
||
}
|
||
|
||
if len(request.ActId) == 0 {
|
||
err = errors.New("ActId不能为空")
|
||
return
|
||
}
|
||
|
||
if len(request.IsBatch) == 0 {
|
||
err = errors.New("IsBatch不能为空")
|
||
return
|
||
}
|
||
|
||
if request.IsBatch != "0" && request.IsBatch != "1" {
|
||
err = errors.New("IsBatch只能是0或1")
|
||
return
|
||
}
|
||
|
||
if HyTools.StringToInt(request.ActPrice) <= 0 {
|
||
err = errors.New("ActPrice不合法")
|
||
return
|
||
}
|
||
|
||
return
|
||
}
|