处理关注与弹幕红包问题

This commit is contained in:
liaozetao
2023-10-26 19:50:03 +08:00
parent e3e6ae7cbf
commit 14ee0fae3e
2 changed files with 18 additions and 9 deletions

View File

@@ -33,16 +33,21 @@ public class UserChatMsgListener implements ApplicationListener<UserChatMsgEvent
IMChatMsgDTO chatMsg = (IMChatMsgDTO) source;
String content = chatMsg.getBody();
if (StrUtil.isEmpty(content) && StrUtil.isNotEmpty(chatMsg.getAttach())) {
if (chatMsg.getAttachObj() == null) {
try {
chatMsg.setAttachObj(JSONUtil.toBean(chatMsg.getAttach(), IMChatMsgDTO.Attach.class));
} catch (Exception ignored) {
String attach = chatMsg.getAttach();
if (attach.startsWith(StrUtil.DELIM_START) && attach.endsWith(StrUtil.DELIM_END)) {
if (chatMsg.getAttachObj() == null) {
try {
chatMsg.setAttachObj(JSONUtil.toBean(chatMsg.getAttach(), IMChatMsgDTO.Attach.class));
} catch (Exception ignored) {
}
}
}
IMChatMsgDTO.Attach attachObj = chatMsg.getAttachObj();
if (attachObj != null && StrUtil.isNotEmpty(attachObj.getUrl())) {
content = attachObj.getUrl();
IMChatMsgDTO.Attach attachObj = chatMsg.getAttachObj();
if (attachObj != null && StrUtil.isNotEmpty(attachObj.getUrl())) {
content = attachObj.getUrl();
}
} else {
content = attach;
}
}
Long fromUid = null;

View File

@@ -14,7 +14,11 @@ class FollowRedEnvelopeStrategy : InRoomRedEnvelopeStrategy() {
val uid = context.uid
val redEnvelope = getRedEnvelope(redEnvelopeId!!)
val redEnvelopeUid = redEnvelope.userId
return fansService!!.likedExists(uid, redEnvelopeUid)
return if (!redEnvelopeUid.equals(uid)) {
fansService!!.likedExists(uid, redEnvelopeUid)
} else {
true
}
}
override fun beforeOpen(context: RedEnvelopeContext) {