This commit is contained in:
meixiongfeng 2023-04-13 19:22:50 +08:00
commit e305cd1264
6 changed files with 70 additions and 46 deletions

View File

@ -1,6 +1,7 @@
package formview package formview
import ( import (
"errors"
"fmt" "fmt"
"go_dreamfactory/cmd/v2/lib/common" "go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model" "go_dreamfactory/cmd/v2/model"
@ -288,48 +289,62 @@ func (this *SociatyMineView) dataListener(item *entryItem) {
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{ this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
OnNotify: func(d interface{}, args ...interface{}) { OnNotify: func(d interface{}, args ...interface{}) {
data := d.(*pb.UserMessage) data := d.(*pb.UserMessage)
if !(data.MainType == string(comm.ModuleSociaty) && if data.MainType == string(comm.ModuleSociaty) {
data.SubType == sociaty.SociatySubTypeMine) { switch data.SubType {
return case sociaty.SociatySubTypeMine:
} rsp := &pb.SociatyMineResp{}
rsp := &pb.SociatyMineResp{}
if !comm.ProtoUnmarshal(data, rsp) { if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err") logrus.Error("unmarshal err")
return return
} }
if rsp.Sociaty == nil { if rsp.Sociaty == nil {
logrus.Debug("公会信息 nil") logrus.Debug("公会信息 nil")
// item = &entryItem{} // item = &entryItem{}
dialog.ShowInformation("提示", "未加入公会", this.w) dialog.ShowInformation("提示", "未加入公会", this.w)
return return
} }
this.sociaty = rsp.Sociaty this.sociaty = rsp.Sociaty
this.master = rsp.Master this.master = rsp.Master
// this.ticket = rsp.Ticket // this.ticket = rsp.Ticket
//设置成员职位 //设置成员职位
for _, m := range rsp.Sociaty.Members { for _, m := range rsp.Sociaty.Members {
if m.Uid == this.uid { if m.Uid == this.uid {
logrus.Debug(m.Uid) logrus.Debug(m.Uid)
this.job = m.Job this.job = m.Job
break break
}
}
logrus.Debugf("公会:%v", rsp.Sociaty)
item.sociatyName.Text = rsp.Sociaty.Name
item.notice.Text = rsp.Sociaty.Notice
item.icon.Text = rsp.Sociaty.Icon
item.isApplyCheck.Checked = rsp.Sociaty.IsApplyCheck
item.applyLv.Text = cast.ToString(rsp.Sociaty.ApplyLv)
item.lv.Text = cast.ToString(rsp.Sociaty.Lv)
item.exp.Text = cast.ToString(rsp.Sociaty.Exp)
item.activity.Text = cast.ToString(rsp.Sociaty.Activity)
this.form.Refresh()
//踢人
case sociaty.SociatySubTypeDischarge:
rsp := &pb.SociatyDischargeResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
if rsp.SociatyId == "" {
dialog.ShowError(errors.New("踢人失败"), this.w)
} else {
common.ShowTip("踢人成功")
}
} }
} }
logrus.Debugf("公会:%v", rsp.Sociaty)
item.sociatyName.Text = rsp.Sociaty.Name
item.notice.Text = rsp.Sociaty.Notice
item.icon.Text = rsp.Sociaty.Icon
item.isApplyCheck.Checked = rsp.Sociaty.IsApplyCheck
item.applyLv.Text = cast.ToString(rsp.Sociaty.ApplyLv)
item.lv.Text = cast.ToString(rsp.Sociaty.Lv)
item.exp.Text = cast.ToString(rsp.Sociaty.Exp)
item.activity.Text = cast.ToString(rsp.Sociaty.Activity)
this.form.Refresh()
}, },
}) })
this.flag_mine = true this.flag_mine = true
@ -628,15 +643,23 @@ func (this *SociatyMineView) memberListen() {
// 签到 // 签到
func (this *SociatyMineView) showSignWin() { func (this *SociatyMineView) showSignWin() {
this.loadSociaty()
var lastCount int32 var lastCount int32
if this.sociaty == nil { if this.sociaty == nil {
logrus.Error("公会 is nil") logrus.Error("公会 is nil")
return return
} }
lastCount = this.sociaty.LastSignCount
card := canvas.NewText(cast.ToString(lastCount), nil) // 昨日签到
card.TextSize = 50 lastCount = this.sociaty.LastSignCount
lastSignCard := canvas.NewText(cast.ToString(lastCount), nil)
lastSignCard.TextSize = 50
// 已签到数
todaySignCount := len(this.sociaty.SignIds)
signedCard := canvas.NewText(cast.ToString(todaySignCount), nil)
signedCard.TextSize = 50
btn := widget.NewButton("签到", nil) btn := widget.NewButton("签到", nil)
btn.OnTapped = func() { btn.OnTapped = func() {
defer btn.Disable() defer btn.Disable()
@ -655,7 +678,7 @@ func (this *SociatyMineView) showSignWin() {
btn.Disable() btn.Disable()
} }
l := container.NewVBox(container.NewCenter(card), btn) l := container.NewVBox(container.NewCenter(lastSignCard), btn, container.NewCenter(signedCard))
dconf := dialog.NewCustom("签到", "关闭", l, this.w) dconf := dialog.NewCustom("签到", "关闭", l, this.w)
dconf.Resize(fyne.NewSize(400, 600)) dconf.Resize(fyne.NewSize(400, 600))
dconf.Show() dconf.Show()

View File

@ -117,7 +117,7 @@ func (this *modelChatComp) getChatQueue(channel pb.ChatChannel, stag, union stri
this.addChatMsg(key, int64(max_chat), result...) this.addChatMsg(key, int64(max_chat), result...)
} }
} }
} else { } else if err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
} }
return return

View File

@ -321,8 +321,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
} }
stime := time.Now() stime := time.Now()
// this.gateway.Debugf("----------3 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // this.gateway.Debugf("----------3 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType)
// ctx, _ := context.WithTimeout(context.Background(), time.Second*5) ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
ctx := context.Background() // ctx := context.Background()
if len(serviceTag) == 0 { if len(serviceTag) == 0 {
// this.gateway.Debugf("----------4 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType) // this.gateway.Debugf("----------4 agent:%s uId:%s MainType:%s SubType:%s ", this.sessionId, this.uId, msg.MainType, msg.SubType)
if err = this.gateway.Service().RpcCall(ctx, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil { if err = this.gateway.Service().RpcCall(ctx, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil {

View File

@ -40,7 +40,7 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co
// 签到 // 签到
if err := this.module.modelSociaty.sign(uid, sociaty); err != nil { if err := this.module.modelSociaty.sign(uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyAgree code = pb.ErrorCode_SociatySign
this.module.Error("签到失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: sociaty.Id}, log.Field{Key: "err", Value: err.Error()}) this.module.Error("签到失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: sociaty.Id}, log.Field{Key: "err", Value: err.Error()})
return return
} }

View File

@ -332,7 +332,7 @@ func (this *ModelSociaty) isRight(uid string, sociaty *pb.DBSociaty, jobs ...pb.
return false return false
} }
// 更新公会经验 // 更新公会
func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error { func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error {
if this.module.IsCross() { if this.module.IsCross() {
return this.ChangeList(comm.RDS_EMPTY, sociatyId, update) return this.ChangeList(comm.RDS_EMPTY, sociatyId, update)

View File

@ -162,7 +162,8 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
func (this *ModelSociatyLog) logList(sociatyId string) (slist []*pb.SociatyLog) { func (this *ModelSociatyLog) logList(sociatyId string) (slist []*pb.SociatyLog) {
sociatyLog := &pb.DBSociatyLog{} sociatyLog := &pb.DBSociatyLog{}
if err := this.Get(sociatyId, sociatyLog); err != nil { if err := this.Get(sociatyId, sociatyLog); err != nil {
log.Error("公会日志列表", log.Field{Key: "sociatyId", Value: sociatyId}) log.Error("公会日志列表", log.Field{Key: "sociatyId", Value: sociatyId},
log.Field{Key: "err", Value: err})
return nil return nil
} }