Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
im-common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈永峰
im-common
Commits
b06cbce1
Unverified
Commit
b06cbce1
authored
Nov 04, 2021
by
Yang Libin
Committed by
GitHub
Nov 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: msg element type (#48)
parent
394f71f2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
10 deletions
+31
-10
README.md
README.md
+1
-1
pom.xml
pom.xml
+1
-1
TIMMsgElement.java
.../java/io/github/doocs/im/model/message/TIMMsgElement.java
+14
-0
version.properties
src/main/resources/version.properties
+1
-1
MessageTest.java
src/test/java/io/github/doocs/im/MessageTest.java
+14
-7
No files found.
README.md
View file @
b06cbce1
...
@@ -22,7 +22,7 @@ Add the Maven dependency:
...
@@ -22,7 +22,7 @@ Add the Maven dependency:
<dependency>
<dependency>
<groupId>
io.github.doocs
</groupId>
<groupId>
io.github.doocs
</groupId>
<artifactId>
im-server-sdk-java
</artifactId>
<artifactId>
im-server-sdk-java
</artifactId>
<version>
0.2.
3
</version>
<version>
0.2.
4
</version>
</dependency>
</dependency>
```
```
...
...
pom.xml
View file @
b06cbce1
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<groupId>
io.github.doocs
</groupId>
<groupId>
io.github.doocs
</groupId>
<artifactId>
im-server-sdk-java
</artifactId>
<artifactId>
im-server-sdk-java
</artifactId>
<version>
0.2.
3
</version>
<version>
0.2.
4
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
qcloud-im-server-sdk-java
</name>
<name>
qcloud-im-server-sdk-java
</name>
...
...
src/main/java/io/github/doocs/im/model/message/TIMMsgElement.java
View file @
b06cbce1
...
@@ -2,6 +2,9 @@ package io.github.doocs.im.model.message;
...
@@ -2,6 +2,9 @@ package io.github.doocs.im.model.message;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonSubTypes
;
import
com.fasterxml.jackson.annotation.JsonTypeInfo
;
import
io.github.doocs.im.constant.MsgType
;
/**
/**
* 抽象消息元素
* 抽象消息元素
...
@@ -10,6 +13,17 @@ import com.fasterxml.jackson.annotation.JsonProperty;
...
@@ -10,6 +13,17 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* @since 2021/10/29 16:24
* @since 2021/10/29 16:24
*/
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonTypeInfo
(
use
=
JsonTypeInfo
.
Id
.
NAME
,
include
=
JsonTypeInfo
.
As
.
EXISTING_PROPERTY
,
property
=
"MsgType"
,
visible
=
true
)
@JsonSubTypes
({
@JsonSubTypes
.
Type
(
value
=
TIMTextMsgElement
.
class
,
name
=
MsgType
.
TIM_TEXT_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMVideoFileMsgElement
.
class
,
name
=
MsgType
.
TIM_VIDEO_FILE_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMCustomMsgElement
.
class
,
name
=
MsgType
.
TIM_CUSTOM_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMSoundMsgElement
.
class
,
name
=
MsgType
.
TIM_SOUND_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMImageMsgElement
.
class
,
name
=
MsgType
.
TIM_IMAGE_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMLocationMsgElement
.
class
,
name
=
MsgType
.
TIM_LOCATION_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMFileMsgElement
.
class
,
name
=
MsgType
.
TIM_FILE_ELEM
),
@JsonSubTypes
.
Type
(
value
=
TIMFaceMsgElement
.
class
,
name
=
MsgType
.
TIM_FACE_ELEM
)
})
public
abstract
class
TIMMsgElement
{
public
abstract
class
TIMMsgElement
{
@JsonProperty
(
"MsgType"
)
@JsonProperty
(
"MsgType"
)
private
String
msgType
;
private
String
msgType
;
...
...
src/main/resources/version.properties
View file @
b06cbce1
version
=
0.2.
3
version
=
0.2.
4
src/test/java/io/github/doocs/im/MessageTest.java
View file @
b06cbce1
package
io
.
github
.
doocs
.
im
;
package
io
.
github
.
doocs
.
im
;
import
io.github.doocs.im.constant.MsgType
;
import
io.github.doocs.im.constant.SyncOtherMachine
;
import
io.github.doocs.im.constant.SyncOtherMachine
;
import
io.github.doocs.im.model.message.TIMCustomMsgElement
;
import
io.github.doocs.im.model.message.TIMMsgElement
;
import
io.github.doocs.im.model.message.TIMMsgElement
;
import
io.github.doocs.im.model.message.TIMTextMsgElement
;
import
io.github.doocs.im.model.message.TIMTextMsgElement
;
import
io.github.doocs.im.model.request.*
;
import
io.github.doocs.im.model.request.*
;
...
@@ -10,10 +12,7 @@ import org.junit.Test;
...
@@ -10,10 +12,7 @@ import org.junit.Test;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Properties
;
/**
/**
* @author bingo
* @author bingo
...
@@ -38,7 +37,7 @@ public class MessageTest {
...
@@ -38,7 +37,7 @@ public class MessageTest {
@Test
@Test
public
void
testSendMsg
()
throws
IOException
{
public
void
testSendMsg
()
throws
IOException
{
TIM
Text
MsgElement
msg
=
new
TIMTextMsgElement
(
"hello world"
);
TIMMsgElement
msg
=
new
TIMTextMsgElement
(
"hello world"
);
SendMsgRequest
request
=
new
SendMsgRequest
(
"test2"
,
123
,
Collections
.
singletonList
(
msg
));
SendMsgRequest
request
=
new
SendMsgRequest
(
"test2"
,
123
,
Collections
.
singletonList
(
msg
));
request
.
setFromAccount
(
"test1"
);
request
.
setFromAccount
(
"test1"
);
request
.
setSyncOtherMachine
(
SyncOtherMachine
.
YES
);
request
.
setSyncOtherMachine
(
SyncOtherMachine
.
YES
);
...
@@ -73,9 +72,17 @@ public class MessageTest {
...
@@ -73,9 +72,17 @@ public class MessageTest {
@Test
@Test
public
void
testAdminGetRoamMsg
()
throws
IOException
{
public
void
testAdminGetRoamMsg
()
throws
IOException
{
AdminGetRoamMsgRequest
request
=
new
AdminGetRoamMsgRequest
(
"
test1"
,
"test2"
,
123
,
1631934000
,
1631934060
);
AdminGetRoamMsgRequest
request
=
new
AdminGetRoamMsgRequest
(
"
200942"
,
"151"
,
200
,
1603954915
,
1643954915
);
AdminRoamMsgResult
result
=
client
.
message
.
getRoamMsg
(
request
);
AdminRoamMsgResult
result
=
client
.
message
.
getRoamMsg
(
request
);
System
.
out
.
println
(
result
);
List
<
TIMMsgElement
>
msgBody
=
result
.
getMsgList
().
get
(
0
).
getMsgBody
();
System
.
out
.
println
(
msgBody
.
get
(
0
).
getMsgType
());
for
(
TIMMsgElement
ee
:
msgBody
)
{
if
(
Objects
.
equals
(
ee
.
getMsgType
(),
MsgType
.
TIM_CUSTOM_ELEM
))
{
TIMCustomMsgElement
t
=
(
TIMCustomMsgElement
)
ee
;
System
.
out
.
println
(
t
.
getMsgContent
().
getData
());
}
}
Assert
.
assertEquals
(
"OK"
,
result
.
getActionStatus
());
Assert
.
assertEquals
(
"OK"
,
result
.
getActionStatus
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment