293 lines
6.4 KiB
Go
293 lines
6.4 KiB
Go
package cs
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"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))
|
|
}
|
|
|
|
// 获取玩家角色列表
|
|
func TestGetUserRoleList(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateGetUserRoleListRequest(int64(63610626), int64(2850))
|
|
info, err := client.GetCsUserRoleList(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if info.Code != 0 {
|
|
t.Error("获取玩家角色列表失败")
|
|
fmt.Printf(fmt.Sprintf("%v", info))
|
|
return
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", info))
|
|
}
|
|
|
|
// 获取玩家区服列表
|
|
func TestGetUserServerList(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateGetUserServerListRequest(int64(63610626), int64(2850))
|
|
info, err := client.GetUserServerList(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if info.Code != 0 {
|
|
t.Error("获取玩家区服列表失败")
|
|
fmt.Printf(fmt.Sprintf("%v", info))
|
|
return
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", info))
|
|
}
|
|
|
|
// 给玩家发送短信
|
|
func TestSendSms(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateSendSmsRequest(SendSmsReq{
|
|
Phone: "13725263463",
|
|
})
|
|
info, err := client.SendSmsCode(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if info.Code != 0 {
|
|
t.Error("给玩家发送短信失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", info))
|
|
}
|
|
|
|
// 工单图片上传
|
|
func TestUpload(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
// 读取文件流
|
|
file, err := os.ReadFile("test.png")
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
req := CreateUploadRequest()
|
|
req.FileStream = file
|
|
res, err := client.Upload(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("工单图片上传失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
// 工单模板查询
|
|
func TestGetOrderTemplateDetail(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
templateId := int64(12)
|
|
req := CreateOrderTemplateDetailReq(templateId)
|
|
res, err := client.GetOrderTemplateDetail(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("工单模板查询失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
// 工单补充字段设置
|
|
func TestGetOrderFurtherPart(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateGetOrderFurtherPartRequest(GetOrderFurtherPartParam{
|
|
OrderNum: "20250605092301764049"})
|
|
res, err := client.GetOrderFurtherPart(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("工单补充字段设置获取失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
// 用户催单
|
|
func TestOrderUrgent(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateOrderUrgentRequest(OrderUrgentParam{
|
|
OrderNum: "20250530173554491048"})
|
|
res, err := client.OrderUrgent(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("用户催单失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
func TestOrderUpdateHandle(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateOrderUpdateHandleRequest(OrderUpdateHandleParam{
|
|
IsHandle: 1,
|
|
OrderNum: "20250530173554491048"})
|
|
res, err := client.OrderUpdateHandle(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("用户催单失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
func TestOrderAppraise(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateOrderAppraiseRequest(OrderAppraiseParam{
|
|
OrderNum: "20250530173554491048",
|
|
Score: 5,
|
|
})
|
|
res, err := client.OrderAppraise(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("用户评价失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
|
|
func TestOrderRestart(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateOrderRestartRequest(OrderRestartParam{
|
|
OrderNum: "20250530173554491048",
|
|
RemarkContent: "模拟用户重启",
|
|
RemarkPic: []string{},
|
|
})
|
|
res, err := client.OrderRestart(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("工单重启失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|
|
func TestOrderSubmit(t *testing.T) {
|
|
client, newErr := NewClient()
|
|
if newErr != nil {
|
|
panic(newErr)
|
|
}
|
|
req := CreateOrderSubmitRequest(OrderSubmitParam{
|
|
GameId: 7991,
|
|
UserName: "ws45265737",
|
|
Uid: 65598086,
|
|
RoleId: "10676785",
|
|
RoleName: "流水行者",
|
|
ServerName: "血阳琉璃",
|
|
OrderTemplateCode: "btu7RoDj",
|
|
Detail: "我的问题是,组队这个玩法的初衷是希望实现大家能和身边认识的朋友一起下洞的目标。但是现在看来,很多玩家都选择了在游戏中随机匹配队友,而我们发现,组队机制暴露的绝大部分玩家体验问题都是在随机匹配中出现的。<br/>比如恶意踢人,又比如匹配到的玩家等级比较低,不符合自己本次下洞的目标,再或者是组队进入洞窟却发现队友已经快要收尾结束探险了。",
|
|
Phone: "13725263463",
|
|
ApplyIp: "183.63.75.58",
|
|
OrderParts: []OrderSubmitPart{
|
|
{
|
|
PartKey: "email",
|
|
PartName: "联系邮箱",
|
|
PartValue: "kingson2011@126.com",
|
|
PicValue: nil,
|
|
},
|
|
{
|
|
PartKey: "pay_pic",
|
|
PartName: "充值凭证",
|
|
PartValue: "",
|
|
PicValue: []string{
|
|
"uploads/d1a/d1aba28357b89e7ebfc77e5c43fc81b7.jpeg",
|
|
"uploads/c37/c3726c5cf7175ed048f6c68416dbf30b.jpeg",
|
|
"uploads/ca2/ca285ae8feae8c60d51b53079fa9b2a9.jpeg",
|
|
},
|
|
},
|
|
},
|
|
SmsCode: "7204",
|
|
})
|
|
res, err := client.OrderSubmit(req)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
if res.Code != 0 {
|
|
t.Error("工单提交失败")
|
|
}
|
|
fmt.Printf(fmt.Sprintf("%v", res))
|
|
}
|