Compare commits
2 Commits
@egg/net-t
...
@egg/net-t
Author | SHA1 | Date | |
---|---|---|---|
b63f9f4530 | |||
42bd679248 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -12394,7 +12394,7 @@
|
||||
},
|
||||
"packages/net-tool": {
|
||||
"name": "@egg/net-tool",
|
||||
"version": "1.22.0",
|
||||
"version": "1.23.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@egg/logger": "^1.6.0",
|
||||
|
@ -3,6 +3,12 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [1.23.0](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.22.0...@egg/net-tool@1.23.0) (2025-01-14)
|
||||
|
||||
### Features
|
||||
|
||||
- **net-tool:** 更新 LarkMessageService.update 方法,支持文本消息格式 ([42bd679](http://yingbo.im:3000/zhaoyingbo/egg_tools/commits/42bd6792485acf2c8d0a61440db26fdc52900308))
|
||||
|
||||
# [1.22.0](http://yingbo.im:3000/zhaoyingbo/egg_tools/compare/@egg/net-tool@1.21.0...@egg/net-tool@1.22.0) (2025-01-12)
|
||||
|
||||
### Features
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@egg/net-tool",
|
||||
"version": "1.22.0",
|
||||
"version": "1.23.0",
|
||||
"description": "Net Tools for Egg projects",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
@ -55,12 +55,20 @@ class LarkMessageService extends LarkBaseService {
|
||||
* @param messageId 消息id
|
||||
* @param content 消息内容,JSON结构序列化后的字符串。不同msgType对应不同内容
|
||||
*/
|
||||
async update(messageId: string, content: string | Record<string, any>) {
|
||||
async update(
|
||||
messageId: string,
|
||||
content: string | Record<string, any>,
|
||||
isText: boolean = false
|
||||
) {
|
||||
const path = `/im/v1/messages/${messageId}`
|
||||
if (typeof content === "object") {
|
||||
content = JSON.stringify(content)
|
||||
}
|
||||
return this.patch<Lark.BaseRes>(path, { content })
|
||||
if (isText && !content.includes('"text"')) {
|
||||
content = JSON.stringify({ text: content })
|
||||
}
|
||||
if (!isText) return this.patch<Lark.BaseRes>(path, { content })
|
||||
return this.put<Lark.BaseRes>(path, { content, msg_type: "text" })
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user