修改gui方便调试

This commit is contained in:
wh_zcy 2022-09-27 00:03:34 +08:00
parent e413ad0999
commit 31687fc973
3 changed files with 60 additions and 26 deletions

View File

@ -35,7 +35,7 @@ func (this *RtaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
res := widget.NewEntry() res := widget.NewEntry()
res.PlaceHolder = "已完成任务列表" res.PlaceHolder = "已完成任务列表"
this.form.AppendItem(widget.NewFormItem("任务列表", res)) this.form.AppendItem(widget.NewFormItem("", res))
// task list button // task list button
taskListBtn := widget.NewButtonWithIcon("任务列表", theme.ConfirmIcon(), func() { 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 // layout
split := container.NewHSplit(this.dataListWidget, container.NewVBox(this.form, taskListBtn, modiResBtn)) split := container.NewHSplit(this.dataListWidget, container.NewVBox(this.form, taskListBtn, modiResBtn))
split.Offset = 1 split.Offset = 0.7
//data listener for //data listener for
this.dataListener() this.dataListener()

View File

@ -4,8 +4,10 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cast"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@ -20,13 +22,7 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
rsp.Flag = false rsp.Flag = false
log.Errorf("%v", errors.WithMessage(err, session.GetUserId())) log.Errorf("%v", errors.WithMessage(err, session.GetUserId()))
} }
} else { } else if req.GroupId != 0 {
if code = this.moduleRtask.SendToRtask(session, comm.TaskType(req.RtaskType), req.Params...); code != pb.ErrorCode_Success {
rsp.Flag = false
}
}
if req.GroupId != 0 {
// 获取当前玩家 // 获取当前玩家
rtask := this.moduleRtask.modelRtask.GetRtask(session.GetUserId()) rtask := this.moduleRtask.modelRtask.GetRtask(session.GetUserId())
if rtask == nil { if rtask == nil {
@ -34,12 +30,26 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
return return
} }
ids := make([]int32, 0) rtaskIds := make([]int32, 0)
if v, ok := rtask.FrtaskIds[req.GroupId]; ok { 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 { if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtest", rsp); err != nil {

View File

@ -822,6 +822,7 @@ type RtaskTestReq struct {
Params []int32 `protobuf:"varint,2,rep,packed,name=params,proto3" json:"params"` //参数 Params []int32 `protobuf:"varint,2,rep,packed,name=params,proto3" json:"params"` //参数
CondiId int32 `protobuf:"varint,3,opt,name=condiId,proto3" json:"condiId"` //条件ID CondiId int32 `protobuf:"varint,3,opt,name=condiId,proto3" json:"condiId"` //条件ID
GroupId int32 `protobuf:"varint,4,opt,name=groupId,proto3" json:"groupId"` //分组编号 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() { func (x *RtaskTestReq) Reset() {
@ -884,6 +885,13 @@ func (x *RtaskTestReq) GetGroupId() int32 {
return 0 return 0
} }
func (x *RtaskTestReq) GetRtaskIds() string {
if x != nil {
return x.RtaskIds
}
return ""
}
type RtaskTestResp struct { type RtaskTestResp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache 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, 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, 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, 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, 0x64, 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52,
0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05,
0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64,
0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20,
0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x0d, 0x52, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73,
0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61,
0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (