Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c641ca65ca
@ -1,22 +1,35 @@
|
|||||||
package formview
|
package formview
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
"go_dreamfactory/cmd/v2/model"
|
"go_dreamfactory/cmd/v2/model"
|
||||||
"go_dreamfactory/cmd/v2/service"
|
"go_dreamfactory/cmd/v2/service"
|
||||||
|
"go_dreamfactory/cmd/v2/service/observer"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/theme"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ReddotView struct {
|
type ReddotView struct {
|
||||||
|
reddotList func()
|
||||||
BaseformView
|
BaseformView
|
||||||
|
itemList *common.ItemList
|
||||||
|
flag bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
|
this.itemList = common.NewItemList()
|
||||||
|
|
||||||
|
this.itemList.ItemList = this.itemList.CreateList()
|
||||||
|
|
||||||
reddotTypeEntry := widget.NewEntry()
|
reddotTypeEntry := widget.NewEntry()
|
||||||
|
|
||||||
this.form.AppendItem(widget.NewFormItem("红点类型", reddotTypeEntry))
|
this.form.AppendItem(widget.NewFormItem("红点类型", reddotTypeEntry))
|
||||||
@ -33,5 +46,51 @@ func (this *ReddotView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|||||||
logrus.Error(err)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
|
|||||||
if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
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
|
reddot[int32(k)] = v
|
||||||
}
|
}
|
||||||
for k, v := range this.module.mainline.Reddot(session, comm.Reddot5) {
|
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) {
|
for k, v := range this.module.gourmet.Reddot(session, comm.Reddot20, comm.Reddot21, comm.Reddot22) {
|
||||||
reddot[int32(k)] = v
|
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) {
|
// for k, v := range this.module.mail.Reddot(session, comm.Reddot26) {
|
||||||
// reddot[int32(k)] = v
|
// reddot[int32(k)] = v
|
||||||
// }
|
// }
|
||||||
|
@ -26,6 +26,7 @@ type Reddot struct {
|
|||||||
horoscope comm.IHoroscope
|
horoscope comm.IHoroscope
|
||||||
arena comm.IArena
|
arena comm.IArena
|
||||||
gourmet comm.IGourmet
|
gourmet comm.IGourmet
|
||||||
|
sociaty comm.ISociaty
|
||||||
// mail comm.Imail
|
// mail comm.Imail
|
||||||
api_comp *apiComp
|
api_comp *apiComp
|
||||||
}
|
}
|
||||||
@ -68,6 +69,11 @@ func (this *Reddot) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.gourmet = module.(comm.IGourmet)
|
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 {
|
// if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
@ -225,6 +225,7 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) {
|
|||||||
sociaty); err != nil {
|
sociaty); err != nil {
|
||||||
this.moduleSociaty.Errorln(err)
|
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 {
|
func (this *ModelSociaty) IsSign(uid string, sociaty *pb.DBSociaty) bool {
|
||||||
if _, ok := utils.Findx(sociaty.SignIds, uid); ok {
|
if _, ok := utils.Findx(sociaty.SignIds, uid); ok {
|
||||||
return ok
|
return ok
|
||||||
|
@ -124,30 +124,31 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
|
|||||||
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||||
if sociaty == nil || sociaty.Id == "" {
|
if sociaty == nil || sociaty.Id == "" {
|
||||||
log.Warn("公会红点未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
log.Warn("公会红点未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
||||||
return
|
for _, v := range rid {
|
||||||
}
|
reddot[v] = false
|
||||||
|
|
||||||
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
|
} else {
|
||||||
}
|
var applyReddot bool
|
||||||
for _, v := range rid {
|
if this.modelSociaty.isRight(session.GetUserId(), sociaty,
|
||||||
switch v {
|
pb.SociatyJob_PRESIDENT,
|
||||||
case comm.Reddot3:
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
if ok := this.modelSociaty.IsSign(session.GetUserId(), sociaty); !ok {
|
pb.SociatyJob_ADMIN) {
|
||||||
reddot[comm.Reddot3] = true
|
|
||||||
|
if len(sociaty.ApplyRecord) > 0 {
|
||||||
|
applyReddot = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
}
|
}
|
||||||
case comm.Reddot29:
|
|
||||||
reddot[comm.Reddot29] = applyReddot
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,28 +144,21 @@ func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType
|
|||||||
for _, v := range rid {
|
for _, v := range rid {
|
||||||
switch v {
|
switch v {
|
||||||
case comm.Reddot1:
|
case comm.Reddot1:
|
||||||
if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY); ok {
|
tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY)
|
||||||
reddot[comm.Reddot1] = ok
|
reddot[comm.Reddot1] = tf
|
||||||
break
|
|
||||||
}
|
|
||||||
case comm.Reddot2:
|
case comm.Reddot2:
|
||||||
if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY); ok {
|
tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY)
|
||||||
reddot[comm.Reddot2] = ok
|
reddot[comm.Reddot2] = tf
|
||||||
break
|
|
||||||
}
|
|
||||||
case comm.Reddot4:
|
case comm.Reddot4:
|
||||||
if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE); ok {
|
tf, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE)
|
||||||
reddot[comm.Reddot4] = ok
|
reddot[comm.Reddot4] = tf
|
||||||
break
|
|
||||||
}
|
|
||||||
case comm.Reddot27:
|
case comm.Reddot27:
|
||||||
if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY);ok{
|
tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY)
|
||||||
reddot[comm.Reddot27] = ok
|
reddot[comm.Reddot27] = tf
|
||||||
}
|
|
||||||
case comm.Reddot28:
|
case comm.Reddot28:
|
||||||
if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY);ok{
|
tf, _ := this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY)
|
||||||
reddot[comm.Reddot28] = ok
|
reddot[comm.Reddot28] = tf
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user