90 lines
2.2 KiB
Go
90 lines
2.2 KiB
Go
package request
|
||
|
||
import (
|
||
"encoding/json"
|
||
"errors"
|
||
)
|
||
|
||
// 申请技能请求
|
||
type SkillApplyRequest struct {
|
||
BaseRequest
|
||
GuildId string // 俱乐部ID
|
||
SkillId string // 技能ID
|
||
SkillCertImg string // 认证图片 -
|
||
SkillAudioUrl string // 音频 - 现在不需要传
|
||
AudioTime string // 音频时长 - 现在不需要传
|
||
SkillMode string // 游戏玩法 - 比如航天
|
||
SkillLevel string // 游戏等级 - 比如211
|
||
SkillConfigId string // 技能配置ID,这里传技能配置里面选择的等级的ID
|
||
GameRole string // 不要 - 现在不需要传
|
||
BriefDesc string // 备注
|
||
CompanionType string // 单配双配(根据技能上的 SpecialRequirements,如果包含 CompanionType 则需要传这个字段 single 和 double)
|
||
}
|
||
|
||
// 签名验证
|
||
func (request *SkillApplyRequest) CheckParameter() (err error) {
|
||
if len(request.AccessToken) == 0 {
|
||
return errors.New("AccessToken不能为空")
|
||
}
|
||
if len(request.SkillId) == 0 {
|
||
return errors.New("SkillId不能为空")
|
||
}
|
||
if len(request.GuildId) == 0 {
|
||
request.GuildId = "1"
|
||
}
|
||
return
|
||
}
|
||
|
||
// 申请技能请求
|
||
type SkillApplyV2Request struct {
|
||
BaseRequest
|
||
GuildId string // 俱乐部ID
|
||
SkillId string
|
||
SkillAudioUrl string
|
||
AudioTime string
|
||
ModeList string
|
||
Modes []SkillApplyV2ModeRequest `json:"-"`
|
||
}
|
||
|
||
type SkillApplyV2ModeRequest struct {
|
||
SkillCertImg string
|
||
SkillMode string
|
||
SkillLevel string
|
||
GameRole string
|
||
ConfigId string
|
||
BriefDesc string
|
||
CompanionType string // 陪玩类型 single double
|
||
}
|
||
|
||
// 签名验证
|
||
func (request *SkillApplyV2Request) CheckParameter() (err error) {
|
||
if len(request.AccessToken) == 0 {
|
||
return errors.New("AccessToken不能为空")
|
||
}
|
||
if len(request.SkillId) == 0 {
|
||
return errors.New("SkillId不能为空")
|
||
}
|
||
if len(request.ModeList) == 0 {
|
||
return errors.New("ModeList不能为空")
|
||
}
|
||
if err = json.Unmarshal([]byte(request.ModeList), &request.Modes); err != nil {
|
||
return errors.New("ModeList格式错误")
|
||
}
|
||
return
|
||
}
|
||
|
||
type SkillConfigRequest struct {
|
||
IdReq
|
||
GuildId string
|
||
}
|
||
|
||
type BaseGuildRequest struct {
|
||
BaseRequest
|
||
GuildId string
|
||
}
|
||
|
||
type GuildConfigRequest struct {
|
||
BaseGuildRequest
|
||
Key string
|
||
}
|