8
0

Compare commits

..

2 Commits

Author SHA1 Message Date
luoxun
40d54327bf Merge branch 'master' of https://golib.gaore.com/GaoreGo/gaore-common-sdk-go 2026-06-08 19:52:33 +08:00
DESKTOP-HH6KT2H\gaore
fa12a66f44 运营后台用户资料增加token获取与用户资料列表 2026-06-08 18:19:20 +08:00
3 changed files with 206 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package big_data
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "v1"
)
var HOST requests.Host = requests.Host{
Default: "dms-api.gaore.com",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// GetToken 获取访问 token
func (c *Client) GetToken(req *GetTokenRequest) (response *GetTokenResponse, err error) {
response = CreateGetTokenResponse()
err = c.DoAction(req, response)
return
}
// GetUserProfile 用户筛选/圈选列表查询
func (c *Client) GetUserProfile(req *GetUserProfileRequest) (response *GetUserProfileResponse, err error) {
response = CreateGetUserProfileResponse()
err = c.DoAction(req, response)
return
}

View File

@ -0,0 +1,112 @@
package big_data
import (
"encoding/json"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
// GetUserProfileParam 用户筛选/圈选查询参数
type GetUserProfileParam struct {
UserName []string `json:"user_name"`
UserName2 []string `json:"user_name2"`
Uid []string `json:"uid"`
RoleId []string `json:"role_id"`
RoleName []string `json:"role_name"`
RoleNameLike string `json:"role_name_like"`
LabelId []int `json:"label_id"`
WeworkTag []string `json:"wework_tag"`
OrderId []string `json:"order_id"`
TradeOrderId []string `json:"trade_order_id"`
GameSign []string `json:"game_sign"`
GameId []string `json:"game_id"`
RegisterDate []string `json:"register_date"` // 区间 [开始, 结束]
LastLoginDate []string `json:"last_login_date"` // 区间 [开始, 结束]
LastPayDate []string `json:"last_pay_date"` // 区间 [开始, 结束]
PayAmtAccMin int64 `json:"pay_amt_acc_min"`
PayAmtAccMax int64 `json:"pay_amt_acc_max"`
LastPayAmountMin int64 `json:"last_pay_amount_min"`
LastPayAmountMax int64 `json:"last_pay_amount_max"`
Page int `json:"page"`
PageSize int `json:"page_size"`
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
}
// GetUserProfileRequest 用户筛选/圈选查询请求
type GetUserProfileRequest struct {
*requests.JsonRequest
UserName []string `position:"Json" field:"user_name"`
UserName2 []string `position:"Json" field:"user_name2"`
Uid []string `position:"Json" field:"uid"`
RoleId []string `position:"Json" field:"role_id"`
RoleName []string `position:"Json" field:"role_name"`
RoleNameLike string `position:"Json" field:"role_name_like"`
LabelId []int `position:"Json" field:"label_id"`
WeworkTag []string `position:"Json" field:"wework_tag"`
OrderId []string `position:"Json" field:"order_id"`
TradeOrderId []string `position:"Json" field:"trade_order_id"`
GameSign []string `position:"Json" field:"game_sign"`
GameId []string `position:"Json" field:"game_id"`
RegisterDate []string `position:"Json" field:"register_date"`
LastLoginDate []string `position:"Json" field:"last_login_date"`
LastPayDate []string `position:"Json" field:"last_pay_date"`
PayAmtAccMin int64 `position:"Json" field:"pay_amt_acc_min"`
PayAmtAccMax int64 `position:"Json" field:"pay_amt_acc_max"`
LastPayAmountMin int64 `position:"Json" field:"last_pay_amount_min"`
LastPayAmountMax int64 `position:"Json" field:"last_pay_amount_max"`
Page int `position:"Json" field:"page"`
PageSize int `position:"Json" field:"page_size"`
Authorization string `position:"Header" field:"Authorization"`
XDebug string `position:"Header" field:"x-debug"`
}
// GetUserProfileResponse 用户筛选/圈选查询响应返回不做处理data 原样透出)
type GetUserProfileResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data"`
}
// CreateGetUserProfileRequest 创建用户筛选/圈选查询请求
// token 为 GetToken 返回的 data.token直接放入 Authorization 头
func CreateGetUserProfileRequest(token string, param GetUserProfileParam) *GetUserProfileRequest {
req := &GetUserProfileRequest{
JsonRequest: &requests.JsonRequest{},
UserName: param.UserName,
UserName2: param.UserName2,
Uid: param.Uid,
RoleId: param.RoleId,
RoleName: param.RoleName,
RoleNameLike: param.RoleNameLike,
LabelId: param.LabelId,
WeworkTag: param.WeworkTag,
OrderId: param.OrderId,
TradeOrderId: param.TradeOrderId,
GameSign: param.GameSign,
GameId: param.GameId,
RegisterDate: param.RegisterDate,
LastLoginDate: param.LastLoginDate,
LastPayDate: param.LastPayDate,
PayAmtAccMin: param.PayAmtAccMin,
PayAmtAccMax: param.PayAmtAccMax,
LastPayAmountMin: param.LastPayAmountMin,
LastPayAmountMax: param.LastPayAmountMax,
Page: param.Page,
PageSize: param.PageSize,
Authorization: token,
XDebug: param.XDebug,
}
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_user_profile")
req.Method = requests.POST
req.Scheme = requests.HTTPS
return req
}
// CreateGetUserProfileResponse 创建用户筛选/圈选查询响应
func CreateGetUserProfileResponse() *GetUserProfileResponse {
return &GetUserProfileResponse{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -0,0 +1,56 @@
package big_data
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
// GetTokenParam 获取 token 参数
type GetTokenParam struct {
AppKey string `json:"app_key"`
AppSecret string `json:"app_secret"`
ExpiresIn int64 `json:"expires_in"`
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
}
// GetTokenRequest 获取 token 请求
type GetTokenRequest struct {
*requests.JsonRequest
AppKey string `position:"Json" field:"app_key"`
AppSecret string `position:"Json" field:"app_secret"`
ExpiresIn int64 `position:"Json" field:"expires_in"`
XDebug string `position:"Header" field:"x-debug"`
}
// GetTokenResponse 获取 token 响应
type GetTokenResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Token string `json:"token"`
ExpiresIn int64 `json:"expires_in"`
} `json:"data"`
}
// CreateGetTokenRequest 创建获取 token 请求
func CreateGetTokenRequest(param GetTokenParam) *GetTokenRequest {
req := &GetTokenRequest{
JsonRequest: &requests.JsonRequest{},
AppKey: param.AppKey,
AppSecret: param.AppSecret,
ExpiresIn: param.ExpiresIn,
XDebug: param.XDebug,
}
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/token")
req.Method = requests.POST
req.Scheme = requests.HTTPS
return req
}
// CreateGetTokenResponse 创建获取 token 响应
func CreateGetTokenResponse() *GetTokenResponse {
return &GetTokenResponse{
BaseResponse: &responses.BaseResponse{},
}
}