From 868d2ca99a7a0ea7d4bc11fb060bb358245b08a3 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 22 Sep 2022 21:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A3=85=E5=A4=87=E5=BC=BA?= =?UTF-8?q?=E5=8C=96=E5=88=86=E4=BA=AB=E8=B6=85=E9=93=BE=E6=8E=A5=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/chat/module.go | 22 +++++++++++++++------- modules/equipment/api_upgrade.go | 5 +++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/modules/chat/module.go b/modules/chat/module.go index f74070a8b..c90656f72 100644 --- a/modules/chat/module.go +++ b/modules/chat/module.go @@ -121,13 +121,21 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter Content: fmt.Sprintf(st.Text, agrs...), } if ctype == comm.EquipmentUpgradeNotice { //装备分享 - msg.Ctype = pb.ChatType_EquipmentShare - } - if appenddata != nil { - if jsonStr, err = json.Marshal(appenddata); err != nil { - this.Errorf("err:%v", err) - } else { - msg.AppendStr = string(jsonStr) + msg.Ctype = pb.ChatType_Share + if appenddata != nil { + if jsonStr, err = json.Marshal(appenddata); err != nil { + this.Errorf("err:%v", err) + } else { + data := map[string]interface{}{ + "0": map[string]interface{}{ + "key": "0", + "appendStr": jsonStr, + "itemType": 1, + }, + } + jsonStr, _ = json.Marshal(data) + msg.AppendStr = string(jsonStr) + } } } code = this.modelChat.sendSystemChat(msg) diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index 7b35d95ae..287129aef 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -185,13 +185,14 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { var color *cfg.GameGameColorData if color, err = this.module.configure.GetColor(conf.Color); err == nil { - this.module.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, equipment, equipment.Lv, fmt.Sprintf("[color=%s]%s[/color]", color.Color, user.Name), conf.Name) + this.module.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, equipment, equipment.Lv, fmt.Sprintf("[color=%s]%s[/color]", color.Color, user.Name), conf.Name) + } else { + this.module.Errorf("GetColor err:%s", err.Error()) } } else { this.module.Errorf("no found userdata uid:%s", session.GetUserId()) } } - session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments}) return }