新增获取用户累计付费方法
This commit is contained in:
parent
3e45030be8
commit
7d0deb756a
@ -64,3 +64,13 @@ func (c *Client) GetUserRoleRegPage(req *UserRoleRegReq) (resp *UserRoleRegResp,
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserTotalPay 获取用户累计付费
|
||||||
|
func (c *Client) GetUserTotalPay(req *GetUserTotalPayReq) (resp *GetUserTotalPayResp, err error) {
|
||||||
|
resp = CreateGetUserTotalPayResp()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -98,3 +98,22 @@ func TestClient_GetUserRoleRegPage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户累计付费
|
||||||
|
func TestGetUserTotalPay(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
req := CreateGetUserTotalPayReq(GetUserTotalPayParam{
|
||||||
|
Where: "user_name = 'yoyo685757'",
|
||||||
|
Fields: []string{"user_name", "sum(total_pay_money) as total_pay_money", "last_pay_time"},
|
||||||
|
GroupBy: []string{"user_name"},
|
||||||
|
})
|
||||||
|
|
||||||
|
resp, err := client.GetUserTotalPay(req)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
||||||
|
}
|
||||||
|
63
services/stat/pay.go
Normal file
63
services/stat/pay.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package stat
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetUserTotalPayReq struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUserTotalPayParam struct {
|
||||||
|
Where string `json:"where"`
|
||||||
|
Fields []string `json:"fields"`
|
||||||
|
GroupBy []string `json:"group_by"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUserTotalPayResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data TotalPayList `json:"data"`
|
||||||
|
}
|
||||||
|
type TotalPayList struct {
|
||||||
|
List []TotalPay `json:"list"`
|
||||||
|
}
|
||||||
|
type TotalPay struct {
|
||||||
|
UserName string `json:"user_name"`
|
||||||
|
RegDate string `json:"reg_date"`
|
||||||
|
AgentId int64 `json:"agent_id"`
|
||||||
|
SiteId int64 `json:"site_id"`
|
||||||
|
GameId int64 `json:"game_id"`
|
||||||
|
FirstPayTime string `json:"first_pay_time"`
|
||||||
|
FirstPayMoney float64 `json:"first_pay_money"`
|
||||||
|
TotalPayMoney float64 `json:"total_pay_money"`
|
||||||
|
LastPayTime string `json:"last_pay_time"`
|
||||||
|
PayTimes int64 `json:"pay_times"`
|
||||||
|
IsFirst int64 `json:"is_first"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateGetUserTotalPayReq 获取用户累充
|
||||||
|
func CreateGetUserTotalPayReq(data GetUserTotalPayParam) *GetUserTotalPayReq {
|
||||||
|
req := &GetUserTotalPayReq{
|
||||||
|
&requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/pay/getUserTotalPay")
|
||||||
|
req.Method = requests.POST
|
||||||
|
req.FormParams = make(map[string]string)
|
||||||
|
req.FormParams["where"] = data.Where
|
||||||
|
req.FormParams["fields"] = strings.Join(data.Fields, ",")
|
||||||
|
req.FormParams["group_by"] = strings.Join(data.GroupBy, ",")
|
||||||
|
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateGetUserTotalPayResp 获取用户累充
|
||||||
|
func CreateGetUserTotalPayResp() *GetUserTotalPayResp {
|
||||||
|
return &GetUserTotalPayResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user