From e6cb3b71b2ccdd80ee66c8fcafc4d6607515eaed Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 25 Nov 2022 15:34:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A0=E7=BA=A2=E7=82=B9=E6=97=B6key?= =?UTF-8?q?=E4=B9=9F=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/v2/ui/views/reddot.go | 61 ++++++++++++++++++++++++++++++++++++++- modules/sociaty/module.go | 5 ++-- modules/task/module.go | 29 +++++++------------ 3 files changed, 73 insertions(+), 22 deletions(-) diff --git a/cmd/v2/ui/views/reddot.go b/cmd/v2/ui/views/reddot.go index 45b84cdc5..08f25858d 100644 --- a/cmd/v2/ui/views/reddot.go +++ b/cmd/v2/ui/views/reddot.go @@ -1,22 +1,35 @@ package formview import ( + "fmt" + "go_dreamfactory/cmd/v2/lib/common" "go_dreamfactory/cmd/v2/model" "go_dreamfactory/cmd/v2/service" + "go_dreamfactory/cmd/v2/service/observer" + "go_dreamfactory/comm" "go_dreamfactory/pb" "strings" "fyne.io/fyne/v2" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" "github.com/sirupsen/logrus" "github.com/spf13/cast" ) type ReddotView struct { + reddotList func() BaseformView + itemList *common.ItemList + flag bool } func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject { + this.itemList = common.NewItemList() + + this.itemList.ItemList = this.itemList.CreateList() + reddotTypeEntry := widget.NewEntry() this.form.AppendItem(widget.NewFormItem("红点类型", reddotTypeEntry)) @@ -33,5 +46,51 @@ func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject { logrus.Error(err) } } - return this.form + + this.reddotList = func() { + if err := service.GetPttService().SendToClient( + string(comm.ModuleReddot), + "getall", + &pb.ReddotGetAllReq{}); err != nil { + logrus.Error(err) + } + } + + defer this.reddotList() + + refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() { + this.itemList.Reset() + this.reddotList() + }) + + this.dataListener() + buttonBar := container.NewHBox(refreshBtn) + c := container.NewBorder(buttonBar, this.form, nil, nil, this.itemList.ItemList) + return c +} + +func (this *ReddotView) dataListener() { + this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{ + OnNotify: func(d interface{}, args ...interface{}) { + data := d.(*pb.UserMessage) + if !(data.MainType == string(comm.ModuleReddot) && + data.SubType == "getall") { + return + } + rsp := &pb.ReddotGetAllResp{} + + if !comm.ProtoUnmarshal(data, rsp) { + logrus.Error("unmarshal err") + } + + for k, v := range rsp.Reddot { + item := common.Item{ + Id: cast.ToString(k), + Text: fmt.Sprintf("%v - %v", k, v), + } + this.itemList.AddItem(item) + } + + }, + }) } diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 09a5e818e..f8e367fe7 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -141,9 +141,8 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( for _, v := range rid { switch v { case comm.Reddot3: - if ok := this.modelSociaty.IsSign(session.GetUserId(), sociaty); !ok { - reddot[comm.Reddot3] = true - } + tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty) + reddot[comm.Reddot3] = tf case comm.Reddot29: reddot[comm.Reddot29] = applyReddot } diff --git a/modules/task/module.go b/modules/task/module.go index 47e4dc99c..de480b92e 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -144,28 +144,21 @@ func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType for _, v := range rid { switch v { case comm.Reddot1: - if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY); ok { - reddot[comm.Reddot1] = ok - break - } + tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY) + reddot[comm.Reddot1] = tf case comm.Reddot2: - if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY); ok { - reddot[comm.Reddot2] = ok - break - } + tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY) + reddot[comm.Reddot2] = tf + case comm.Reddot4: - if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE); ok { - reddot[comm.Reddot4] = ok - break - } + tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE) + reddot[comm.Reddot4] = tf case comm.Reddot27: - if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY);ok{ - reddot[comm.Reddot27] = ok - } + tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY) + reddot[comm.Reddot27] = tf case comm.Reddot28: - if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY);ok{ - reddot[comm.Reddot28] = ok - } + tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY) + reddot[comm.Reddot28] = tf } } return From 9919a3797cff1b372756e6c04124c89493abe776 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 25 Nov 2022 16:44:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9C=AA=E5=8A=A0=E5=A6=82=E5=85=AC?= =?UTF-8?q?=E4=BC=9A=E4=B9=9F=E8=A6=81=E8=BF=94=E5=9B=9E=E7=BA=A2=E7=82=B9?= =?UTF-8?q?key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/reddot/api_getall.go | 7 +++++- modules/reddot/module.go | 6 +++++ modules/sociaty/module.go | 43 +++++++++++++++++++----------------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index 7d522f985..d6b8eda7a 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -21,7 +21,8 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success { return } - for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1, comm.Reddot2, comm.Reddot3, comm.Reddot4) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1, comm.Reddot2, comm.Reddot4, comm.Reddot27, + comm.Reddot28) { reddot[int32(k)] = v } for k, v := range this.module.mainline.Reddot(session, comm.Reddot5) { @@ -42,6 +43,10 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) for k, v := range this.module.gourmet.Reddot(session, comm.Reddot20, comm.Reddot21, comm.Reddot22) { reddot[int32(k)] = v } + + for k, v := range this.module.sociaty.Reddot(session, comm.Reddot3, comm.Reddot29) { + reddot[int32(k)] = v + } // for k, v := range this.module.mail.Reddot(session, comm.Reddot26) { // reddot[int32(k)] = v // } diff --git a/modules/reddot/module.go b/modules/reddot/module.go index 82b609e12..983cfef19 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -26,6 +26,7 @@ type Reddot struct { horoscope comm.IHoroscope arena comm.IArena gourmet comm.IGourmet + sociaty comm.ISociaty // mail comm.Imail api_comp *apiComp } @@ -68,6 +69,11 @@ func (this *Reddot) Start() (err error) { return } this.gourmet = module.(comm.IGourmet) + + if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil { + return + } + this.sociaty = module.(comm.ISociaty) // if module, err = this.service.GetModule(comm.ModuleMail); err != nil { // return // } diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index f8e367fe7..080dd1ada 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -124,29 +124,32 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( sociaty := this.modelSociaty.getUserSociaty(session.GetUserId()) if sociaty == nil || sociaty.Id == "" { log.Warn("公会红点未获得公会信息", log.Fields{"uid": session.GetUserId()}) - return - } - - var applyReddot bool - if this.modelSociaty.isRight(session.GetUserId(), sociaty, - pb.SociatyJob_PRESIDENT, - pb.SociatyJob_VICEPRESIDENT, - pb.SociatyJob_ADMIN) { - - if len(sociaty.ApplyRecord) > 0 { - applyReddot = true + for _, v := range rid { + reddot[v] = false } - return - } - for _, v := range rid { - switch v { - case comm.Reddot3: - tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty) - reddot[comm.Reddot3] = tf - case comm.Reddot29: - reddot[comm.Reddot29] = applyReddot + } else { + var applyReddot bool + if this.modelSociaty.isRight(session.GetUserId(), sociaty, + pb.SociatyJob_PRESIDENT, + pb.SociatyJob_VICEPRESIDENT, + pb.SociatyJob_ADMIN) { + + if len(sociaty.ApplyRecord) > 0 { + applyReddot = true + } + return + } + for _, v := range rid { + switch v { + case comm.Reddot3: + tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty) + reddot[comm.Reddot3] = tf + case comm.Reddot29: + reddot[comm.Reddot29] = applyReddot + } } } + return } From 8eaee8944a6b251f2e92162410e5f672cb560cc0 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 25 Nov 2022 18:00:28 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=AC=E4=BC=9A?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E7=BA=A2=E7=82=B9=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sociaty/model_sociaty.go | 2 ++ modules/sociaty/module.go | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 759641aea..fb0b47de8 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -225,6 +225,7 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) { sociaty); err != nil { this.moduleSociaty.Errorln(err) } + log.Debug("跨服获取公会信息", log.Fields{"uid": uid, "sociatyId": sociaty.Id}) } } @@ -680,6 +681,7 @@ func (this *ModelSociaty) sign(uid string, sociaty *pb.DBSociaty) error { } // 是否已签到 +// 已签到true 未签到false func (this *ModelSociaty) IsSign(uid string, sociaty *pb.DBSociaty) bool { if _, ok := utils.Findx(sociaty.SignIds, uid); ok { return ok diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 080dd1ada..e496053e8 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -137,13 +137,12 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) ( if len(sociaty.ApplyRecord) > 0 { applyReddot = true } - return } for _, v := range rid { switch v { case comm.Reddot3: tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty) - reddot[comm.Reddot3] = tf + reddot[comm.Reddot3] = !tf case comm.Reddot29: reddot[comm.Reddot29] = applyReddot } From 9ed9dc257e08b7cb4428f0172a96f5b154dfcd2f Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 25 Nov 2022 18:22:48 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_combatlevel.json | 5 ++++- bin/json/game_worldtask.json | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/json/game_combatlevel.json b/bin/json/game_combatlevel.json index 29eae9ea1..25e280100 100644 --- a/bin/json/game_combatlevel.json +++ b/bin/json/game_combatlevel.json @@ -69,7 +69,10 @@ { "id": 10004, "scene": "LevelDemo_Fcamer_1_4", - "formatList": [], + "formatList": [ + 101011, + 101021 + ], "droplist": [ 10401, 10402, diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index 54ab8239e..8a668e472 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -71,7 +71,7 @@ "npc": [ "dreamwork_restaurant_01", "波比组件名", - "140" + "701" ], "getafter_event": [ 2, @@ -95,7 +95,7 @@ "npc": [ "dreamwork_restaurant_01", "波比组件名", - "140" + "701" ], "getafter_event": [ 2, @@ -119,7 +119,7 @@ "npc": [ "dreamwork_restaurant_01", "波比组件名", - "140" + "701" ], "getafter_event": [ 2, @@ -184,7 +184,7 @@ 2, 100007 ], - "completetask": 174, + "completetask": 175, "auto_accept": 1, "overtips": 1, "reword": []