diff --git a/cmd/v2/ui/views/rtask_list.go b/cmd/v2/ui/views/rtask_list.go index 89161c6a4..314082dfb 100644 --- a/cmd/v2/ui/views/rtask_list.go +++ b/cmd/v2/ui/views/rtask_list.go @@ -35,7 +35,7 @@ func (this *RtaskListView) CreateView(t *model.TestCase) fyne.CanvasObject { res := widget.NewEntry() res.PlaceHolder = "已完成任务列表" - this.form.AppendItem(widget.NewFormItem("任务列表", res)) + this.form.AppendItem(widget.NewFormItem("", res)) // task list button taskListBtn := widget.NewButtonWithIcon("任务列表", theme.ConfirmIcon(), func() { @@ -50,11 +50,25 @@ func (this *RtaskListView) CreateView(t *model.TestCase) fyne.CanvasObject { } }) - modiResBtn := widget.NewButtonWithIcon("修改任务", theme.ConfirmIcon(), func() {}) + modiResBtn := widget.NewButtonWithIcon("修改任务", theme.ConfirmIcon(), func() { + if res.Text != "" { + if err := service.GetPttService().SendToClient( + t.MainType, + "rtest", + &pb.RtaskTestReq{ + RtaskIds: res.Text, + GroupId: cast.ToInt32(input.Text), + }, + ); err != nil { + logrus.Error(err) + return + } + } + }) // layout split := container.NewHSplit(this.dataListWidget, container.NewVBox(this.form, taskListBtn, modiResBtn)) - split.Offset = 1 + split.Offset = 0.7 //data listener for this.dataListener() diff --git a/modules/rtask/api_tasktest.go b/modules/rtask/api_tasktest.go index 4dd5531de..0d9cfc7f8 100644 --- a/modules/rtask/api_tasktest.go +++ b/modules/rtask/api_tasktest.go @@ -4,8 +4,10 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + "strings" "github.com/pkg/errors" + "github.com/spf13/cast" "google.golang.org/protobuf/proto" ) @@ -20,13 +22,7 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod rsp.Flag = false log.Errorf("%v", errors.WithMessage(err, session.GetUserId())) } - } else { - if code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...); code != pb.ErrorCode_Success { - rsp.Flag = false - } - } - - if req.GroupId != 0 { + } else if req.GroupId != 0 { // 获取当前玩家 rtask := this.moduleRtask.modelRtask.GetRtask(session.GetUserId()) if rtask == nil { @@ -34,12 +30,26 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod return } - ids := make([]int32, 0) + rtaskIds := make([]int32, 0) if v, ok := rtask.FrtaskIds[req.GroupId]; ok { - ids = v.RtaskIds + ids := strings.Split(req.RtaskIds, ",") + for _, id := range ids { + rtaskIds = append(rtaskIds, cast.ToInt32(id)) + } + v.RtaskIds = rtaskIds + } + + update := map[string]interface{}{ + "frtaskIds": rtask.FrtaskIds, + } + + this.moduleRtask.modelRtask.Change(rtask.Uid, update) + + } else { + if code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...); code != pb.ErrorCode_Success { + rsp.Flag = false } - rsp.RtaskIds = ids } if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtest", rsp); err != nil { diff --git a/pb/rtask_msg.pb.go b/pb/rtask_msg.pb.go index 0014493a7..cb82b0bb5 100644 --- a/pb/rtask_msg.pb.go +++ b/pb/rtask_msg.pb.go @@ -822,6 +822,7 @@ type RtaskTestReq struct { Params []int32 `protobuf:"varint,2,rep,packed,name=params,proto3" json:"params"` //参数 CondiId int32 `protobuf:"varint,3,opt,name=condiId,proto3" json:"condiId"` //条件ID GroupId int32 `protobuf:"varint,4,opt,name=groupId,proto3" json:"groupId"` //分组编号 + RtaskIds string `protobuf:"bytes,5,opt,name=rtaskIds,proto3" json:"rtaskIds"` //已完成的任务ids } func (x *RtaskTestReq) Reset() { @@ -884,6 +885,13 @@ func (x *RtaskTestReq) GetGroupId() int32 { return 0 } +func (x *RtaskTestReq) GetRtaskIds() string { + if x != nil { + return x.RtaskIds + } + return "" +} + type RtaskTestResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1011,19 +1019,21 @@ var file_rtask_rtask_msg_proto_rawDesc = []byte{ 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x22, 0x78, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, - 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, - 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x0d, 0x52, - 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, - 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, + 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, + 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a, + 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, + 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (