更新测试工具

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" Icon = "app.png"
Name = "RobotGUI" Name = "RobotGUI"
ID = "cc.legu.app" ID = "cc.legu.app"
Version = "1.0.5" Version = "1.0.6"
Build = 5 Build = 7

View File

@ -26,6 +26,7 @@ type ConnService interface {
SendMsg(msg *pb.UserMessage, rsp proto.Message) (err error) SendMsg(msg *pb.UserMessage, rsp proto.Message) (err error)
ReceiveMsg() (code pb.ErrorCode, msg *pb.UserMessage) ReceiveMsg() (code pb.ErrorCode, msg *pb.UserMessage)
ListenerPush() ListenerPush()
Close()
} }
type ConnServiceImpl struct { type ConnServiceImpl struct {
@ -173,3 +174,9 @@ func (c *ConnServiceImpl) handleNotify(msg *pb.UserMessage) (code pb.ErrorCode)
} }
return 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() { func (ui *MainWindowImpl) quiteHandle() {
ui.parent.Show()
ui.w.Close() ui.w.Close()
ui.connService.Close()
} }
// CreateWindow .... // CreateWindow ....
@ -139,6 +141,9 @@ func (ui *MainWindowImpl) CreateWindow(_ string, width, height float32, _ bool)
} }
} }
}) })
w.SetCloseIntercept(func() {
ui.parent.Show()
})
_ = ui.createChooseServerPopUp(w) _ = ui.createChooseServerPopUp(w)
} }
@ -194,6 +199,10 @@ func (ui *MainWindowImpl) createChooseServerWindow(
w.SetFixedSize(true) w.SetFixedSize(true)
w.Resize(fyne.NewSize(500, 200)) w.Resize(fyne.NewSize(500, 200))
w.Show() w.Show()
w.SetCloseIntercept(func() {
ui.parent.Show()
w.Close()
})
w.CenterOnScreen() w.CenterOnScreen()
return w return w
} }
@ -327,4 +336,8 @@ func (ui *MainWindowImpl) NewWelcomeLabel(data string) {
)), )),
)) ))
ui.w.SetContent(c) 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.CenterOnScreen()
w.SetCloseIntercept(func() {
ui.parent.Show()
w.Close()
})
w.Show() w.Show()
} }

View File

@ -22,7 +22,7 @@ import (
type TaskActiveListView struct { type TaskActiveListView struct {
ListBaseView ListBaseView
activeVal int32 activeVal *widget.Label
} }
func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject { func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject {
@ -46,7 +46,7 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
}) })
//label //label
activeLabel := widget.NewLabel(fmt.Sprintf("当前活跃度:%d", this.activeVal)) this.activeVal = widget.NewLabel("")
//receive button //receive button
receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() { receiveBtn := widget.NewButtonWithIcon("领取", theme.ConfirmIcon(), func() {
@ -63,7 +63,7 @@ func (this *TaskActiveListView) CreateView(t *model.TestCase) fyne.CanvasObject
}) })
// layout // 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 split.Offset = 1
//data listener for //data listener for
@ -86,7 +86,7 @@ func (this *TaskActiveListView) dataListener() {
logrus.Error("unmarshal err") logrus.Error("unmarshal err")
} }
this.activeVal = rsp.Active this.activeVal.SetText(fmt.Sprintf("当前活跃度:%v", rsp.Active))
this.itemListData = model.NewItemModelList() this.itemListData = model.NewItemModelList()
for _, v := range rsp.List { 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) { 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) err = this.Get(uid, record)
if err != nil { 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 { if record.Vals == nil {
record.Id = primitive.NewObjectID().Hex()
data := &pb.RtaskData{ data := &pb.RtaskData{
Data: toMap(vals...), Data: toMap(vals...),
Rtype: cfg.Type, Rtype: cfg.Type,