From fa12a66f44306bf68552d4da84baef184e2a4aaf Mon Sep 17 00:00:00 2001 From: "DESKTOP-HH6KT2H\\gaore" Date: Mon, 8 Jun 2026 18:19:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=90=A5=E5=90=8E=E5=8F=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E8=B5=84=E6=96=99=E5=A2=9E=E5=8A=A0token=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8E=E7=94=A8=E6=88=B7=E8=B5=84=E6=96=99=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/big-data/client.go | 38 +++++++++ services/big-data/get_user_profile.go | 112 ++++++++++++++++++++++++++ services/big-data/token.go | 56 +++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 services/big-data/client.go create mode 100644 services/big-data/get_user_profile.go create mode 100644 services/big-data/token.go diff --git a/services/big-data/client.go b/services/big-data/client.go new file mode 100644 index 0000000..945293a --- /dev/null +++ b/services/big-data/client.go @@ -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 +} diff --git a/services/big-data/get_user_profile.go b/services/big-data/get_user_profile.go new file mode 100644 index 0000000..7e960b9 --- /dev/null +++ b/services/big-data/get_user_profile.go @@ -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{}, + } +} diff --git a/services/big-data/token.go b/services/big-data/token.go new file mode 100644 index 0000000..819da19 --- /dev/null +++ b/services/big-data/token.go @@ -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{}, + } +}