This commit is contained in:
liwei1dao 2022-07-15 11:15:46 +08:00
commit 653ddb0b8c
18 changed files with 498 additions and 221 deletions

View File

@ -5,6 +5,7 @@ import (
"go_dreamfactory/cmd/robot" "go_dreamfactory/cmd/robot"
"os" "os"
"github.com/sirupsen/logrus"
flag "github.com/spf13/pflag" flag "github.com/spf13/pflag"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -28,11 +29,13 @@ func Execute() {
func init() { func init() {
RootCmd.AddCommand(runCmd) RootCmd.AddCommand(runCmd)
initLog()
} }
var account = flag.String("account", "", "account") var account = flag.String("account", "", "登录账号")
var sid = flag.Int32("sid", 0, "区服ID") var sid = flag.Int32("sid", 0, "区服ID")
var create = flag.Bool("create", false, "account") //false 不创建新账号 var create = flag.Bool("create", false, "是否创建新账号") //false 不创建新账号
var role = flag.Bool("role", false, "创角")
func main() { func main() {
Execute() Execute()
@ -47,7 +50,29 @@ var runCmd = &cobra.Command{
opts.Create = *create opts.Create = *create
opts.Account = *account opts.Account = *account
opts.ServerId = *sid opts.ServerId = *sid
opts.Role = *role
r := robot.NewRobot(opts) r := robot.NewRobot(opts)
r.Run() r.Run()
}, },
} }
func initLog() {
logrus.New()
logrus.SetFormatter(&logrus.TextFormatter{
ForceColors: false,
FullTimestamp: false,
})
//设置output,默认为stderr,可以为任何io.Writer比如文件*os.File
// file, err := os.OpenFile("robot.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
// writers := []io.Writer{
// file,
// os.Stdout}
// //同时写文件和屏幕
// fileAndStdoutWriter := io.MultiWriter(writers...)
// if err == nil {
// logrus.SetOutput(fileAndStdoutWriter)
// } else {
// logrus.Info("failed to log to file.")
// }
}

View File

@ -91,7 +91,7 @@ var (
enabled: true, enabled: true,
} }
tcs = append(tcs, tc) tcs = append(tcs, tc)
robot.AddTestCases(tcs) robot.addBuilders(tcs) //这里一定要调用此方法才会发送请求
} }
}, },
@ -106,7 +106,7 @@ var (
} }
) )
//声明加入到构建器并发起请求 //声明加入到构建器
func (r *Robot) RunFriend() { func (r *Robot) RunFriend() {
r.AddTestCases(friendBuilders) r.addBuilders(friendBuilders)
} }

View File

@ -1,7 +1,6 @@
package robot package robot
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/modules/hero" "go_dreamfactory/modules/hero"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -18,12 +17,12 @@ var (
subType: hero.HeroSubTypeList, subType: hero.HeroSubTypeList,
req: &pb.HeroListReq{}, req: &pb.HeroListReq{},
rsp: &pb.HeroListResp{}, rsp: &pb.HeroListResp{},
print: func(rsp proto.Message) { // print: func(rsp proto.Message) {
out := rsp.(*pb.HeroListResp) // out := rsp.(*pb.HeroListResp)
for i, v := range out.List { // for i, v := range out.List {
fmt.Printf("%d- %v\n", (i + 1), v) // fmt.Printf("%d- %v\n", (i + 1), v)
} // }
}, // },
enabled: true, enabled: true,
next: func(robot *Robot, rsp proto.Message) { next: func(robot *Robot, rsp proto.Message) {
tcs := []*TestCase{} tcs := []*TestCase{}
@ -38,14 +37,29 @@ var (
}, },
rsp: &pb.HeroInfoResp{}, rsp: &pb.HeroInfoResp{},
enabled: true, enabled: true,
print: func(rsp proto.Message) { // print: func(rsp proto.Message) {
r := rsp.(*pb.HeroInfoResp) // r := rsp.(*pb.HeroInfoResp)
fmt.Printf("%v\n", r) // fmt.Printf("%v\n", r)
// },
next: func(robot *Robot, rsp proto.Message) {
tcs := []*TestCase{
{
desc: "觉醒",
mainType: string(comm.ModuleHero),
subType: hero.Awaken,
req: &pb.HeroAwakenReq{
HeroObjID: v.Id,
},
rsp: &pb.HeroAwakenResp{},
enabled: true,
},
}
robot.addBuilders(tcs)
}, },
} }
tcs = append(tcs, tc) tcs = append(tcs, tc)
} }
robot.AddTestCases(tcs) robot.addBuilders(tcs) //这里一定要调用此方法才会发送请求
} }
}, },
@ -96,5 +110,5 @@ var (
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunHero() { func (r *Robot) RunHero() {
r.AddTestCases(heroBuilders) r.addBuilders(heroBuilders)
} }

View File

@ -61,14 +61,13 @@ func (r *Robot) AccountLogin() {
NickName: nick, NickName: nick,
}, },
rsp: &pb.UserCreateResp{}, rsp: &pb.UserCreateResp{},
// enabled: true, enabled: r.enable,
} }
tcs = append(tcs, tc) tcs = append(tcs, tc)
r.AddTestCases(tcs) r.addBuilders(tcs)
} }
}, },
}, },
} }
r.AddTestCases(builders) r.addTestCaseAndReq(builders)
} }

View File

@ -1,22 +0,0 @@
package robot
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
var notify_builders = []*TestCase{
{
//create
desc: "全局通知",
mainType: comm.MainTypeNotify,
subType: comm.SubTypeErrorNotify,
rsp: &pb.NotifyErrorNotifyPush{},
enabled: true,
},
}
//声明加入到构建器并发起请求
func (r *Robot) RunNotify() {
r.addBuilders(notify_builders)
}

View File

@ -7,6 +7,7 @@ type Options struct {
Create bool Create bool
Secretkey string //秘钥串 Secretkey string //秘钥串
ServerId int32 //区服ID ServerId int32 //区服ID
Role bool //是否创角
} }
func DefaultOpts() *Options { func DefaultOpts() *Options {

View File

@ -13,11 +13,11 @@ var pack_builders = []*TestCase{
subType: "queryuserpackreq", subType: "queryuserpackreq",
// req: &pb.Pack_Getlist_Req{IType: 1}, // req: &pb.Pack_Getlist_Req{IType: 1},
rsp: &pb.UserCreateResp{}, rsp: &pb.UserCreateResp{},
enabled: true, // enabled: true,
}, },
} }
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunPack() { func (r *Robot) RunPack() {
r.AddTestCases(pack_builders) r.addBuilders(pack_builders)
} }

View File

@ -5,16 +5,21 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"io"
"os"
// zlog "go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules/user"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"sync"
"time" "time"
"github.com/Pallinder/go-randomdata"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@ -24,58 +29,98 @@ type Robot struct {
user *pb.DBUser user *pb.DBUser
builderMap map[string]*TestCase builderMap map[string]*TestCase
// linkCase *LinkCase // linkCase *LinkCase
wg sync.WaitGroup enable bool //全局开关
ch chan string //uuid reqCh chan string
printFormat bool //是否格式化结果
caseTotal int32 //测试数量
caseSuccess int32 //成功数量
caseError int32 //失败数量
start time.Time //启动时间
}
var zlog *logrus.Logger
func initlog() {
zlog = logrus.New()
zlog.SetLevel(logrus.DebugLevel)
zlog.SetFormatter(&RobotFormatter{
DisableTimestamp: true,
DisableQuote: true,
})
//设置output,默认为stderr,可以为任何io.Writer比如文件*os.File
file, err := os.OpenFile("robot.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
writers := []io.Writer{
file,
os.Stdout}
//同时写文件和屏幕
fileAndStdoutWriter := io.MultiWriter(writers...)
if err == nil {
zlog.SetOutput(fileAndStdoutWriter)
} else {
zlog.Info("failed to log to file.")
}
} }
func NewRobot(opts *Options) *Robot { func NewRobot(opts *Options) *Robot {
initlog()
ws, _, err := websocket.DefaultDialer.Dial(opts.WsUrl, nil) ws, _, err := websocket.DefaultDialer.Dial(opts.WsUrl, nil)
if err != nil { if err != nil {
log.Fatal(err) zlog.Fatalf("websocket conn err:%v", err)
} }
r := &Robot{ r := &Robot{
ws: ws, ws: ws,
opts: opts, opts: opts,
builderMap: make(map[string]*TestCase), builderMap: make(map[string]*TestCase),
ch: make(chan string, 10), reqCh: make(chan string, 1),
printFormat: false,
} }
return r return r
} }
func (r *Robot) Run() { func (r *Robot) Run() {
log.Print("Robot running...") zlog.Debug("Robot running...")
log.Printf("websocket %s \n", r.opts.WsUrl) zlog.Infof("websocket %s ", r.opts.WsUrl)
if r.opts.Create { //创建新用户 if r.opts.Create { //创建新用户
r.enable = true
r.AccountRegister(r.opts.Account, int32(r.opts.ServerId)) r.AccountRegister(r.opts.Account, int32(r.opts.ServerId))
} else { } else {
if r.opts.Account == "" { if r.opts.Account == "" {
log.Fatal("WARNNING: account is required !!!") zlog.Fatal("WARNNING: account is required !!!")
} }
r.enable = r.opts.Role
r.AccountLogin() r.AccountLogin()
} }
//处理响应 // go func() {
// for {
// r.handleRsp()
// }
// }()
ticker := time.NewTicker(time.Second * 5)
go func() { go func() {
for { for {
var msg *pb.UserMessage = &pb.UserMessage{} r.printBuilders()
_, data, err := r.ws.ReadMessage() <-ticker.C
if err != nil { if len(r.builderMap) == 0 {
log.Println(err) r.printReport(&TestReport{
caseTotal: r.caseTotal,
caseSuccess: r.caseSuccess,
caseError: r.caseError,
})
os.Exit(0)
} }
if err = proto.Unmarshal(data, msg); err != nil {
log.Fatal(err)
}
r.batchhandleRsp(msg)
} }
}() }()
r.wg.Wait() select {}
} }
type TestCase struct { type TestCase struct {
id string //uuid id string //用例ID 如果没有指定,会自动赋值uuid
desc string //用例描述 desc string //用例描述
mainType string //协议类型 L1 mainType string //协议类型 L1
subType string //协议类型 L2 subType string //协议类型 L2
@ -83,7 +128,8 @@ type TestCase struct {
rsp proto.Message //响应类型 rsp proto.Message //响应类型
enabled bool //是否启用 enabled bool //是否启用
start time.Time //启用时间 start time.Time //启用时间
requested bool //是否已请求 //请求标识 true已发 hs time.Duration //耗时
requested bool //是否是请求的case
print func(rsp proto.Message) //定义打印 print func(rsp proto.Message) //定义打印
next func(robot *Robot, rsp proto.Message) //处理下一层用例请求 next func(robot *Robot, rsp proto.Message) //处理下一层用例请求
} }
@ -101,81 +147,152 @@ func (r *Robot) addBuilders(builders []*TestCase) {
} }
} }
} }
}
func (r *Robot) printBuilders() {
for k, v := range r.builderMap {
zlog.Debugf("%v %s.%s", k, v.mainType, v.subType)
}
} }
//处理用例,发送请求 //处理用例,发送请求
func (r *Robot) handleReq() { func (r *Robot) handleReq() {
// go func() {
for len(r.builderMap) > 0 {
for _, b := range r.builderMap { for _, b := range r.builderMap {
if b.enabled && b.req != nil && !b.requested { if b.enabled && b.req != nil && !b.requested {
r.wg.Add(1) time.Sleep(time.Millisecond * 500)
time.Sleep(time.Second * 1) // r.reqCh <- b.id
b.start = time.Now() b.start = time.Now()
r.start = time.Now()
head := &pb.UserMessage{MainType: b.mainType, SubType: b.subType} head := &pb.UserMessage{MainType: b.mainType, SubType: b.subType}
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), b.req) // defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), b.req)
err := r.SendToClient(head, b.req) err := r.SendToClient(head, b.req)
if err != nil { if err != nil {
log.Fatal(err) delete(r.builderMap, b.id)
zlog.Errorf("send to client err:%v", err)
} }
b.requested = true
r.ch <- b.id
r.handleRsp(b.id)
} }
} }
}
// }()
} }
//执行请求 //加入用例并执行请求
func (r *Robot) AddTestCases(tcs []*TestCase) { func (r *Robot) addTestCaseAndReq(tcs []*TestCase) {
r.addBuilders(tcs) r.addBuilders(tcs)
r.handleReq() r.handleReq()
} }
//执行响应 //错误通知处理
func (r *Robot) batchhandleRsp(msg *pb.UserMessage) { func (r *Robot) handleNotify(uuid string, msg *pb.UserMessage) {
uuid := <-r.ch if msg.MainType == "notify" && msg.SubType == "errornotify" {
r.caseError++
rsp := &pb.NotifyErrorNotifyPush{}
if !comm.ProtoUnmarshal(msg, rsp) {
return
}
tc := &TestCase{
id: uuid,
desc: "错误通知",
mainType: comm.MainTypeNotify,
subType: comm.SubTypeErrorNotify,
rsp: rsp,
}
r.printReply(msg, tc)
delete(r.builderMap, uuid)
}
}
//处理响应
func (r *Robot) handleRsp(id string) {
defer func() {
r.caseTotal++
}()
var msg *pb.UserMessage = &pb.UserMessage{}
_, data, err := r.ws.ReadMessage()
if err != nil {
zlog.Fatalf("readMessage err:%v", err)
}
if err = proto.Unmarshal(data, msg); err != nil {
zlog.Fatalf("unmarshal err:%v", err)
}
uuid, _ := r.findTestCase(msg)
if uuid == "" {
uuid = id
}
// uuid := <-r.reqCh
r.handleNotify(uuid, msg)
if v, ok := r.builderMap[uuid]; ok { if v, ok := r.builderMap[uuid]; ok {
if v.enabled && if v.enabled &&
(msg.MainType == v.mainType && (msg.MainType == v.mainType &&
msg.SubType == v.subType) && msg.SubType == v.subType) {
v.requested {
v.hs = time.Since(v.start)
if !comm.ProtoUnmarshal(msg, v.rsp) { if !comm.ProtoUnmarshal(msg, v.rsp) {
return return
} }
if v.print == nil {
printReply(msg, v)
} else {
fmt.Println()
fmt.Printf("===== %s [%s.%s]=====\n", v.desc, msg.MainType, msg.SubType)
v.print(v.rsp)
fmt.Println("==============================")
}
//处理下一层用例
if v.next != nil { if v.next != nil {
v.next(r, v.rsp) v.next(r, v.rsp)
} }
//执行自定义打印
if v.print == nil {
r.printReply(msg, v)
} else {
zlog.Debug("==============================")
zlog.Debugf("%s [%s.%s]", v.desc, msg.MainType, msg.SubType)
v.print(v.rsp)
zlog.Debug("==============================")
}
if msg.MainType == "user" && msg.SubType == "login" { if msg.MainType == "user" && msg.SubType == "login" {
r.loginCallback(v.rsp) r.loginCallback(v.rsp)
} else { } else {
//清除已执行的用例
delete(r.builderMap, v.id) delete(r.builderMap, v.id)
} }
r.caseSuccess++
r.wg.Done()
} }
} }
} }
func (r *Robot) findTestCase(msg *pb.UserMessage) (string, bool) {
for k, v := range r.builderMap {
if v.mainType == msg.MainType && v.subType == msg.SubType {
return k, true
}
}
return "", false
}
//登录回调 //登录回调
func (r *Robot) loginCallback(rsp proto.Message) { func (r *Robot) loginCallback(rsp proto.Message) {
//清除登录用例
delete(r.builderMap, "login") delete(r.builderMap, "login")
lr := rsp.(*pb.UserLoginResp) lr := rsp.(*pb.UserLoginResp)
if lr.Data != nil { if lr.Data != nil {
r.user = lr.Data r.user = lr.Data
r.onUserLoaded() r.onUserLoaded()
r.handleReq()
} else { } else {
r.AccountRegister(r.opts.Account, int32(r.opts.ServerId)) //请求Http接口模拟创建新账号 //请求Http接口模拟创建新账号
r.AccountRegister(r.opts.Account, int32(r.opts.ServerId))
} }
} }
//发送消息
func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error { func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error {
//模拟客户端 每次请求都会生成新的秘钥 //模拟客户端 每次请求都会生成新的秘钥
msg.Sec = r.BuildSecStr() msg.Sec = r.BuildSecStr()
@ -186,13 +303,163 @@ func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error {
return nil return nil
} }
//注册账号
func (r *Robot) AccountRegister(account string, sid int32) {
if account == "" {
zlog.Fatal("account value is empty")
}
//http
regReq := &pb.UserRegisterReq{Account: account, Sid: sid}
jsonByte, _ := json.Marshal(regReq)
req, err := http.NewRequest("POST", r.opts.RegUrl, bytes.NewReader(jsonByte))
if err != nil {
zlog.Fatalf("account register err %v", err)
}
req.Header.Set("Content-Type", "application/json;charset=UTF-8")
httpClient := &http.Client{}
rsp, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer rsp.Body.Close()
body, _ := ioutil.ReadAll(rsp.Body)
regRsp := &pb.UserRegisterResp{}
err = jsoniter.Unmarshal(body, regRsp)
if regRsp.Code == pb.ErrorCode_Success { //注册成功
fmt.Printf("account:%s 注册成功", regRsp.Account)
//登录
var user_builders = []*TestCase{
{
id: "login",
desc: "登录",
mainType: "user",
subType: "login",
req: &pb.UserLoginReq{
Account: account,
Sid: sid,
},
rsp: &pb.UserLoginResp{},
enabled: true,
next: func(r *Robot, rsp proto.Message) {
tcs := []*TestCase{}
if _, ok := rsp.(*pb.UserLoginResp); ok {
nick := randomdata.SillyName()
tc := &TestCase{
desc: "创角",
mainType: string(comm.ModuleUser),
subType: user.UserSubTypeCreate,
req: &pb.UserCreateReq{ //设置请求参数
NickName: nick,
},
rsp: &pb.UserCreateResp{},
enabled: r.enable,
}
tcs = append(tcs, tc)
r.addBuilders(tcs)
}
},
},
}
r.addTestCaseAndReq(user_builders)
}
}
type TestReport struct {
caseTotal int32 //总用例数
caseSuccess int32 //成功数量
caseError int32 //失败数量
hsTotal time.Duration //总耗时
}
//打印响应
func (r *Robot) printReply(msg *pb.UserMessage, tc *TestCase) {
var (
code int32
mainType string
subType string
// arg proto.Message
// rsp proto.Message
// err error
)
if m, ok := tc.rsp.(*pb.NotifyErrorNotifyPush); ok {
code = int32(m.Code)
mainType = m.ReqMainType
subType = m.ReqSubType
// arg, _ = jsoniter.MarshalToString(m.Arg)
} else {
mainType = msg.MainType
subType = msg.SubType
// arg, _ = jsoniter.MarshalToString(tc.req)
}
// if r.printFormat {
// s, err := jsoniter.MarshalToString(tc.rsp)
// if err != nil {
// zlog.Errorf("MarshalToString err:%v", err)
// return
// }
// if rsp, err = formatJson(s); err != nil {
// zlog.Errorf("formatJson err:%v", err)
// return
// }
// } else {
// if rsp, err = jsoniter.MarshalToString(tc.rsp); err != nil {
// zlog.Errorf("MarshalToString err:%v", err)
// return
// }
// }
//表格显示
// data = append(data, []string{builder.desc, fmt.Sprintf("%s.%s", mainType, subType), "0", arg, cast.ToString(code)})
// table.SetHeader([]string{"描述", "协议", "耗时", "参数", "响应码"})
// for _, v := range data {
// table.Append(v)
// }
// table.Render()
//
zlog.Debug("-------------------------------------")
zlog.Debugf("uuid%s", tc.id)
zlog.Debugf("描述:%s", tc.desc)
zlog.Debugf("协议:%s.%s", mainType, subType)
zlog.Debugf("耗时:%v", tc.hs)
zlog.Debugf("参数:%v", tc.req)
zlog.Debugf("响应码:%d", code)
zlog.Debugf("返回:%v", tc.rsp)
}
//打印测试报告
func (r *Robot) printReport(report *TestReport) {
zlog.Debug("====================================")
zlog.Infof("测试完毕,开始输出报告")
zlog.Infof("用例总数:%d", r.caseTotal)
zlog.Infof("成功:%d", r.caseSuccess)
zlog.Infof("失败:%d", r.caseError)
zlog.Infof("总耗时: %v", time.Since(r.start))
}
//格式化json
func formatJson(data string) (string, error) {
var out bytes.Buffer
err := json.Indent(&out, []byte(data), "", " ")
return out.String(), err
}
//方法参数跟踪
func traceFunc(module string, funcName string, uid string, funcArgs interface{}) {
zlog.Debugf("req [%s.%s] [%s] [%v]", module, funcName, uid, funcArgs)
}
//在这里添加玩家成功登录以后的测试方法 //在这里添加玩家成功登录以后的测试方法
//次方法在用户登录成功后调用 //次方法在用户登录成功后调用
func (r *Robot) onUserLoaded() { func (r *Robot) onUserLoaded() {
//notify
r.RunNotify()
//user //user
r.RunUser() r.RunUser()
//hero //hero
r.RunHero() r.RunHero()
//friend //friend
@ -208,67 +475,28 @@ func (r *Robot) onUserLoaded() {
r.RunStory() r.RunStory()
} }
//注册账号 type RobotFormatter struct {
func (r *Robot) AccountRegister(account string, sid int32) { DisableTimestamp bool
if account == "" { DisableQuote bool
log.Fatal("account value is empty")
}
//http
regReq := &pb.UserRegisterReq{Account: account, Sid: sid}
jsonByte, _ := json.Marshal(regReq)
req, err := http.NewRequest("POST", r.opts.RegUrl, bytes.NewReader(jsonByte))
if err != nil {
log.Fatalf("account register err %v", err)
}
req.Header.Set("Content-Type", "application/json;charset=UTF-8")
httpClient := &http.Client{}
rsp, err := httpClient.Do(req)
if err != nil {
panic(err)
}
defer rsp.Body.Close()
body, _ := ioutil.ReadAll(rsp.Body)
regRsp := &pb.UserRegisterResp{}
err = jsoniter.Unmarshal(body, regRsp)
if regRsp.Code == pb.ErrorCode_Success { //注册成功
fmt.Printf("account:%s 注册成功", regRsp.Account)
//登录
var user_builders = []*TestCase{
{
desc: "登录",
mainType: "user",
subType: "login",
req: &pb.UserLoginReq{
Account: account,
Sid: sid,
},
rsp: &pb.UserLoginResp{},
enabled: true,
},
}
r.AddTestCases(user_builders)
}
} }
//打印响应 func (r *RobotFormatter) Format(entry *logrus.Entry) ([]byte, error) {
func printReply(msg *pb.UserMessage, builder *TestCase) { var b *bytes.Buffer
if m, ok := builder.rsp.(*pb.NotifyErrorNotifyPush); ok { if entry.Buffer != nil {
var tt time.Duration b = entry.Buffer
if builder.start.IsZero() {
tt = time.Duration(0)
} else { } else {
tt = time.Since(builder.start) b = &bytes.Buffer{}
} }
log.Printf("rsp %s [%v] [%s.%s] [%v:%v]", builder.desc, tt, m.ReqMainType, m.ReqSubType, int32(m.Code), m.Data)
} else {
log.Printf("rsp %s [%v] [%s.%s] [%v]", builder.desc, time.Since(builder.start), msg.MainType, msg.SubType, builder.rsp)
}
}
//方法参数跟踪 var timestamp string
func traceFunc(module string, funcName string, uid string, funcArgs interface{}) { var newLog string
log.Printf("req [%s.%s] [%s] [%v]", module, funcName, uid, funcArgs) if !r.DisableTimestamp {
timestamp = entry.Time.Format("2006-01-02 15:04:05")
newLog = fmt.Sprintf("[%s] %s\n", timestamp, entry.Message)
} else {
newLog = fmt.Sprintf("%s\n", entry.Message)
}
b.WriteString(newLog)
return b.Bytes(), nil
} }

View File

@ -33,12 +33,12 @@ var (
StoryId: 1, StoryId: 1,
}, },
rsp: &pb.StoryChallengeResp{}, rsp: &pb.StoryChallengeResp{},
enabled: true, // enabled: true,
}, },
} }
) )
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunStory() { func (r *Robot) RunStory() {
r.AddTestCases(storyBuilders) r.addBuilders(storyBuilders)
} }

View File

@ -62,5 +62,5 @@ var (
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunTask() { func (r *Robot) RunTask() {
r.AddTestCases(taskBuilders) r.addBuilders(taskBuilders)
} }

View File

@ -21,20 +21,20 @@ var user_builders = []*TestCase{
}, { }, {
desc: "添加资源", desc: "添加资源",
mainType: string(comm.ModuleUser), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeAddRes, subType: "addres",
req: &pb.UserAddResReq{ //设置请求参数 req: &pb.UserAddResReq{
Res: &pb.UserAssets{ Res: &pb.UserAssets{
A: comm.ResGold, A: "attr",
T: "", T: "10001",
N: 100, N: 12,
}, },
}, },
rsp: &pb.UserAddResResp{}, rsp: &pb.UserAddResResp{},
// enabled: true, enabled: true,
}, },
} }
//声明加入到构建器并发起请求 //声明加入到构建器并发起请求
func (r *Robot) RunUser() { func (r *Robot) RunUser() {
r.AddTestCases(user_builders) r.addBuilders(user_builders)
} }

3
go.mod
View File

@ -22,6 +22,7 @@ require (
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/rs/xid v1.3.0 github.com/rs/xid v1.3.0
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.8.1
github.com/smallnest/rpcx v1.7.4 github.com/smallnest/rpcx v1.7.4
github.com/spf13/cast v1.3.1 github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.2.1 github.com/spf13/cobra v1.2.1
@ -128,7 +129,7 @@ require (
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 // indirect golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.10 // indirect golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect

5
go.sum
View File

@ -611,6 +611,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6 h1:J8xk0QMMrqfDLqU0m07pYRRiOIlE7I3dNWAp/pAHqfo= github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6 h1:J8xk0QMMrqfDLqU0m07pYRRiOIlE7I3dNWAp/pAHqfo=
github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6/go.mod h1:h+J5yoLzf3XMKtM9l4vOaUtS4e+si6T3sKDtheJ15wc= github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6/go.mod h1:h+J5yoLzf3XMKtM9l4vOaUtS4e+si6T3sKDtheJ15wc=
github.com/smallnest/rpcx v1.7.4 h1:u6ADk/Ep8BqtAoJZO7LbniWsP+nqeAtcbaPm2D4eOXg= github.com/smallnest/rpcx v1.7.4 h1:u6ADk/Ep8BqtAoJZO7LbniWsP+nqeAtcbaPm2D4eOXg=
@ -946,8 +948,9 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f h1:8w7RhxzTVgUzw/AH/9mUV5q0vMgy40SQRursCcfmkCw=
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e h1:NHvCuwuS43lGnYhten69ZWqi2QOj/CiDNcKbVqwVoew=
golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@ -268,7 +268,12 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
} }
} }
if reply.Code != pb.ErrorCode_Success { if reply.Code != pb.ErrorCode_Success {
data, _ := anypb.New(&pb.NotifyErrorNotifyPush{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())})
data, _ := anypb.New(&pb.NotifyErrorNotifyPush{
ReqMainType: msg.MainType,
ReqSubType: msg.SubType,
Arg: msg.Data,
Code: pb.ErrorCode(reply.Code.Number())})
err = this.WriteMsg(&pb.UserMessage{ err = this.WriteMsg(&pb.UserMessage{
MainType: comm.MainTypeNotify, MainType: comm.MainTypeNotify,
SubType: comm.SubTypeErrorNotify, SubType: comm.SubTypeErrorNotify,

View File

@ -92,6 +92,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
if err1 != nil { if err1 != nil {
this.module.Errorf("PushHeroProperty err!") this.module.Errorf("PushHeroProperty err!")
} }
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroAwakenResp{Hero: _hero}) session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero})
return return
} }

View File

@ -12,6 +12,7 @@ import (
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
"strconv" "strconv"
"github.com/spf13/cast"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/anypb"
) )
@ -224,7 +225,8 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn, bPush bool)
code = this.ModuleUser.AddAttributeValue(uid, v.T, v.N, bPush) code = this.ModuleUser.AddAttributeValue(uid, v.T, v.N, bPush)
} else if v.A == comm.ItemType { //道具资源 } else if v.A == comm.ItemType { //道具资源
resID, _ = strconv.Atoi(v.T) resID = cast.ToInt(v.T)
// resID, _ = strconv.Atoi(v.T)
code = this.ModuleItems.AddItem(source, uid, int32(resID), v.N, bPush) code = this.ModuleItems.AddItem(source, uid, int32(resID), v.N, bPush)
} else if v.A == comm.HeroType { //卡片资源 } else if v.A == comm.HeroType { //卡片资源
resID, _ = strconv.Atoi(v.T) resID, _ = strconv.Atoi(v.T)

View File

@ -9,6 +9,7 @@ package pb
import ( import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
reflect "reflect" reflect "reflect"
sync "sync" sync "sync"
) )
@ -27,10 +28,12 @@ type NotifyErrorNotifyPush struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
ReqMainType string `protobuf:"bytes,1,opt,name=ReqMainType,proto3" json:"ReqMainType"` // 请求协议模块 模块名 例如:user 对应项目中 user的模块 ReqMainType string `protobuf:"bytes,1,opt,name=ReqMainType,proto3" json:"ReqMainType"` // 请求协议模块 模块名 例如:user 对应项目中 user的模块
ReqSubType string `protobuf:"bytes,2,opt,name=ReqSubType,proto3" json:"ReqSubType"` // 请求协议函数 例如:login 对应项目中 user的模块中 api_login 的处理函数 ReqSubType string `protobuf:"bytes,2,opt,name=ReqSubType,proto3" json:"ReqSubType"` // 请求协议函数 例如:login 对应项目中 user的模块中
// api_login 的处理函数
Code ErrorCode `protobuf:"varint,3,opt,name=Code,proto3,enum=ErrorCode" json:"Code"` // 执行返回错误码 对应 errorcode.proto 枚举 Code ErrorCode `protobuf:"varint,3,opt,name=Code,proto3,enum=ErrorCode" json:"Code"` // 执行返回错误码 对应 errorcode.proto 枚举
Message string `protobuf:"bytes,4,opt,name=Message,proto3" json:"Message"` // 错误消息 Message string `protobuf:"bytes,4,opt,name=Message,proto3" json:"Message"` // 错误消息
Data string `protobuf:"bytes,5,opt,name=Data,proto3" json:"Data"` // 错误数据 Arg *anypb.Any `protobuf:"bytes,5,opt,name=arg,proto3" json:"arg"` //参数信息
Data *anypb.Any `protobuf:"bytes,6,opt,name=Data,proto3" json:"Data"` // 错误数据
} }
func (x *NotifyErrorNotifyPush) Reset() { func (x *NotifyErrorNotifyPush) Reset() {
@ -93,11 +96,18 @@ func (x *NotifyErrorNotifyPush) GetMessage() string {
return "" return ""
} }
func (x *NotifyErrorNotifyPush) GetData() string { func (x *NotifyErrorNotifyPush) GetArg() *anypb.Any {
if x != nil {
return x.Arg
}
return nil
}
func (x *NotifyErrorNotifyPush) GetData() *anypb.Any {
if x != nil { if x != nil {
return x.Data return x.Data
} }
return "" return nil
} }
//获取系统公告 请求 //获取系统公告 请求
@ -202,26 +212,32 @@ var file_notify_notify_msg_proto_rawDesc = []byte{
0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x6e, 0x6f, 0x74, 0x69,
0x66, 0x79, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x79, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0xa7, 0x01, 0x0a, 0x15, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x45, 0x72, 0x72, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x6f, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, 0x01,
0x52, 0x65, 0x71, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0a, 0x15, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4e, 0x6f, 0x74,
0x09, 0x52, 0x0b, 0x52, 0x65, 0x71, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x69, 0x66, 0x79, 0x50, 0x75, 0x73, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x71, 0x4d, 0x61,
0x0a, 0x0a, 0x52, 0x65, 0x71, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x52, 0x65,
0x28, 0x09, 0x52, 0x0a, 0x52, 0x65, 0x71, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x71, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x71,
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x52,
0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x65, 0x71, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x04, 0x43, 0x6f, 0x64,
0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43,
0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x12, 0x0a, 0x10, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73,
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x03, 0x61, 0x72, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
0x22, 0x66, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x61, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x03, 0x61, 0x72, 0x67, 0x12, 0x28, 0x0a, 0x04, 0x44,
0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4c, 0x61, 0x73, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x74, 0x52, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x53, 0x79, 0x73, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52,
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x12, 0x0a, 0x10, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x47,
0x42, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x09, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x66, 0x0a, 0x11, 0x4e, 0x6f, 0x74,
0x79, 0x73, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x69, 0x66, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x0c, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x61, 0x64, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x09, 0x53, 0x79, 0x73, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d,
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x09, 0x53, 0x79, 0x73, 0x4e, 0x6f, 0x74, 0x69, 0x66,
0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (
@ -242,16 +258,19 @@ var file_notify_notify_msg_proto_goTypes = []interface{}{
(*NotifyGetListReq)(nil), // 1: NotifyGetListReq (*NotifyGetListReq)(nil), // 1: NotifyGetListReq
(*NotifyGetListResp)(nil), // 2: NotifyGetListResp (*NotifyGetListResp)(nil), // 2: NotifyGetListResp
(ErrorCode)(0), // 3: ErrorCode (ErrorCode)(0), // 3: ErrorCode
(*DBSystemNotify)(nil), // 4: DBSystemNotify (*anypb.Any)(nil), // 4: google.protobuf.Any
(*DBSystemNotify)(nil), // 5: DBSystemNotify
} }
var file_notify_notify_msg_proto_depIdxs = []int32{ var file_notify_notify_msg_proto_depIdxs = []int32{
3, // 0: NotifyErrorNotifyPush.Code:type_name -> ErrorCode 3, // 0: NotifyErrorNotifyPush.Code:type_name -> ErrorCode
4, // 1: NotifyGetListResp.SysNotify:type_name -> DBSystemNotify 4, // 1: NotifyErrorNotifyPush.arg:type_name -> google.protobuf.Any
2, // [2:2] is the sub-list for method output_type 4, // 2: NotifyErrorNotifyPush.Data:type_name -> google.protobuf.Any
2, // [2:2] is the sub-list for method input_type 5, // 3: NotifyGetListResp.SysNotify:type_name -> DBSystemNotify
2, // [2:2] is the sub-list for extension type_name 4, // [4:4] is the sub-list for method output_type
2, // [2:2] is the sub-list for extension extendee 4, // [4:4] is the sub-list for method input_type
0, // [0:2] is the sub-list for field type_name 4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
} }
func init() { file_notify_notify_msg_proto_init() } func init() { file_notify_notify_msg_proto_init() }

View File

@ -2,19 +2,21 @@ syntax = "proto3";
option go_package = ".;pb"; option go_package = ".;pb";
import "errorcode.proto"; import "errorcode.proto";
import "notify/notify_db.proto"; import "notify/notify_db.proto";
import "google/protobuf/any.proto";
// //
message NotifyErrorNotifyPush { message NotifyErrorNotifyPush {
string ReqMainType =1; // :user user的模块 string ReqMainType = 1; // :user user的模块
string ReqSubType = 2; // :login user的模块中 api_login string ReqSubType = 2; // :login user的模块中
// api_login
ErrorCode Code = 3; // errorcode.proto ErrorCode Code = 3; // errorcode.proto
string Message = 4; // string Message = 4; //
string Data = 5; // google.protobuf.Any arg = 5; //
google.protobuf.Any Data = 6; //
} }
// //
message NotifyGetListReq { message NotifyGetListReq {}
}
// //
message NotifyGetListResp { message NotifyGetListResp {