Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fd09f0ff02
@ -65,7 +65,6 @@ func (baseResponse *BaseResponse) parseFromHttpResponse(httpResponse *http.Respo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println(string(body))
|
|
||||||
baseResponse.httpStatus = httpResponse.StatusCode
|
baseResponse.httpStatus = httpResponse.StatusCode
|
||||||
baseResponse.httpHeaders = httpResponse.Header
|
baseResponse.httpHeaders = httpResponse.Header
|
||||||
baseResponse.httpContentBytes = body
|
baseResponse.httpContentBytes = body
|
||||||
|
|||||||
@ -130,3 +130,20 @@ func (c *Client) GetLoginBg(req *GetLoginBgReq) (resp *GetLoginBgResp, err error
|
|||||||
err = c.DoAction(req, resp)
|
err = c.DoAction(req, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLabelListByCate
|
||||||
|
// 通过分类获取标签列表
|
||||||
|
func (c *Client) GetLabelListByCate(req *GetLabelListByCateRep) (response *GetLabelListByCateResp, err error) {
|
||||||
|
response = CreateGetLabelListByCateResp()
|
||||||
|
err = c.DoAction(req, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGameClientInfo
|
||||||
|
// 获取游戏版本信息
|
||||||
|
func (c *Client) GetGameClientInfo(gameId, status int64) (response *ClientInfoResp, err error) {
|
||||||
|
clientInfoReq := CreateClientInfoReq(status, gameId)
|
||||||
|
response = CreateClientInfoResp()
|
||||||
|
err = c.DoAction(clientInfoReq, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -241,3 +241,17 @@ func TestGetLoginBg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(getLoginBgResp)
|
t.Log(getLoginBgResp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetGameClientInfo(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.GetGameClientInfo(8961, 4)
|
||||||
|
if err != nil {
|
||||||
|
t.Log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = resp
|
||||||
|
}
|
||||||
|
|||||||
45
services/game/game_client.go
Normal file
45
services/game/game_client.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package game
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ClientInfoReq struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClientInfoResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data []ClientInfoDataItem `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClientInfoDataItem struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
GameName string `json:"game_name"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
GameId int `json:"game_id"`
|
||||||
|
RequestDomain string `json:"request_domain"`
|
||||||
|
SpareRequestDomain string `json:"spare_request_domain"`
|
||||||
|
OtherRequestDomain string `json:"other_request_domain"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateClientInfoReq(status, gameId int64) *ClientInfoReq {
|
||||||
|
req := &ClientInfoReq{
|
||||||
|
&requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/game/getGameClientInfo?game_id=%d&status=%d", gameId, status))
|
||||||
|
req.Method = requests.GET
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateClientInfoResp() *ClientInfoResp {
|
||||||
|
return &ClientInfoResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
||||||
47
services/game/label.go
Normal file
47
services/game/label.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package game
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetLabelListByCateRep struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetLabelListByCateResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data struct {
|
||||||
|
List []Label `json:"list"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Label struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
CateId int `json:"cate_id"`
|
||||||
|
LabelName string `json:"label_name"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
RelateUserNum int `json:"relate_user_num"`
|
||||||
|
CreateBy string `json:"create_by"`
|
||||||
|
UpdateBy string `json:"update_by"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateGetLabelListByCateRep(cateIds string) *GetLabelListByCateRep {
|
||||||
|
req := &GetLabelListByCateRep{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/api/label/getLabelListByCate")
|
||||||
|
req.FormParams = map[string]string{
|
||||||
|
"cate_ids": cateIds,
|
||||||
|
}
|
||||||
|
req.Method = requests.POST
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateGetLabelListByCateResp() *GetLabelListByCateResp {
|
||||||
|
return &GetLabelListByCateResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -79,3 +79,11 @@ func (c *Client) UpdateUserState(req *UpdateUserStateRequest) (response *UpdateU
|
|||||||
err = c.DoAction(req, response)
|
err = c.DoAction(req, response)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserLabels
|
||||||
|
// 获取用户标签
|
||||||
|
func (c *Client) GetUserLabels(req *GetUserLabelsRequest) (response *GetUserLabelsResponse, err error) {
|
||||||
|
response = CreateGetUserLabelsResponse()
|
||||||
|
err = c.DoAction(req, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -200,3 +200,47 @@ func CreateGetUserGameSignResponse() (response *GetUserGameSignResponse) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetUserLabelsRequest struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUserLabelsResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data []UserLabel `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserLabel struct {
|
||||||
|
LabelId int64 `json:"label_id"`
|
||||||
|
UserName string `json:"user_name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateGetUserLabelsRequest 获取用户标签
|
||||||
|
func CreateGetUserLabelsRequest(userNames, labelIds string) (req *GetUserLabelsRequest) {
|
||||||
|
ts, sign := GetSign()
|
||||||
|
|
||||||
|
req = &GetUserLabelsRequest{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||||
|
req.FormParams = map[string]string{
|
||||||
|
"act": "info",
|
||||||
|
"do": "get_user_labels",
|
||||||
|
"user_names": userNames,
|
||||||
|
"label_ids": labelIds,
|
||||||
|
"time": fmt.Sprintf("%v", ts),
|
||||||
|
"sign": sign,
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateGetUserLabelsResponse() (response *GetUserLabelsResponse) {
|
||||||
|
response = &GetUserLabelsResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -44,3 +44,10 @@ func (c *Client) NewPayRedisData(req *NewPayRedisDataReq) (resp *NewPayRedisData
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncWxComplaint 同步微信投诉工单
|
||||||
|
func (c *Client) SyncWxComplaint(req *SyncWxComplaintRequest) (resp *SyncWxComplaintResp, err error) {
|
||||||
|
resp = CreateSyncWxComplaintResp()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -34,3 +34,20 @@ func TestNewPayRedisData(t *testing.T) {
|
|||||||
|
|
||||||
fmt.Println(resp.Code, resp.Msg)
|
fmt.Println(resp.Code, resp.Msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCreateSyncSyncWxComplaintReq(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req := CreateSyncSyncWxComplaintReq("chinaums", "631678630", "2025-12-30", "2025-12-30")
|
||||||
|
|
||||||
|
resp, err := client.SyncWxComplaint(req)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(resp.Code, resp.Msg)
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"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/responses"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OpenGameReq struct {
|
type OpenGameReq struct {
|
||||||
@ -23,12 +24,33 @@ type NewPayRedisDataResp struct {
|
|||||||
*responses.BaseResponse
|
*responses.BaseResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SyncWxComplaintData struct {
|
||||||
|
MchId string `json:"mch_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SyncWxComplaintRequest struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
MchId string `position:"Body" field:"mch_id" default:"" `
|
||||||
|
Channel string `position:"Body" field:"channel" default:"" `
|
||||||
|
StartDate string `position:"Body" field:"start_date" default:"" `
|
||||||
|
EndDate string `position:"Body" field:"end_date" default:"" `
|
||||||
|
}
|
||||||
|
|
||||||
|
type SyncWxComplaintResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
}
|
||||||
|
|
||||||
// GetHttpContentBytes 因为http://script.gaore.com/open_game.php?game_id=这个接口返回的不是json,反序列化会报错,所以返回一个固定的json
|
// GetHttpContentBytes 因为http://script.gaore.com/open_game.php?game_id=这个接口返回的不是json,反序列化会报错,所以返回一个固定的json
|
||||||
func (baseResponse *OpenGameResp) GetHttpContentBytes() []byte {
|
func (baseResponse *OpenGameResp) GetHttpContentBytes() []byte {
|
||||||
b, _ := json.Marshal(map[string]interface{}{"code": 200, "msg": "success"})
|
b, _ := json.Marshal(map[string]interface{}{"code": 200, "msg": "success"})
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (baseResponse *SyncWxComplaintResp) GetHttpContentBytes() []byte {
|
||||||
|
b, _ := json.Marshal(map[string]interface{}{"code": 200, "msg": "success"})
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
// CreateOpenGameReq 创建同步到游戏中心请求
|
// CreateOpenGameReq 创建同步到游戏中心请求
|
||||||
func CreateOpenGameReq(gameId int) *OpenGameReq {
|
func CreateOpenGameReq(gameId int) *OpenGameReq {
|
||||||
req := &OpenGameReq{
|
req := &OpenGameReq{
|
||||||
@ -66,3 +88,27 @@ func CreateNewPayRedisDataResp() *NewPayRedisDataResp {
|
|||||||
BaseResponse: &responses.BaseResponse{},
|
BaseResponse: &responses.BaseResponse{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateSyncSyncWxComplaintReq(channel string, mchID string, startDate string, endDate string) *SyncWxComplaintRequest {
|
||||||
|
req := &SyncWxComplaintRequest{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "complaint/sync_wx_complaint.php")
|
||||||
|
req.Method = requests.POST
|
||||||
|
req.MchId = mchID
|
||||||
|
req.Channel = channel
|
||||||
|
req.StartDate = startDate
|
||||||
|
req.EndDate = endDate
|
||||||
|
// 设置超时时间
|
||||||
|
req.SetConnectTimeout(600 * time.Second)
|
||||||
|
// 设置读取超时时间
|
||||||
|
req.SetReadTimeout(600 * time.Second)
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateSyncWxComplaintResp() *SyncWxComplaintResp {
|
||||||
|
return &SyncWxComplaintResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -142,3 +142,11 @@ func (c *Client) UserLogin(req *UserLoginRequest) (resp *UserLoginResponse, err
|
|||||||
err = c.DoAction(req, resp)
|
err = c.DoAction(req, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) SetSiteKey(req *SetSiteKeyReq) (resp *SetSiteKeyResp, err error) {
|
||||||
|
resp = &SetSiteKeyResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -314,3 +314,25 @@ func TestUserLogin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(resp.Code, resp.Data)
|
t.Log(resp.Code, resp.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSetSiteKey(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err := client.SetSiteKey(CreateSetSiteKeyReq(SetSiteKeyParam{
|
||||||
|
AgentId: 1213123,
|
||||||
|
SiteId: 1231122,
|
||||||
|
GameId: 1,
|
||||||
|
AdSource: 1,
|
||||||
|
ConvertSourceType: "1",
|
||||||
|
Key: "1",
|
||||||
|
Token: "1",
|
||||||
|
}))
|
||||||
|
if err != nil {
|
||||||
|
t.Log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ = resp
|
||||||
|
}
|
||||||
|
|||||||
54
services/stat/site.go
Normal file
54
services/stat/site.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package stat
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cast"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SetSiteKeyReq struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetSiteKeyParam struct {
|
||||||
|
AgentId int64 `json:"agent_id"`
|
||||||
|
SiteId int64 `json:"site_id"`
|
||||||
|
GameId int64 `json:"game_id"`
|
||||||
|
AdSource int64 `json:"ad_source"`
|
||||||
|
ConvertSourceType string `json:"convert_source_type"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SetSiteKeyResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSetSiteKeyReq 写toutiao_key
|
||||||
|
func CreateSetSiteKeyReq(data SetSiteKeyParam) *SetSiteKeyReq {
|
||||||
|
req := &SetSiteKeyReq{
|
||||||
|
&requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "api/site/setSiteKey")
|
||||||
|
req.Method = requests.POST
|
||||||
|
req.FormParams = make(map[string]string)
|
||||||
|
req.FormParams["agentid"] = cast.ToString(data.AgentId)
|
||||||
|
req.FormParams["siteid"] = cast.ToString(data.SiteId)
|
||||||
|
req.FormParams["game_id"] = cast.ToString(data.GameId)
|
||||||
|
req.FormParams["ad_source"] = cast.ToString(data.AdSource)
|
||||||
|
req.FormParams["convert_source_type"] = data.ConvertSourceType
|
||||||
|
req.FormParams["key"] = data.Key
|
||||||
|
req.FormParams["token"] = data.Token
|
||||||
|
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSetSiteKeyResp 写头条key
|
||||||
|
func CreateSetSiteKeyResp() *GetUserTotalPayResp {
|
||||||
|
return &GetUserTotalPayResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user