Compare commits
	
		
			2 Commits
		
	
	
		
			7e664f3f29
			...
			b282de0a2f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					b282de0a2f | ||
| 
						 | 
					abb6cc61fb | 
							
								
								
									
										36
									
								
								services/cs/client.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								services/cs/client.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					package cs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
 | 
				
			||||||
 | 
						"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const (
 | 
				
			||||||
 | 
						VERSION = "2025-06-10"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var HOST = requests.Host{
 | 
				
			||||||
 | 
						Default: "cs",
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type Client struct {
 | 
				
			||||||
 | 
						sdk.Client
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func NewClient() (client *Client, err error) {
 | 
				
			||||||
 | 
						client = new(Client)
 | 
				
			||||||
 | 
						err = client.Init()
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (client *Client) GetFaq(req *GetFaqRequest) (resp *GetFaqResponse, err error) {
 | 
				
			||||||
 | 
						resp = CreateGetFaqResponse()
 | 
				
			||||||
 | 
						err = client.DoAction(req, resp)
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (client *Client) GetUserInfo(req *GetUserInfoRequest) (resp *GetUserInfoResponse, err error) {
 | 
				
			||||||
 | 
						resp = CreateGetUserInfoResponse()
 | 
				
			||||||
 | 
						err = client.DoAction(req, resp)
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										43
									
								
								services/cs/client_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								services/cs/client_test.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					package cs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"fmt"
 | 
				
			||||||
 | 
						"testing"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客服工单服务,单元测试
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 获取faq树状数据
 | 
				
			||||||
 | 
					func TestGetFaq(t *testing.T) {
 | 
				
			||||||
 | 
						client, newErr := NewClient()
 | 
				
			||||||
 | 
						if newErr != nil {
 | 
				
			||||||
 | 
							panic(newErr)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						req := CreateGetFaqRequest()
 | 
				
			||||||
 | 
						faq, err := client.GetFaq(req)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Error(err)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						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))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										48
									
								
								services/cs/faq.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								services/cs/faq.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					package cs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
 | 
				
			||||||
 | 
						"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Faq 树状结构
 | 
				
			||||||
 | 
					type Faq struct {
 | 
				
			||||||
 | 
						Id                  int64  `json:"id"`
 | 
				
			||||||
 | 
						ParentId            int64  `json:"parent_id"`
 | 
				
			||||||
 | 
						Title               string `json:"title"`
 | 
				
			||||||
 | 
						Answer              string `json:"answer"`
 | 
				
			||||||
 | 
						Type                int64  `json:"type"`
 | 
				
			||||||
 | 
						WorkOrderTemplateId int64  `json:"work_order_template_id"`
 | 
				
			||||||
 | 
						CreatedAt           string `json:"created_at"`
 | 
				
			||||||
 | 
						UpdatedAt           string `json:"updated_at"`
 | 
				
			||||||
 | 
						ProcessFlow         string `json:"process_flow"`
 | 
				
			||||||
 | 
						Children            []*Faq `json:"children"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type GetFaqRequest struct {
 | 
				
			||||||
 | 
						*requests.RpcRequest
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type GetFaqResponse struct {
 | 
				
			||||||
 | 
						*responses.BaseResponse
 | 
				
			||||||
 | 
						Code int    `json:"code"`
 | 
				
			||||||
 | 
						Msg  string `json:"msg"`
 | 
				
			||||||
 | 
						Data Faq    `json:"data"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func CreateGetFaqRequest() (req *GetFaqRequest) {
 | 
				
			||||||
 | 
						req = &GetFaqRequest{
 | 
				
			||||||
 | 
							RpcRequest: &requests.RpcRequest{},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						req.InitWithApiInfo(HOST, VERSION, "/v1/faq/list")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						req.Method = requests.POST
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func CreateGetFaqResponse() (response *GetFaqResponse) {
 | 
				
			||||||
 | 
						response = &GetFaqResponse{
 | 
				
			||||||
 | 
							BaseResponse: &responses.BaseResponse{},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										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