新增更新实名信息接口
This commit is contained in:
parent
d283be207b
commit
51e0eaec33
@ -3,6 +3,7 @@ package passport
|
|||||||
import (
|
import (
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -40,3 +41,17 @@ func (c *Client) GetUserRoleList(req *GetUserRoleListRequest) (response *GetUser
|
|||||||
err = c.DoAction(req, response)
|
err = c.DoAction(req, response)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EditCard
|
||||||
|
// 新增或修改实名信息
|
||||||
|
func (c *Client) EditCard(req EditCardRequestParam) (response string, err error) {
|
||||||
|
editCardRequest := CreateEditCardRequest(req)
|
||||||
|
createEditCardResponse := CreateEditCardResponse()
|
||||||
|
err = c.DoAction(editCardRequest, createEditCardResponse)
|
||||||
|
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
|
||||||
|
return createEditCardResponse.GetHttpContentString(), nil
|
||||||
|
} else if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return createEditCardResponse.GetHttpContentString(), nil
|
||||||
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package passport
|
package passport
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
// 单元测试
|
// 单元测试
|
||||||
|
|
||||||
@ -31,3 +33,30 @@ func TestGetUserRoleList(t *testing.T) {
|
|||||||
t.Logf("resp code:%+v", resp.Code)
|
t.Logf("resp code:%+v", resp.Code)
|
||||||
t.Logf("resp data:%+v", resp.Data)
|
t.Logf("resp data:%+v", resp.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestEditCard(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
editCardRequest := EditCardRequestParam{
|
||||||
|
Uid: 32455414,
|
||||||
|
GameId: 5010,
|
||||||
|
Imei: "11111111",
|
||||||
|
IsReal: 0,
|
||||||
|
DirectStatus: 1,
|
||||||
|
AuthChannel: "gjfcm_wzcq",
|
||||||
|
DirectExtData: "测试测试测试",
|
||||||
|
Pi: "",
|
||||||
|
Ip: "",
|
||||||
|
Ipv6: "",
|
||||||
|
UserName: "asfasfd",
|
||||||
|
RealName: "这艘啊",
|
||||||
|
IdCard: "33032419950123532X",
|
||||||
|
Mandatory: "3123123123",
|
||||||
|
}
|
||||||
|
editCardResponse, err := client.EditCard(editCardRequest)
|
||||||
|
t.Logf("%v", editCardResponse)
|
||||||
|
|
||||||
|
}
|
||||||
|
97
services/passport/weedong.go
Normal file
97
services/passport/weedong.go
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package passport
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"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"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
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"`
|
||||||
|
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"`
|
||||||
|
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"`
|
||||||
|
IsDirect int64 `position:"Body" field:"is_direct"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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: 0,
|
||||||
|
//
|
||||||
|
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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user