【cs服务】
1、新增用户基本信息获取
This commit is contained in:
parent
abb6cc61fb
commit
b282de0a2f
@ -28,3 +28,9 @@ func (client *Client) GetFaq(req *GetFaqRequest) (resp *GetFaqResponse, err erro
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetUserInfo(req *GetUserInfoRequest) (resp *GetUserInfoResponse, err error) {
|
||||
resp = CreateGetUserInfoResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
* 客服工单服务,单元测试
|
||||
*/
|
||||
|
||||
// 获取faq树状数据
|
||||
func TestGetFaq(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
@ -16,11 +17,27 @@ func TestGetFaq(t *testing.T) {
|
||||
}
|
||||
|
||||
req := CreateGetFaqRequest()
|
||||
info, err := client.GetFaq(req)
|
||||
faq, err := client.GetFaq(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("%+v", info)
|
||||
fmt.Printf(fmt.Sprintf("%#+v", faq))
|
||||
}
|
||||
|
||||
// 获取玩家基本信息
|
||||
func TestGetUserInfo(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetUserInfoRequest("ws45265737")
|
||||
info, err := client.GetUserInfo(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
}
|
||||
|
49
services/cs/user.go
Normal file
49
services/cs/user.go
Normal file
@ -0,0 +1,49 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取玩家(用户)相关信息
|
||||
*/
|
||||
|
||||
// UserInfo 用户信息
|
||||
type UserInfo struct {
|
||||
UserName string `json:"user_name"`
|
||||
Uid int64 `json:"uid"`
|
||||
Telephone string `json:"telephone"`
|
||||
}
|
||||
|
||||
type GetUserInfoRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserInfoResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data UserInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserInfoRequest(userName string) (req *GetUserInfoRequest) {
|
||||
req = &GetUserInfoRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/user/info")
|
||||
|
||||
req.FormParams = map[string]string{
|
||||
"user_name": userName,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserInfoResponse() (response *GetUserInfoResponse) {
|
||||
response = &GetUserInfoResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user