92 lines
1.8 KiB
Go
92 lines
1.8 KiB
Go
package request
|
|
|
|
import "errors"
|
|
|
|
// 代理用户登录
|
|
type AgentUserLoginRequest struct {
|
|
AgentId string `json:"agentId"`
|
|
Uid string `json:"uid"`
|
|
UserName string `json:"userName"`
|
|
Gender string `json:"gender"`
|
|
Mobile string `json:"mobile"`
|
|
Signature string `json:"signature"`
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *AgentUserLoginRequest) CheckParameter() (err error) {
|
|
// 代理用户的ID
|
|
if len(request.AgentId) == 0 {
|
|
err = errors.New("agentId不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.Uid) == 0 {
|
|
err = errors.New("uid不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.UserName) == 0 {
|
|
err = errors.New("userName不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.Gender) == 0 {
|
|
err = errors.New("gender不能为空")
|
|
return
|
|
}
|
|
if len(request.Signature) == 0 {
|
|
err = errors.New("signature不能为空")
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// 内部用户登录
|
|
type InnerUserLoginRequest struct {
|
|
Mobile string `json:"mobile"`
|
|
Signature string `json:"signature"`
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *InnerUserLoginRequest) CheckParameter() (err error) {
|
|
// 代理用户的ID
|
|
if len(request.Mobile) == 0 {
|
|
err = errors.New("agentId不能为空")
|
|
return
|
|
}
|
|
if len(request.Signature) == 0 {
|
|
err = errors.New("signature不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// 代理获取推广房间
|
|
type AgentPromoteRoomRequest struct {
|
|
AgentId string `json:"agentId"`
|
|
AccessToken string `json:"accessToken"`
|
|
Signature string `json:"signature"`
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *AgentPromoteRoomRequest) CheckParameter() (err error) {
|
|
// 代理用户的ID
|
|
if len(request.AgentId) == 0 {
|
|
err = errors.New("未登录不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("token不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.Signature) == 0 {
|
|
err = errors.New("signature不能为空")
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|