更新测试工具

This commit is contained in:
wh_zcy 2022-09-20 22:08:54 +08:00
parent ec54e9030c
commit 802427073c
6 changed files with 35 additions and 8 deletions

View File

@ -4,5 +4,5 @@ Website = "http://legu.cc"
Icon = "app.png"
Name = "RobotGUI"
ID = "cc.legu.app"
Version = "1.0.5"
Build = 5
Version = "1.0.6"
Build = 7

View File

@ -26,6 +26,7 @@ type ConnService interface {
SendMsg(msg *pb.UserMessage, rsp proto.Message) (err error)
ReceiveMsg() (code pb.ErrorCode, msg *pb.UserMessage)
ListenerPush()
Close()
}
type ConnServiceImpl struct {
@ -173,3 +174,9 @@ func (c *ConnServiceImpl) handleNotify(msg *pb.UserMessage) (code pb.ErrorCode)
}
return
}
func (c *ConnServiceImpl) Close() {
if err := c.ws.Close(); err != nil {
logrus.Errorf("close ws conn err: %v", err)
}
}

View File

@ -111,7 +111,9 @@ func (ui *MainWindowImpl) SetStatusMsg(msg string) {
}
func (ui *MainWindowImpl) quiteHandle() {
ui.parent.Show()
ui.w.Close()
ui.connService.Close()
}
// CreateWindow ....
@ -139,6 +141,9 @@ func (ui *MainWindowImpl) CreateWindow(_ string, width, height float32, _ bool)
}
}
})
w.SetCloseIntercept(func() {
ui.parent.Show()
})
_ = ui.createChooseServerPopUp(w)
}
@ -194,6 +199,10 @@ func (ui *MainWindowImpl) createChooseServerWindow(
w.SetFixedSize(true)
w.Resize(fyne.NewSize(500, 200))
w.Show()
w.SetCloseIntercept(func() {
ui.parent.Show()
w.Close()
})
w.CenterOnScreen()
return w
}
@ -327,4 +336,8 @@ func (ui *MainWindowImpl) NewWelcomeLabel(data string) {
)),
))
ui.w.SetContent(c)
ui.w.SetCloseIntercept(func() {
ui.w.Close()
ui.parent.Show()
})
}

View File

@ -89,5 +89,9 @@ func (ui *ToolWindowImpl) CreateWindow(title string, width, height float32, _ bo
}
})
w.CenterOnScreen()
w.SetCloseIntercept(func() {
ui.parent.Show()
w.Close()
})
w.Show()
}

View File

@ -22,7 +22,7 @@ import (
type TaskActiveListView struct {
ListBaseView
activeVal int32
activeVal *widget.Label
}
func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject {
@ -46,7 +46,7 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
})
//label
activeLabel := widget.NewLabel(fmt.Sprintf("当前活跃度:%d", this.activeVal))
this.activeVal = widget.NewLabel("")
//receive button
receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() {
@ -63,7 +63,7 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
})
// layout
split := container.NewHSplit(this.dataListWidget, container.NewVBox(activeLabel, this.form, taskListBtn, receiveBtn))
split := container.NewHSplit(this.dataListWidget, container.NewVBox(this.activeVal, this.form, taskListBtn, receiveBtn))
split.Offset = 1
//data listener for
@ -86,7 +86,7 @@ func (this *TaskActiveListView) dataListener() {
logrus.Error("unmarshal err")
}
this.activeVal = rsp.Active
this.activeVal.SetText(fmt.Sprintf("当前活跃度:%v", rsp.Active))
this.itemListData = model.NewItemModelList()
for _, v := range rsp.List {

View File

@ -71,13 +71,16 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
// 累计更新 - 招募等
func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) {
record := &pb.DBRtaskRecord{}
record := &pb.DBRtaskRecord{Uid: uid}
err = this.Get(uid, record)
if err != nil {
return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
if err != mongo.ErrNoDocuments {
return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
}
}
if record.Vals == nil {
record.Id = primitive.NewObjectID().Hex()
data := &pb.RtaskData{
Data: toMap(vals...),
Rtype: cfg.Type,