封装 weedong.php 的 del_user_auth 动作,清空分表 true_name/id_card 并删除 user_real_auth 记录,仅需传 user_name,远端返回 ok 即成功。
140 lines
4.5 KiB
Go
140 lines
4.5 KiB
Go
package passport
|
||
|
||
import (
|
||
"fmt"
|
||
"time"
|
||
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
|
||
)
|
||
|
||
const weeDongKey = "aVCxX2B3yswpxCMjaaSUHFXAzLYyuGhW"
|
||
|
||
func weeDongGetSign(ts int64) string {
|
||
return utils.Md5(utils.Md5(fmt.Sprintf("%d", ts)+weeDongKey) + weeDongKey)
|
||
}
|
||
|
||
type EditCardRequestParam struct {
|
||
Uid int64 `position:"Body" field:"uid"`
|
||
GameId int64 `position:"Body" field:"game_id"`
|
||
Imei string `position:"Body" field:"imei"`
|
||
IsReal int64 `position:"Body" field:"is_real"`
|
||
IsDirect int64 `position:"Body" field:"is_direct"`
|
||
DirectStatus int64 `position:"Body" field:"direct_status"`
|
||
AuthChannel string `position:"Body" field:"auth_channel"`
|
||
DirectExtData string `position:"Body" field:"direct_ext_data"`
|
||
Pi string `position:"Body" field:"pi"`
|
||
Ip string `position:"Body" field:"ip"`
|
||
Ipv6 string `position:"Body" field:"ipv6"`
|
||
UserName string `position:"Body" field:"user_name"`
|
||
RealName string `position:"Body" field:"truename"`
|
||
IdCard string `position:"Body" field:"idcard"`
|
||
Mandatory string `position:"Body" field:"mandatory"`
|
||
}
|
||
|
||
type EditCardResponse struct {
|
||
*responses.BaseResponse
|
||
}
|
||
|
||
type EditCardRequest struct {
|
||
*requests.RpcRequest
|
||
Uid int64 `position:"Body" field:"uid"`
|
||
GameId int64 `position:"Body" field:"game_id"`
|
||
Imei string `position:"Body" field:"imei"`
|
||
IsReal int64 `position:"Body" field:"is_real"`
|
||
IsDirect int64 `position:"Body" field:"is_direct"`
|
||
DirectStatus int64 `position:"Body" field:"direct_status"`
|
||
AuthChannel string `position:"Body" field:"auth_channel"`
|
||
DirectExtData string `position:"Body" field:"direct_ext_data"`
|
||
Pi string `position:"Body" field:"pi"`
|
||
Ip string `position:"Body" field:"ip"`
|
||
Ipv6 string `position:"Body" field:"ipv6"`
|
||
UserName string `position:"Body" field:"user_name"`
|
||
RealName string `position:"Body" field:"truename"`
|
||
IdCard string `position:"Body" field:"idcard"`
|
||
Mandatory string `position:"Body" field:"mandatory"`
|
||
Action string `position:"Body" field:"action"`
|
||
Flag string `position:"Body" field:"flag"`
|
||
Time string `position:"Body" field:"time"`
|
||
}
|
||
|
||
// CreateEditCardRequest 记录实名结果接口
|
||
func CreateEditCardRequest(param EditCardRequestParam) (req *EditCardRequest) {
|
||
ts := time.Now().Unix()
|
||
sign := weeDongGetSign(ts)
|
||
|
||
req = &EditCardRequest{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
Action: "edit_card",
|
||
Flag: sign,
|
||
Time: fmt.Sprintf("%v", ts),
|
||
IsDirect: param.IsDirect,
|
||
Uid: param.Uid,
|
||
GameId: param.GameId,
|
||
Imei: param.Imei,
|
||
IsReal: param.IsReal,
|
||
DirectStatus: param.DirectStatus,
|
||
AuthChannel: param.AuthChannel,
|
||
DirectExtData: param.DirectExtData,
|
||
Pi: param.Pi,
|
||
Ip: param.Ip,
|
||
Ipv6: param.Ipv6,
|
||
UserName: param.UserName,
|
||
RealName: param.RealName,
|
||
IdCard: param.IdCard,
|
||
Mandatory: param.Mandatory,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||
req.Method = requests.POST
|
||
return
|
||
}
|
||
|
||
func CreateEditCardResponse() (response *EditCardResponse) {
|
||
response = &EditCardResponse{
|
||
BaseResponse: &responses.BaseResponse{},
|
||
}
|
||
return
|
||
}
|
||
|
||
type DelUserAuthRequestParam struct {
|
||
UserName string `position:"Body" field:"user_name"`
|
||
}
|
||
|
||
type DelUserAuthResponse struct {
|
||
*responses.BaseResponse
|
||
}
|
||
|
||
type DelUserAuthRequest struct {
|
||
*requests.RpcRequest
|
||
UserName string `position:"Body" field:"user_name"`
|
||
Action string `position:"Body" field:"action"`
|
||
Flag string `position:"Body" field:"flag"`
|
||
Time string `position:"Body" field:"time"`
|
||
}
|
||
|
||
// CreateDelUserAuthRequest 清除用户实名信息接口
|
||
// 远端会清空分表 user_X 的 true_name、id_card,并删除 user_real_auth 整条记录,只需传 user_name
|
||
func CreateDelUserAuthRequest(param DelUserAuthRequestParam) (req *DelUserAuthRequest) {
|
||
ts := time.Now().Unix()
|
||
sign := weeDongGetSign(ts)
|
||
|
||
req = &DelUserAuthRequest{
|
||
RpcRequest: &requests.RpcRequest{},
|
||
Action: "del_user_auth",
|
||
Flag: sign,
|
||
Time: fmt.Sprintf("%v", ts),
|
||
UserName: param.UserName,
|
||
}
|
||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||
req.Method = requests.POST
|
||
return
|
||
}
|
||
|
||
func CreateDelUserAuthResponse() (response *DelUserAuthResponse) {
|
||
response = &DelUserAuthResponse{
|
||
BaseResponse: &responses.BaseResponse{},
|
||
}
|
||
return
|
||
}
|