跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 第一次使用 bun 开发: 企业微信会话内容存档客户端

发表于

主要利用 bun:ffi 的功能,将以前的 golang 逻辑迁移为新的统一的 ts 代码,增加类型安全,代码一个仓库里方便维护。 目前包里带的 .so 只能在 glibc, amd64,linux 下执行,没测试过 windows 。

代码内测试用例

make run-bun
# 执行测试,会输出 10 条消息 - 注意 IP 白名单,可以增加 WWF_PROXY 环境变量
WWF_CORP_ID=ID WWF_CORP_SECRET=SECRET bun test ./src/wecom/archive/bun/WeWorkFinanceClient.bun.test.ts  

测试代码

if (process.env.WWF_PRIVATE_KEY_FILE) {
  privateKey = await fs.readFile(process.env.WWF_PRIVATE_KEY_FILE, 'utf-8');
}

const client = createWeWorkFinanceClientFromEnv({
  corpId: process.env.WWF_CORP_ID,
  corpSecret: process.env.WWF_CORP_SECRET,
  privateKey,
});
// the original data
const data = client.getChatData({ limit: 10 });
console.log(data);

// the decrypted data
if (privateKey) {
  console.log(client.getMessage({ limit: 10 }));
}

// get file
client.getMediaData({ fileId: '' });

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.