上传付费测试场景

This commit is contained in:
liwei1dao 2022-12-13 15:05:25 +08:00
parent 776dfc2811
commit cd408bfb7d
2 changed files with 53 additions and 0 deletions

52
busi/pay.go Normal file
View File

@ -0,0 +1,52 @@
package busi
import (
"time"
"legu.airobot/lib"
"legu.airobot/pb"
)
//竞技场场景
var _ lib.IScene = (*PayScene)(nil)
type PayScene struct {
lib.Action
}
func (f *PayScene) Info() lib.SceneInfo {
return lib.SceneInfo{
Name: "支付",
Desc: "充值模拟",
}
}
func (f *PayScene) Run(ai lib.IRobot) (err error) {
var (
code pb.ErrorCode
)
if code = ai.SendMsg("pay", "dailybuy", &pb.PayDailyBuyReq{
Id: 1,
}, &pb.PayDailyBuyResp{}); code != pb.ErrorCode_Success {
ai.Stop()
return
}
time.Sleep(time.Second)
if code = ai.SendMsg("pay", "dailybuy", &pb.PayDailyBuyReq{
Id: 2,
}, &pb.PayDailyBuyResp{}); code != pb.ErrorCode_Success {
ai.Stop()
return
}
time.Sleep(time.Second)
if code = ai.SendMsg("privilege", "buyyueka", &pb.PrivilegeBuyYuekaReq{
CID: "yueka_lv1",
}, &pb.PrivilegeBuyYuekaResp{}); code != pb.ErrorCode_Success {
ai.Stop()
return
}
time.Sleep(time.Second)
return
}

View File

@ -38,6 +38,7 @@ func init() {
&busi.ShopScene{},
&busi.ArenaScene{},
&busi.ReddotScene{},
&busi.PayScene{},
)
}