This commit is contained in:
wh_zcy 2023-04-13 18:41:34 +08:00
parent 955bf81c56
commit 946c3dc2b2
5 changed files with 69 additions and 45 deletions

View File

@ -1,6 +1,7 @@
package formview
import (
"errors"
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
@ -288,10 +289,9 @@ 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
}
if data.MainType == string(comm.ModuleSociaty) {
switch data.SubType {
case sociaty.SociatySubTypeMine:
rsp := &pb.SociatyMineResp{}
if !comm.ProtoUnmarshal(data, rsp) {
@ -330,6 +330,21 @@ func (this *SociatyMineView) dataListener(item *entryItem) {
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("踢人成功")
}
}
}
},
})
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()

View File

@ -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 {

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 {
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
}

View File

@ -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)

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) {
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
}