update
This commit is contained in:
parent
91034d61b0
commit
340494ec96
@ -8,6 +8,7 @@ import (
|
||||
const (
|
||||
USER_LOGIN = "user.login"
|
||||
SOCIATY_MINE = "sociaty.mine"
|
||||
SOCIATY_LIST = "sociaty.list"
|
||||
)
|
||||
|
||||
func Sleep(min, max time.Duration) {
|
||||
|
@ -22,41 +22,96 @@ type SociatyScene struct {
|
||||
|
||||
func (s *SociatyScene) Info() lib.SceneInfo {
|
||||
return lib.SceneInfo{
|
||||
Name: "公会申请",
|
||||
Desc: "bbb",
|
||||
Name: "公会",
|
||||
Desc: "模拟公会所有操作",
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SociatyScene) Run(robot lib.IRobot) error {
|
||||
randInt := randomdata.Number(100)
|
||||
if randInt%2 == 0 {
|
||||
s.createSociaty(robot, false)
|
||||
} else {
|
||||
s.createSociaty(robot, true)
|
||||
}
|
||||
|
||||
time.Sleep(time.Second)
|
||||
|
||||
s.mine(robot)
|
||||
|
||||
var sociatyMineResp *pb.SociatyMineResp
|
||||
sociatyMineI := robot.Get(SOCIATY_MINE)
|
||||
if sociatyMineI != nil {
|
||||
sociatyMineResp = sociatyMineI.(*pb.SociatyMineResp)
|
||||
if sociatyMineResp.Sociaty == nil {
|
||||
s.queryAndApply(robot)
|
||||
}
|
||||
} else {
|
||||
s.queryAndApply(robot)
|
||||
}
|
||||
|
||||
createSociaty(robot)
|
||||
Sleep(time.Second, time.Second*3)
|
||||
mine(robot)
|
||||
return nil
|
||||
}
|
||||
|
||||
// 创建公会
|
||||
func createSociaty(robot lib.IRobot) {
|
||||
func (s *SociatyScene) createSociaty(robot lib.IRobot, isApplyCheck bool) {
|
||||
req := &pb.SociatyCreateReq{}
|
||||
rsp := &pb.SociatyCreateResp{}
|
||||
|
||||
req.Name = fmt.Sprintf("%s_%s", randomdata.SillyName(), randomdata.City())
|
||||
req.IsApplyCheck = false
|
||||
req.IsApplyCheck = isApplyCheck
|
||||
req.ApplyLv = 1
|
||||
if code := robot.SendMsg(SociatyMainType, "create", req, rsp); code != pb.ErrorCode_Success {
|
||||
logrus.Debugf("公会创建:%v", code)
|
||||
return
|
||||
}
|
||||
|
||||
logrus.Debug("创建公会完成")
|
||||
}
|
||||
|
||||
func mine(robot lib.IRobot) {
|
||||
func (s *SociatyScene) mine(robot lib.IRobot) {
|
||||
req := &pb.SociatyMineReq{}
|
||||
rsp := &pb.SociatyMineResp{}
|
||||
|
||||
if code := robot.SendMsg(SociatyMainType, "mine", req, rsp); code != pb.ErrorCode_Success {
|
||||
logrus.Debugf("我的公会:%v", code)
|
||||
return
|
||||
}
|
||||
|
||||
robot.Store(SOCIATY_MINE, rsp)
|
||||
logrus.Debug("我的公会")
|
||||
}
|
||||
|
||||
func (s *SociatyScene) list(robot lib.IRobot) {
|
||||
req := &pb.SociatyListReq{
|
||||
Filter: pb.SociatyListFilter_ALL,
|
||||
}
|
||||
rsp := &pb.SociatyListResp{}
|
||||
|
||||
if code := robot.SendMsg("sociaty", "list", req, rsp); code == pb.ErrorCode_Success {
|
||||
robot.Store(SOCIATY_LIST, rsp)
|
||||
}
|
||||
logrus.Debug("公会列表")
|
||||
}
|
||||
|
||||
func (s *SociatyScene) apply(robot lib.IRobot, sociatyId string) {
|
||||
req := &pb.SociatyApplyReq{
|
||||
SociatyId: sociatyId,
|
||||
}
|
||||
rsp := &pb.SociatyApplyResp{}
|
||||
if code := robot.SendMsg("sociaty", "apply", req, rsp); code == pb.ErrorCode_Success {
|
||||
s.mine(robot)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SociatyScene) queryAndApply(robot lib.IRobot) {
|
||||
s.list(robot)
|
||||
var sociatyListResp *pb.SociatyListResp
|
||||
listRspI := robot.Get(SOCIATY_LIST)
|
||||
if listRspI != nil {
|
||||
sociatyListResp = listRspI.(*pb.SociatyListResp)
|
||||
if len(sociatyListResp.List) > 0 {
|
||||
//申请公会
|
||||
s.apply(robot, sociatyListResp.List[0].Id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
387
busi/task.go
387
busi/task.go
@ -1,6 +1,9 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"legu.airobot/lib"
|
||||
"legu.airobot/pb"
|
||||
)
|
||||
@ -18,11 +21,11 @@ func (task *TaskScene) Info() lib.SceneInfo {
|
||||
}
|
||||
|
||||
func (task *TaskScene) Run(robot lib.IRobot) error {
|
||||
|
||||
task.batchDo(robot)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (task *TaskScene) TaskList(robot lib.IRobot, tag int32) error{
|
||||
func (task *TaskScene) TaskList(robot lib.IRobot, tag int32) error {
|
||||
req := &pb.TaskListReq{
|
||||
TaskTag: tag,
|
||||
}
|
||||
@ -33,3 +36,383 @@ func (task *TaskScene) TaskList(robot lib.IRobot, tag int32) error{
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type TaskCondi struct {
|
||||
Rtype int32
|
||||
Params []int32
|
||||
}
|
||||
|
||||
func (task *TaskScene) batchDo(robot lib.IRobot) {
|
||||
reqDataMap := map[int32]TaskCondi{
|
||||
101: {1, []int32{1, 25001}},
|
||||
// 102: {2, []int32{1, 3}},
|
||||
// 103: {3, []int32{1, 2}},
|
||||
// 104: {4, []int32{10, 14007}},
|
||||
// 105: {5, []int32{2, 25001}},
|
||||
// 106: {6, []int32{5, 25004}},
|
||||
// 107: {7, []int32{1}},
|
||||
// 108: {8, []int32{1}},
|
||||
// 109: {9, []int32{1}},
|
||||
// 110: {10, []int32{2}},
|
||||
// 111: {11, []int32{1}},
|
||||
// 112: {12, []int32{1}},
|
||||
// 113: {13, []int32{2}},
|
||||
// 114: {14, []int32{10}},
|
||||
// 115: {15, []int32{10}},
|
||||
// 116: {16, []int32{5, 3}},
|
||||
// 117: {17, []int32{1, 3}},
|
||||
// 118: {18, []int32{1}},
|
||||
// 119: {19, []int32{2}},
|
||||
// 120: {20, []int32{1}},
|
||||
// 121: {21, []int32{2}},
|
||||
// 122: {22, []int32{25001}},
|
||||
// 123: {23, []int32{3, 5, 20}},
|
||||
// 124: {24, []int32{4}},
|
||||
// 125: {25, []int32{3, 25001, 6}},
|
||||
// 126: {26, []int32{1}},
|
||||
// 127: {27, []int32{1}},
|
||||
// 128: {28, []int32{1}},
|
||||
// 129: {29, []int32{2, 22, 25004}},
|
||||
// 130: {30, []int32{5, 3}},
|
||||
// 131: {31, []int32{4, 3}},
|
||||
// 132: {32, []int32{3, 3, 20}},
|
||||
// 133: {33, []int32{3, 3, 23}},
|
||||
// 134: {34, []int32{5, 2}},
|
||||
// 135: {35, []int32{2, 25001}},
|
||||
// 136: {36, []int32{1, 3, 3, 1, 2}},
|
||||
// 137: {37, []int32{1, 3}},
|
||||
// 138: {38, []int32{1}},
|
||||
// 139: {39, []int32{2}},
|
||||
// 140: {40, []int32{2, 2}},
|
||||
// 141: {41, []int32{2, 2, 1}},
|
||||
// 142: {42, []int32{2, 2, 2}},
|
||||
// 143: {43, []int32{2, 2}},
|
||||
// 144: {44, []int32{3}},
|
||||
// 145: {45, []int32{2, 1, 1, 2}},
|
||||
// 146: {46, []int32{1, 4, 1}},
|
||||
// 147: {47, []int32{2}},
|
||||
// 148: {48, []int32{1, 1, 2}},
|
||||
// 149: {49, []int32{1, 1, 2}},
|
||||
// 150: {50, []int32{1, 1}},
|
||||
// 151: {51, []int32{1, 1}},
|
||||
// 152: {52, []int32{1, 14007}},
|
||||
// 153: {53, []int32{2}},
|
||||
// 154: {54, []int32{1}},
|
||||
// 155: {55, []int32{2, 3}},
|
||||
// 156: {56, []int32{1, 1, 2}},
|
||||
// 157: {57, []int32{1}},
|
||||
// 158: {58, []int32{1}},
|
||||
// 159: {59, []int32{1}},
|
||||
// 160: {60, []int32{1}},
|
||||
// 161: {61, []int32{109}},
|
||||
// 162: {62, []int32{2}},
|
||||
// 163: {63, []int32{1}},
|
||||
// 164: {64, []int32{2}},
|
||||
// 165: {65, []int32{2, 10001}},
|
||||
// 166: {66, []int32{2, 1}},
|
||||
// 167: {67, []int32{1000, 1}},
|
||||
// 168: {68, []int32{1000, 1}},
|
||||
// 169: {69, []int32{1}},
|
||||
// 170: {1, []int32{44006}},
|
||||
// 171: {70, []int32{1, 101}},
|
||||
// 172: {18, []int32{10}},
|
||||
// 173: {72, []int32{1}},
|
||||
// 174: {70, []int32{1, 101}},
|
||||
// 175: {70, []int32{1, 102}},
|
||||
// 176: {70, []int32{1, 103}},
|
||||
// 177: {70, []int32{1, 104}},
|
||||
// 178: {70, []int32{1, 105}},
|
||||
// 179: {70, []int32{1, 106}},
|
||||
// 180: {70, []int32{1, 107}},
|
||||
// 181: {70, []int32{1, 108}},
|
||||
// 182: {70, []int32{1, 109}},
|
||||
// 183: {140, []int32{1, 10001}},
|
||||
// 184: {140, []int32{1, 10002}},
|
||||
// 185: {140, []int32{1, 10003}},
|
||||
// 186: {140, []int32{1, 10004}},
|
||||
// 187: {109, []int32{1}},
|
||||
// 188: {104, []int32{100}},
|
||||
// 189: {70, []int32{1, 110}},
|
||||
// 190: {70, []int32{1, 111, 1, 1, 1}},
|
||||
// 191: {70, []int32{1, 112, 2, 2, 2}},
|
||||
// 192: {70, []int32{1, 113, 3, 3, 3}},
|
||||
// 193: {70, []int32{1, 114, 4, 4, 4}},
|
||||
// 195: {140, []int32{1, 10005}},
|
||||
// 196: {140, []int32{1, 10006}},
|
||||
// 197: {140, []int32{1, 10007}},
|
||||
// 198: {140, []int32{1, 10008}},
|
||||
// 199: {140, []int32{1, 10009}},
|
||||
// 200: {140, []int32{1, 10010}},
|
||||
// 201: {140, []int32{1, 10007}},
|
||||
// 202: {140, []int32{1, 10007}},
|
||||
// 10001: {24, []int32{1}},
|
||||
// 10002: {24, []int32{5}},
|
||||
// 10003: {24, []int32{10}},
|
||||
// 10004: {24, []int32{20}},
|
||||
// 10005: {24, []int32{50}},
|
||||
// 10006: {24, []int32{100}},
|
||||
// 10007: {24, []int32{200}},
|
||||
// 10008: {24, []int32{300}},
|
||||
// 10009: {24, []int32{500}},
|
||||
// 10010: {24, []int32{1000}},
|
||||
// 10101: {7, []int32{1}},
|
||||
// 10201: {18, []int32{1}},
|
||||
// 10202: {18, []int32{5}},
|
||||
// 10203: {18, []int32{10}},
|
||||
// 10204: {18, []int32{20}},
|
||||
// 10205: {18, []int32{50}},
|
||||
// 10206: {18, []int32{100}},
|
||||
// 10207: {18, []int32{200}},
|
||||
// 10208: {18, []int32{300}},
|
||||
// 10209: {18, []int32{500}},
|
||||
// 10210: {18, []int32{1000}},
|
||||
// 10301: {18, []int32{1, 5}},
|
||||
// 10302: {50, []int32{5, 5}},
|
||||
// 10303: {50, []int32{10, 5}},
|
||||
// 10304: {50, []int32{20, 5}},
|
||||
// 10305: {50, []int32{50, 5}},
|
||||
// 10306: {50, []int32{100, 5}},
|
||||
// 10307: {50, []int32{200, 5}},
|
||||
// 10308: {50, []int32{300, 5}},
|
||||
// 10309: {50, []int32{500, 5}},
|
||||
// 10310: {50, []int32{1000, 5}},
|
||||
// 10401: {50, []int32{1, 6}},
|
||||
// 10402: {50, []int32{5, 6}},
|
||||
// 10403: {50, []int32{10, 6}},
|
||||
// 10404: {50, []int32{20, 6}},
|
||||
// 10405: {50, []int32{50, 6}},
|
||||
// 10406: {50, []int32{100, 6}},
|
||||
// 10407: {50, []int32{200, 6}},
|
||||
// 10408: {50, []int32{300, 6}},
|
||||
// 10409: {50, []int32{500, 6}},
|
||||
// 10410: {50, []int32{1000, 6}},
|
||||
// 10501: {58, []int32{1}},
|
||||
// 10502: {58, []int32{5}},
|
||||
// 10503: {58, []int32{10}},
|
||||
// 10504: {58, []int32{20}},
|
||||
// 10505: {58, []int32{30}},
|
||||
// 10506: {58, []int32{50}},
|
||||
// 10507: {58, []int32{70}},
|
||||
// 10508: {58, []int32{100}},
|
||||
// 10601: {62, []int32{1}},
|
||||
// 10602: {62, []int32{5}},
|
||||
// 10603: {62, []int32{99}},
|
||||
// 10701: {64, []int32{1}},
|
||||
// 10702: {64, []int32{5}},
|
||||
// 10703: {64, []int32{10}},
|
||||
// 10704: {64, []int32{20}},
|
||||
// 10705: {64, []int32{50}},
|
||||
// 10706: {64, []int32{100}},
|
||||
// 10707: {64, []int32{200}},
|
||||
// 10708: {64, []int32{300}},
|
||||
// 10709: {64, []int32{500}},
|
||||
// 10710: {64, []int32{1000}},
|
||||
// 10801: {8, []int32{1}},
|
||||
// 10802: {8, []int32{5}},
|
||||
// 10803: {8, []int32{10}},
|
||||
// 10804: {8, []int32{20}},
|
||||
// 10805: {8, []int32{50}},
|
||||
// 10806: {8, []int32{100}},
|
||||
// 10807: {8, []int32{200}},
|
||||
// 10808: {8, []int32{300}},
|
||||
// 10809: {8, []int32{500}},
|
||||
// 10810: {18, []int32{1000}},
|
||||
// 2008001: {8, []int32{1}},
|
||||
// 2012001: {12, []int32{1}},
|
||||
// 2018001: {18, []int32{1}},
|
||||
// 2024001: {24, []int32{1}},
|
||||
// 2047001: {47, []int32{1}},
|
||||
// 2062001: {62, []int32{1}},
|
||||
// 2064001: {64, []int32{1}},
|
||||
// 2130001: {130, []int32{3}},
|
||||
// 3008001: {8, []int32{10}},
|
||||
// 3012001: {12, []int32{10}},
|
||||
// 3018001: {18, []int32{5}},
|
||||
// 3024001: {24, []int32{5}},
|
||||
// 3047001: {47, []int32{7}},
|
||||
// 3061001: {62, []int32{7}},
|
||||
// 3064001: {64, []int32{7}},
|
||||
// 3088001: {88, []int32{3}},
|
||||
// 3105001: {105, []int32{10}},
|
||||
// 3104001: {104, []int32{1000}},
|
||||
// 3130001: {130, []int32{30}},
|
||||
// 4008001: {8, []int32{3}},
|
||||
// 4008002: {8, []int32{7}},
|
||||
// 4008003: {8, []int32{30}},
|
||||
// 4008004: {8, []int32{90}},
|
||||
// 4008005: {8, []int32{180}},
|
||||
// 4008006: {8, []int32{365}},
|
||||
// 4008007: {9, []int32{3}},
|
||||
// 4008008: {9, []int32{7}},
|
||||
// 4008009: {9, []int32{14}},
|
||||
// 4008010: {9, []int32{30}},
|
||||
// 4010001: {10, []int32{1}},
|
||||
// 4010002: {10, []int32{5}},
|
||||
// 4010003: {10, []int32{10}},
|
||||
// 4010004: {10, []int32{20}},
|
||||
// 4010005: {10, []int32{30}},
|
||||
// 4010006: {10, []int32{50}},
|
||||
// 4011001: {11, []int32{5}},
|
||||
// 4011002: {11, []int32{10}},
|
||||
// 4011003: {11, []int32{30}},
|
||||
// 4011004: {11, []int32{50}},
|
||||
// 4011005: {11, []int32{100}},
|
||||
// 4011006: {11, []int32{300}},
|
||||
// 4011007: {11, []int32{500}},
|
||||
// 4011008: {11, []int32{1000}},
|
||||
// 4011009: {11, []int32{3000}},
|
||||
// 4011010: {11, []int32{5000}},
|
||||
// 4011011: {11, []int32{10000}},
|
||||
// 4012001: {12, []int32{1}},
|
||||
// 4012002: {12, []int32{5}},
|
||||
// 4012003: {12, []int32{10}},
|
||||
// 4012004: {12, []int32{30}},
|
||||
// 4012005: {12, []int32{50}},
|
||||
// 4012006: {12, []int32{100}},
|
||||
// 4012007: {12, []int32{300}},
|
||||
// 4012008: {12, []int32{500}},
|
||||
// 4012009: {12, []int32{1000}},
|
||||
// 4016001: {16, []int32{1, 5}},
|
||||
// 4016002: {16, []int32{2, 5}},
|
||||
// 4016003: {16, []int32{3, 5}},
|
||||
// 4016004: {16, []int32{5, 5}},
|
||||
// 4016005: {16, []int32{10, 5}},
|
||||
// 4016006: {16, []int32{15, 5}},
|
||||
// 4016007: {16, []int32{20, 5}},
|
||||
// 4016008: {16, []int32{30, 5}},
|
||||
// 4016009: {16, []int32{50, 5}},
|
||||
// 4018001: {18, []int32{10}},
|
||||
// 4018002: {18, []int32{20}},
|
||||
// 4018003: {18, []int32{30}},
|
||||
// 4018004: {18, []int32{50}},
|
||||
// 4018005: {18, []int32{100}},
|
||||
// 4018006: {18, []int32{200}},
|
||||
// 4018007: {18, []int32{300}},
|
||||
// 4018008: {18, []int32{500}},
|
||||
// 4018009: {18, []int32{1000}},
|
||||
// 4018010: {18, []int32{2000}},
|
||||
// 4018011: {18, []int32{5000}},
|
||||
// 4018012: {18, []int32{10000}},
|
||||
// 4020001: {20, []int32{10}},
|
||||
// 4020002: {20, []int32{20}},
|
||||
// 4020003: {20, []int32{30}},
|
||||
// 4020004: {20, []int32{40}},
|
||||
// 4020005: {20, []int32{50}},
|
||||
// 4020006: {20, []int32{60}},
|
||||
// 4043001: {43, []int32{1, 15}},
|
||||
// 4043002: {43, []int32{2, 15}},
|
||||
// 4043003: {43, []int32{4, 15}},
|
||||
// 4043004: {43, []int32{6, 15}},
|
||||
// 4043005: {43, []int32{12, 15}},
|
||||
// 4043006: {43, []int32{18, 15}},
|
||||
// 4043007: {43, []int32{24, 15}},
|
||||
// 4043008: {43, []int32{30, 15}},
|
||||
// 4043009: {43, []int32{60, 15}},
|
||||
// 4043010: {43, []int32{120, 15}},
|
||||
// 4047001: {47, []int32{10}},
|
||||
// 4047002: {47, []int32{20}},
|
||||
// 4047003: {47, []int32{30}},
|
||||
// 4047004: {47, []int32{50}},
|
||||
// 4047005: {47, []int32{100}},
|
||||
// 4047006: {47, []int32{200}},
|
||||
// 4047007: {47, []int32{300}},
|
||||
// 4047008: {47, []int32{500}},
|
||||
// 4047009: {47, []int32{1000}},
|
||||
// 4047010: {47, []int32{2000}},
|
||||
// 4047011: {47, []int32{3000}},
|
||||
// 4047012: {47, []int32{5000}},
|
||||
// 4047013: {47, []int32{10000}},
|
||||
// 4064001: {64, []int32{5}},
|
||||
// 4064002: {64, []int32{10}},
|
||||
// 4064003: {64, []int32{20}},
|
||||
// 4064004: {64, []int32{50}},
|
||||
// 4064005: {64, []int32{100}},
|
||||
// 4064006: {64, []int32{200}},
|
||||
// 4064007: {64, []int32{500}},
|
||||
// 4068001: {68, []int32{50000}},
|
||||
// 4068002: {68, []int32{500000}},
|
||||
// 4068003: {68, []int32{5000000}},
|
||||
// 4068004: {68, []int32{50000000}},
|
||||
// 4084001: {84, []int32{10}},
|
||||
// 4084002: {84, []int32{20}},
|
||||
// 4084003: {84, []int32{50}},
|
||||
// 4084004: {84, []int32{100}},
|
||||
// 4085001: {85, []int32{5}},
|
||||
// 4085002: {85, []int32{10}},
|
||||
// 4085003: {85, []int32{20}},
|
||||
// 4085004: {85, []int32{30}},
|
||||
// 4085005: {85, []int32{50}},
|
||||
// 4096001: {96, []int32{10}},
|
||||
// 4096002: {96, []int32{20}},
|
||||
// 4096003: {96, []int32{50}},
|
||||
// 4096004: {96, []int32{100}},
|
||||
// 4096005: {96, []int32{200}},
|
||||
// 4096006: {96, []int32{300}},
|
||||
// 4096007: {96, []int32{500}},
|
||||
// 4096008: {96, []int32{1000}},
|
||||
// 4096009: {96, []int32{2000}},
|
||||
// 4096010: {96, []int32{3000}},
|
||||
// 4096011: {96, []int32{5000}},
|
||||
// 4096012: {96, []int32{10000}},
|
||||
// 4104001: {104, []int32{500}},
|
||||
// 4104002: {104, []int32{1000}},
|
||||
// 4104003: {104, []int32{3000}},
|
||||
// 4104004: {104, []int32{5000}},
|
||||
// 4104005: {104, []int32{10000}},
|
||||
// 4104006: {104, []int32{20000}},
|
||||
// 4104007: {104, []int32{30000}},
|
||||
// 4104008: {104, []int32{50000}},
|
||||
// 4104009: {104, []int32{100000}},
|
||||
// 4104010: {104, []int32{200000}},
|
||||
// 4104011: {104, []int32{500000}},
|
||||
4128001: {128, []int32{1100}},
|
||||
4128002: {128, []int32{1200}},
|
||||
4128003: {128, []int32{1300}},
|
||||
4128004: {128, []int32{1400}},
|
||||
4128005: {128, []int32{1500}},
|
||||
4128006: {128, []int32{1600}},
|
||||
4128007: {128, []int32{1700}},
|
||||
4128008: {128, []int32{1800}},
|
||||
4128009: {128, []int32{1900}},
|
||||
4128010: {128, []int32{2000}},
|
||||
4131001: {131, []int32{5}},
|
||||
4131002: {131, []int32{10}},
|
||||
4131003: {131, []int32{20}},
|
||||
4131004: {131, []int32{30}},
|
||||
4131005: {131, []int32{50}},
|
||||
4131006: {131, []int32{100}},
|
||||
4131007: {131, []int32{200}},
|
||||
4131008: {131, []int32{300}},
|
||||
4131009: {131, []int32{500}},
|
||||
4131010: {131, []int32{1000}},
|
||||
5011001: {11, []int32{3}},
|
||||
5012001: {12, []int32{1}},
|
||||
5018001: {18, []int32{1}},
|
||||
5024001: {24, []int32{1}},
|
||||
5047001: {47, []int32{6}},
|
||||
5063001: {63, []int32{100}},
|
||||
5068001: {68, []int32{200000}},
|
||||
5104001: {104, []int32{100}},
|
||||
}
|
||||
|
||||
for k, v := range reqDataMap {
|
||||
flag := task.doRtask(robot, v.Rtype, v.Params)
|
||||
logrus.WithFields(logrus.Fields{"id": k, "rtype": v.Rtype, "params": v.Params, "flag": flag}).Debug("任务执行")
|
||||
time.Sleep(time.Millisecond * 1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (task *TaskScene) doRtask(robot lib.IRobot, rtype int32, params []int32) bool {
|
||||
req := &pb.RtaskTestReq{
|
||||
RtaskType: rtype,
|
||||
Params: params,
|
||||
}
|
||||
rsp := &pb.RtaskTestResp{}
|
||||
if code := robot.SendMsg("rtask", "rtest", req, rsp); code != pb.ErrorCode_Success {
|
||||
logrus.Debugf("code:%v", code)
|
||||
return false
|
||||
}
|
||||
|
||||
return rsp.Flag
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ func (m *Robot) Start() bool {
|
||||
|
||||
m.conn = conn
|
||||
|
||||
if err := m.conn.SetReadDeadline(time.Now().Add(20 * time.Second)); err != nil {
|
||||
if err := m.conn.SetReadDeadline(time.Now().Add(600 * time.Second)); err != nil {
|
||||
logrus.Error("SetReadDeadline %v", err)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user