Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
dfcd65eecd
@ -189,6 +189,9 @@ func (r *Robot) onUserLoaded() {
|
|||||||
|
|
||||||
//task
|
//task
|
||||||
r.RunTask()
|
r.RunTask()
|
||||||
|
|
||||||
|
// story
|
||||||
|
r.RunStory()
|
||||||
}
|
}
|
||||||
|
|
||||||
//注册账号
|
//注册账号
|
||||||
|
45
cmd/robot/story.go
Normal file
45
cmd/robot/story.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package robot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/modules/story"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
storyBuilders = []*TestCase{
|
||||||
|
{
|
||||||
|
desc: "主线数据",
|
||||||
|
mainType: string(comm.ModuleStory),
|
||||||
|
subType: story.StoryGetListResp,
|
||||||
|
req: &pb.StoryGetListReq{},
|
||||||
|
rsp: &pb.StoryGetListResp{},
|
||||||
|
print: func(rsp proto.Message) {
|
||||||
|
out := rsp.(*pb.StoryGetListResp)
|
||||||
|
for i, v := range out.Data {
|
||||||
|
fmt.Printf("%d- %v\n", (i + 1), v)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
}, {
|
||||||
|
desc: "主线详情",
|
||||||
|
mainType: string(comm.ModuleStory),
|
||||||
|
subType: story.StoryChallengeResp,
|
||||||
|
req: &pb.StoryChallengeReq{
|
||||||
|
ChapterId: 1,
|
||||||
|
StoryId: 1,
|
||||||
|
},
|
||||||
|
rsp: &pb.StoryChallengeResp{},
|
||||||
|
// enabled: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
//声明加入到构建器并发起请求
|
||||||
|
func (r *Robot) RunStory() {
|
||||||
|
r.addBuilders(storyBuilders)
|
||||||
|
r.batchHandleReq()
|
||||||
|
}
|
@ -11,6 +11,8 @@ import (
|
|||||||
|
|
||||||
mengine "github.com/dengsgo/math-engine/engine"
|
mengine "github.com/dengsgo/math-engine/engine"
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelHero struct {
|
type ModelHero struct {
|
||||||
@ -22,6 +24,10 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
|
|||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleHero = module.(*Hero)
|
this.moduleHero = module.(*Hero)
|
||||||
this.TableName = "hero"
|
this.TableName = "hero"
|
||||||
|
// 通过uid创建索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user