File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ public ResponseResult sendMention(MentionMessage message) throws Exception {
130130 }
131131
132132 sb .append ("&objectName=" ).append (URLEncoder .encode (message .getContent ().getContent ().getType (), UTF8 ));
133- sb .append ("&content=" ).append (URLEncoder .encode (message .getContent ().getContent (). toString (), UTF8 ));
133+ sb .append ("&content=" ).append (URLEncoder .encode (message .getContent ().toString (), UTF8 ));
134134
135135 if (message .getPushContent () != null ) {
136136 sb .append ("&pushContent=" ).append (URLEncoder .encode (message .getPushContent ().toString (), UTF8 ));
Original file line number Diff line number Diff line change 11package io .rong .models .message ;
22
3+ import com .alibaba .fastjson .JSONObject ;
4+
35import io .rong .messages .BaseMessage ;
4- import io .rong .util .GsonUtil ;
56
67/**
78 * @author RongCloud
@@ -33,6 +34,24 @@ public void setMentionedInfo(MentionedInfo mentionedInfo) {
3334
3435 @ Override
3536 public String toString (){
36- return GsonUtil .toJson (this , MentionMessageContent .class );
37+ JSONObject atMessage = new JSONObject ();
38+
39+ if (content != null ) {
40+ JSONObject baseMessage = new JSONObject ();
41+ baseMessage = JSONObject .parseObject (content .toString ());
42+
43+ atMessage .put ("content" , baseMessage .get ("content" ));
44+ atMessage .put ("extra" , baseMessage .get ("extra" ));
45+
46+ if (mentionedInfo != null ) {
47+ JSONObject mention = new JSONObject ();
48+ mention .put ("type" , mentionedInfo .getType ());
49+ mention .put ("userIdList" , mentionedInfo .getUserIds ());
50+ mention .put ("mentionedContent" , mentionedInfo .getPushContent ());
51+
52+ atMessage .put ("mentionedInfo" , mention );
53+ }
54+ }
55+ return atMessage .toJSONString ();
3756 }
3857}
You can’t perform that action at this time.
0 commit comments