Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
zhangshaowu
/
pipi-helper
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2fa4eb4c
authored
Oct 15, 2022
by
zhaolianjie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
加入群组
1 parent
ef437550
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
src/main/java/com/pipihelper/project/feishu/dto/chat/FeiShuChatDTO.java
src/main/java/com/pipihelper/project/feishu/service/FeiShuApiService.java
src/main/java/com/pipihelper/project/feishu/dto/chat/FeiShuChatDTO.java
View file @
2fa4eb4
...
...
@@ -27,7 +27,8 @@ public class FeiShuChatDTO {
private
String
userIdType
;
@JsonProperty
(
"user_id_list"
)
private
String
[]
userIdList
;
// 加入群聊的成员列表
@JsonProperty
(
"id_list"
)
private
String
[]
idList
;
}
src/main/java/com/pipihelper/project/feishu/service/FeiShuApiService.java
View file @
2fa4eb4
...
...
@@ -396,7 +396,25 @@ public class FeiShuApiService {
throw
new
ServiceException
(
"飞书:"
+
api
+
"接口调用失败"
+
"\n"
+
e
);
}
}
public
String
joinChatList
(
FeiShuChatDTO
feiShuChatDTO
)
{
String
api
=
"/im/v1/chats/{chat_id}/members"
;
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Authorization"
,
"Bearer "
+
getTenantToken
());
headers
.
set
(
"Content-Type"
,
"application/json; charset=utf-8"
);
String
url
=
feiShuConfig
.
getFeiShuOpenApiHost
()
+
api
;
try
{
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
objectMapper
.
writeValueAsString
(
feiShuChatDTO
),
headers
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
,
feiShuChatDTO
.
getChatId
());
System
.
out
.
println
(
responseEntity
.
getBody
());
Type
type
=
new
TypeReference
<
FeiShuResultDTO
>()
{
}.
getType
();
FeiShuResultDTO
feiShuResultDTO
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
type
);
return
feiShuResultDTO
.
getData
().
getChatId
();
}
catch
(
Exception
e
)
{
throw
new
ServiceException
(
"飞书:"
+
api
+
"接口调用失败"
+
"\n"
+
e
);
}
}
/**
* 群发消息
* https://open.feishu.cn/document/ukTMukTMukTM/ucDO1EjL3gTNx4yN4UTM
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment