Merge branch 'refs/heads/master' into develop/yuxh/msdk
This commit is contained in:
commit
28d51baaab
@ -88,3 +88,24 @@ func (c *Client) GetGameVersion(req *GetGameVersionReq) (resp *GetGameVersionRes
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfig 获取游戏全局配置
|
||||
func (c *Client) GetConfig(req *GetConfigReq) (resp *GetConfigResp, err error) {
|
||||
resp = CreateGetConfigResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetRealAuthBlackList 获取实名黑名单
|
||||
func (c *Client) GetRealAuthBlackList(req *GetRealAuthBlackListReq) (resp *GetRealAuthBlackListResp, err error) {
|
||||
resp = CreateGetRealAuthBlackListResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameRealAuthInfo 获取实名参数
|
||||
func (c *Client) GetGameRealAuthInfo(req *GetGameRealAuthInfoReq) (resp *GetGameRealAuthInfoResp, err error) {
|
||||
resp = CreateGetGameRealAuthInfoResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
@ -134,3 +134,48 @@ func TestIsBlockOutIos(t *testing.T) {
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取游戏全局配置
|
||||
func TestGetConfig(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getConfigReq := CreateGetConfigReq("overlord_act_config")
|
||||
isBlockOutIos, err := client.GetConfig(getConfigReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取实名黑名单
|
||||
func TestGetRealAuthBlackList(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getRealAuthBlackListReq := CreateGetRealAuthBlackListReq()
|
||||
isBlockOutIos, err := client.GetRealAuthBlackList(getRealAuthBlackListReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取游戏实名参数
|
||||
func TestGetGameRealAuthInfo(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getGameRealAuthInfoReq := CreateGetGameRealAuthInfoReq(7081)
|
||||
isBlockOutIos, err := client.GetGameRealAuthInfo(getGameRealAuthInfoReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
@ -315,3 +315,123 @@ func CreateGetGameVersionResp() *GetGameVersionResp {
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetConfigReq
|
||||
// 游戏全局配置
|
||||
type GetConfigReq struct {
|
||||
*requests.RpcRequest
|
||||
Key string `position:"Query" field:"key" default:"-" `
|
||||
}
|
||||
|
||||
type GetConfigRespData struct {
|
||||
Id int `json:"id"`
|
||||
Key string `json:"key"`
|
||||
ExtData string `json:"ext_data"`
|
||||
}
|
||||
type GetConfigResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetConfigRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetConfigReq(key string) *GetConfigReq {
|
||||
req := &GetConfigReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.Key = key
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getConfig")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetConfigResp() *GetConfigResp {
|
||||
return &GetConfigResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetRealAuthBlackListReq
|
||||
// 获取实名黑名单
|
||||
type GetRealAuthBlackListReq struct {
|
||||
*requests.RpcRequest
|
||||
Key string `position:"Query" field:"key" default:"-" `
|
||||
}
|
||||
|
||||
type GetRealAuthBlackListRespDataItem struct {
|
||||
Id int `json:"id"`
|
||||
TrueName string `json:"true_name"`
|
||||
IdCard string `json:"id_card"`
|
||||
Remark string `json:"remark"`
|
||||
CreateBy string `json:"create_by"`
|
||||
UpdateBy string `json:"update_by"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
type GetRealAuthBlackListResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []GetRealAuthBlackListRespDataItem `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetRealAuthBlackListReq() *GetRealAuthBlackListReq {
|
||||
req := &GetRealAuthBlackListReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getRealAuthBlackList")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetRealAuthBlackListResp() *GetRealAuthBlackListResp {
|
||||
return &GetRealAuthBlackListResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetGameRealAuthInfoReq
|
||||
// 获取实名参数
|
||||
type GetGameRealAuthInfoReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Body" field:"game_id" default:"-" `
|
||||
}
|
||||
|
||||
type GetGameRealAuthInfoRespData struct {
|
||||
GroupName string `json:"group_name"`
|
||||
GroupDescription int `json:"group_description"`
|
||||
VerifiedTime string `json:"verified_time"`
|
||||
AreaProvince string `json:"area_province"`
|
||||
VersionInfo string `json:"version_info"`
|
||||
IsReal int `json:"is_real"`
|
||||
IsDirect int `json:"is_direct"`
|
||||
AuthChannel string `json:"auth_channel"`
|
||||
StandbyAuthChannel string `json:"standby_auth_channel"`
|
||||
ProtectTime int `json:"protect_time"`
|
||||
GovIoReport int `json:"gov_io_report"`
|
||||
MinorBan int `json:"minor_ban"`
|
||||
}
|
||||
|
||||
type GetGameRealAuthInfoResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetGameRealAuthInfoRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetGameRealAuthInfoReq(gameId int64) *GetGameRealAuthInfoReq {
|
||||
req := &GetGameRealAuthInfoReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: gameId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/login/getGameRealAuthInfo")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameRealAuthInfoResp() *GetGameRealAuthInfoResp {
|
||||
return &GetGameRealAuthInfoResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,22 @@ func (c *Client) SendSms(req *SendSmsRequest) (resp *SendSmsResponse, err error)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) SendSmsV2(req *SendSmsRequestV2) (resp *SendSmsResponseV2, err error) {
|
||||
|
||||
if req.Phone == "" {
|
||||
err = errors.New("phone is empty")
|
||||
return
|
||||
}
|
||||
|
||||
if req.Type == "" {
|
||||
err = errors.New("type is empty")
|
||||
return
|
||||
}
|
||||
resp = CreateSendSmsResponseV2()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func getToken(key string) (ts int64, token string) {
|
||||
ts = time.Now().Unix()
|
||||
hash := md5.New()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package sms
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"testing"
|
||||
@ -140,3 +141,30 @@ func TestClient_SendSmsUrl(t *testing.T) {
|
||||
|
||||
fmt.Println(sms)
|
||||
}
|
||||
|
||||
func TestClient_SendSmsCodeV2(t *testing.T) {
|
||||
req := CreateSendSmsRequestV2(SendSmsParamV2{
|
||||
Phone: "18320021439",
|
||||
Type: SmsTypeRegister,
|
||||
Replaces: []Item{{
|
||||
Key: ReplaceKeyCode,
|
||||
Value: "6379",
|
||||
}, {
|
||||
Key: ReplaceKeySecond,
|
||||
Value: "120",
|
||||
}},
|
||||
Company: "",
|
||||
Ip: "192.168.1.103",
|
||||
})
|
||||
|
||||
sms, err := client.SendSmsV2(req)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
marshal, err := json.Marshal(sms)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(marshal))
|
||||
}
|
||||
|
@ -29,6 +29,20 @@ type SendSmsResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
type SendSmsRequestV2 struct {
|
||||
*requests.JsonRequest
|
||||
Phone string `position:"Json" field:"phone"`
|
||||
Type string `position:"Json" field:"type"`
|
||||
Replaces []Item `position:"Json" field:"replaces"`
|
||||
Company string `position:"Json" field:"company"`
|
||||
Ip string `position:"Json" field:"ip"`
|
||||
}
|
||||
|
||||
type SendSmsResponseV2 struct {
|
||||
*responses.BaseResponse
|
||||
TraceID string `json:"trace_id"`
|
||||
}
|
||||
|
||||
type SmsType = string
|
||||
|
||||
const (
|
||||
@ -44,6 +58,14 @@ type SendSmsParam struct {
|
||||
Replaces []Item
|
||||
}
|
||||
|
||||
type SendSmsParamV2 struct {
|
||||
Phone string // 手机号
|
||||
Type SmsType // 验证码类型
|
||||
Replaces []Item
|
||||
Company string // 子游戏公司主体
|
||||
Ip string // ip
|
||||
}
|
||||
|
||||
func CreateSendSmsRequest(param SendSmsParam) (req *SendSmsRequest) {
|
||||
req = &SendSmsRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
@ -62,3 +84,24 @@ func CreateSendSmsResponse() (resp *SendSmsResponse) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func CreateSendSmsRequestV2(param SendSmsParamV2) (req *SendSmsRequestV2) {
|
||||
req = &SendSmsRequestV2{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Phone: param.Phone,
|
||||
Type: param.Type,
|
||||
Replaces: param.Replaces,
|
||||
Company: param.Company,
|
||||
Ip: param.Ip,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v2/sms/send")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateSendSmsResponseV2() (resp *SendSmsResponseV2) {
|
||||
resp = &SendSmsResponseV2{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user