运营后台用户资料增加token获取与用户资料列表
This commit is contained in:
parent
0375acccb9
commit
fa12a66f44
38
services/big-data/client.go
Normal file
38
services/big-data/client.go
Normal 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
|
||||||
|
}
|
||||||
112
services/big-data/get_user_profile.go
Normal file
112
services/big-data/get_user_profile.go
Normal 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{},
|
||||||
|
}
|
||||||
|
}
|
||||||
56
services/big-data/token.go
Normal file
56
services/big-data/token.go
Normal 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{},
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user