224 lines
4.7 KiB
Go
224 lines
4.7 KiB
Go
package request
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitea.ddegame.cn/open/servicebase/pkg/common"
|
|
"gitea.ddegame.cn/open/servicebase/pkg/tools"
|
|
)
|
|
|
|
type UserThreeFactorsCertifyRequest struct {
|
|
AccessToken string
|
|
TrueName string
|
|
CertNo string
|
|
}
|
|
|
|
func (request *UserThreeFactorsCertifyRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.TrueName) == 0 {
|
|
err = errors.New("TrueName不能为空")
|
|
return
|
|
}
|
|
if len(request.CertNo) == 0 {
|
|
err = errors.New("CertNo不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type UserFaceLiveCertifyApplyRequest struct {
|
|
AccessToken string
|
|
TrueName string
|
|
CertNo string
|
|
RedirectUrl string
|
|
}
|
|
|
|
func (request *UserFaceLiveCertifyApplyRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.TrueName) == 0 {
|
|
err = errors.New("TrueName不能为空")
|
|
return
|
|
}
|
|
if len(request.CertNo) == 0 {
|
|
err = errors.New("CertNo不能为空")
|
|
return
|
|
}
|
|
if len(request.RedirectUrl) == 0 {
|
|
err = errors.New("RedirectUrl不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type ReCheckLiveCertifyRequest struct {
|
|
AccessToken string
|
|
//TrueName string
|
|
//CertNo string
|
|
AuthToken string
|
|
}
|
|
|
|
func (request *ReCheckLiveCertifyRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.AuthToken) == 0 {
|
|
err = errors.New("AuthToken不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type UserFaceVerifyRequest struct {
|
|
AccessToken string
|
|
Metainfo string
|
|
}
|
|
|
|
func (request *UserFaceVerifyRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.Metainfo) == 0 {
|
|
err = errors.New("Metainfo不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type UserFaceVerifyVedioCommitRequest struct {
|
|
AccessToken string
|
|
AuthVedioUrl string
|
|
}
|
|
|
|
func (request *UserFaceVerifyVedioCommitRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.AuthVedioUrl) == 0 {
|
|
err = errors.New("AuthVedioUrl 不能为空")
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type UserFaceVerifyCommitRequest struct {
|
|
AccessToken string
|
|
CertifyId string
|
|
SkillId string
|
|
SkillMode string
|
|
SkillLevel string
|
|
SkillConfigId string
|
|
BriefDesc string
|
|
AuthVedioUrl string
|
|
}
|
|
|
|
func (request *UserFaceVerifyCommitRequest) CheckParameter() (err error) {
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
if len(request.CertifyId) == 0 {
|
|
err = errors.New("CertifyId不能为空")
|
|
return
|
|
}
|
|
// if len(request.SkillId) == 0 {
|
|
// err = errors.New("SkillId 不能为空")
|
|
// return
|
|
// }
|
|
// if len(request.SkillMode) == 0 {
|
|
// err = errors.New("SkillMode 不能为空")
|
|
// return
|
|
// }
|
|
// if len(request.SkillLevel) == 0 {
|
|
// err = errors.New("SkillLevel 不能为空")
|
|
// return
|
|
// }
|
|
// if len(request.SkillConfigId) == 0 {
|
|
// err = errors.New("SkillConfigId 不能为空")
|
|
// return
|
|
// }
|
|
// if len(request.AuthVedioUrl) == 0 {
|
|
// err = errors.New("AuthVedioUrl 不能为空")
|
|
// return
|
|
// }
|
|
return
|
|
}
|
|
|
|
type SellerFaceVerifyApplyRequest struct {
|
|
AccessToken string
|
|
SkillId string
|
|
SkillMode string
|
|
Contact string
|
|
}
|
|
|
|
type UserCertifyApplyRequest struct {
|
|
AccessToken string
|
|
CertifyType string
|
|
TrueName string
|
|
CertNo string
|
|
CertImgFront string
|
|
CertImgBacked string
|
|
CertImgInHand string
|
|
}
|
|
|
|
// 参数合法性检验
|
|
func (request *UserCertifyApplyRequest) CheckParameter() (err error) {
|
|
|
|
if len(request.AccessToken) == 0 {
|
|
err = errors.New("AccessToken不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.CertifyType) == 0 {
|
|
err = errors.New("CertifyType不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.TrueName) == 0 {
|
|
err = errors.New("TrueName不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.CertNo) == 0 {
|
|
err = errors.New("CertNo不能为空")
|
|
return
|
|
}
|
|
// 当前不允许国内用户使用该功能
|
|
if tools.IsChineseIDCard(request.CertNo) {
|
|
err = errors.New("请使用人脸认证方式")
|
|
return
|
|
}
|
|
// 只能是 1或2
|
|
if request.CertifyType != common.CERTIFY_TYPE_ZHIMA && request.CertifyType != common.CERTIFY_TYPE_RENGONG {
|
|
err = errors.New("CertifyType错误")
|
|
return
|
|
}
|
|
|
|
if request.CertifyType == common.CERTIFY_TYPE_RENGONG {
|
|
if len(request.CertImgFront) == 0 {
|
|
err = errors.New("CertImgFront不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.CertImgBacked) == 0 {
|
|
err = errors.New("CertImgBacked不能为空")
|
|
return
|
|
}
|
|
|
|
if len(request.CertImgInHand) == 0 {
|
|
err = errors.New("CertImgInHand不能为空")
|
|
return
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|