diff --git a/cmd/v2/ui/views/sociaty_mine.go b/cmd/v2/ui/views/sociaty_mine.go index 074c1c80e..7a9174275 100644 --- a/cmd/v2/ui/views/sociaty_mine.go +++ b/cmd/v2/ui/views/sociaty_mine.go @@ -1,6 +1,7 @@ package formview import ( + "errors" "fmt" "go_dreamfactory/cmd/v2/lib/common" "go_dreamfactory/cmd/v2/model" @@ -288,48 +289,62 @@ func (this *SociatyMineView) dataListener(item *entryItem) { this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{ OnNotify: func(d interface{}, args ...interface{}) { data := d.(*pb.UserMessage) - if !(data.MainType == string(comm.ModuleSociaty) && - data.SubType == sociaty.SociatySubTypeMine) { - return - } - rsp := &pb.SociatyMineResp{} + if data.MainType == string(comm.ModuleSociaty) { + switch data.SubType { + case sociaty.SociatySubTypeMine: + rsp := &pb.SociatyMineResp{} - if !comm.ProtoUnmarshal(data, rsp) { - logrus.Error("unmarshal err") - return - } + if !comm.ProtoUnmarshal(data, rsp) { + logrus.Error("unmarshal err") + return + } - if rsp.Sociaty == nil { - logrus.Debug("公会信息 nil") - // item = &entryItem{} - dialog.ShowInformation("提示", "未加入公会", this.w) - return - } + if rsp.Sociaty == nil { + logrus.Debug("公会信息 nil") + // item = &entryItem{} + dialog.ShowInformation("提示", "未加入公会", this.w) + return + } - this.sociaty = rsp.Sociaty - this.master = rsp.Master - // this.ticket = rsp.Ticket + this.sociaty = rsp.Sociaty + this.master = rsp.Master + // this.ticket = rsp.Ticket - //设置成员职位 - for _, m := range rsp.Sociaty.Members { - if m.Uid == this.uid { - logrus.Debug(m.Uid) - this.job = m.Job - break + //设置成员职位 + for _, m := range rsp.Sociaty.Members { + if m.Uid == this.uid { + logrus.Debug(m.Uid) + this.job = m.Job + 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 @@ -628,15 +643,23 @@ func (this *SociatyMineView) memberListen() { // 签到 func (this *SociatyMineView) showSignWin() { + this.loadSociaty() var lastCount int32 if this.sociaty == nil { logrus.Error("公会 is nil") 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.OnTapped = func() { defer btn.Disable() @@ -655,7 +678,7 @@ func (this *SociatyMineView) showSignWin() { 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.Resize(fyne.NewSize(400, 600)) dconf.Show() diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 7727988be..5b759c9ed 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -321,8 +321,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) { } stime := time.Now() // 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.Background() + ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + // ctx := context.Background() if len(serviceTag) == 0 { // 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 { diff --git a/modules/sociaty/api_cross_sign.go b/modules/sociaty/api_cross_sign.go index 970f26666..fc75544cb 100644 --- a/modules/sociaty/api_cross_sign.go +++ b/modules/sociaty/api_cross_sign.go @@ -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 { - 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()}) return } diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index c47212f3b..54976bc45 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -332,7 +332,7 @@ func (this *ModelSociaty) isRight(uid string, sociaty *pb.DBSociaty, jobs ...pb. return false } -// 更新公会经验 +// 更新公会 func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error { if this.module.IsCross() { return this.ChangeList(comm.RDS_EMPTY, sociatyId, update) diff --git a/modules/sociaty/model_sociatylog.go b/modules/sociaty/model_sociatylog.go index c16dfcae5..5b03ae8eb 100644 --- a/modules/sociaty/model_sociatylog.go +++ b/modules/sociaty/model_sociatylog.go @@ -162,7 +162,8 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string) func (this *ModelSociatyLog) logList(sociatyId string) (slist []*pb.SociatyLog) { sociatyLog := &pb.DBSociatyLog{} 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 }