1
0
mirror of https://github.com/silenceper/wechat.git synced 2025-12-19 16:52:24 +08:00

603 Commits

Author SHA1 Message Date
yin jiashuai
54f08cbd73 update:小程序ocr识别 refs#864 (#865)
* update:小程序ocr识别

* fix:删除ResPlateNumber

---------

Co-authored-by: 阴佳帅 <14988374+yin-jiashuai@user.noreply.gitee.com>
v2.1.11
2025-11-16 21:46:49 +08:00
markwang
c34ff2031b fix: 企业微信-通讯录管理-更新成员企业邮箱别名参数类型修正 (#863) 2025-11-13 14:13:14 +08:00
is-Xiaoen
30c8e77246 fix: improve type safety in httpWithTLS for custom RoundTripper (#861)
* fix: improve type safety in httpWithTLS for custom RoundTripper

Add type assertion check to handle cases where DefaultHTTPClient.Transport
is a custom http.RoundTripper implementation (not *http.Transport).

This improves upon the fix in PR #844 which only handled nil Transport.
The previous code would still panic if users set a custom RoundTripper:

  trans := baseTransport.(*http.Transport).Clone()  // panic if not *http.Transport

Now safely handles three scenarios:
1. Transport is nil -> use http.DefaultTransport
2. Transport is *http.Transport -> clone it
3. Transport is custom RoundTripper -> use http.DefaultTransport

Added comprehensive test cases:
- TestHttpWithTLS_NilTransport
- TestHttpWithTLS_CustomTransport
- TestHttpWithTLS_CustomRoundTripper

Related to #803

* refactor: reduce code duplication and complexity in httpWithTLS

- Eliminate duplicate http.DefaultTransport.Clone() calls
- Reduce cyclomatic complexity by simplifying conditional logic
- Use nil check pattern instead of nested else branches
- Maintain same functionality with cleaner code structure

This addresses golangci-lint warnings for dupl and gocyclo.

* fix: add newline at end of http_test.go

Fix gofmt -s compliance issue:
- File must end with newline character
- Addresses golangci-lint gofmt error on line 81

This fixes CI check failure.
v2.1.10
2025-10-27 14:24:24 +08:00
mahongran
6f6e95cfdb SubscribeMsgSentList结构中的ErrorCode类型从int更新为string (#859) 2025-10-24 20:49:24 +08:00
silenceper
c806a0c172 Add star badge to README 2025-10-24 17:37:01 +08:00
zhangjiani
c136b878ce 调整企微回调URL参数tag,兼容kratos框架 (#855)
* fix: handle JSON parse error when API returns binary file instead of error JSON

* fix: add JSON tags to SignatureOptions struct fields for proper serialization

* fix: mod module

* fix: rollback

---------

Co-authored-by: tax <jia_deng@intsig.net>
2025-09-19 11:16:52 +08:00
zhangjiani
d4a81916d5 fix: handle JSON parse error when API returns binary file instead of error JSON (#852)
Co-authored-by: tax <jia_deng@intsig.net>
2025-09-14 19:47:00 +08:00
Outyua
ef1372b98a fix BatchGetExternalUserDetails to return NextCursor in response (#849) v2.1.10-rc.1 2025-08-18 15:51:30 +08:00
silenceper
0d666b60ba update readme (#848)
* update readme

* update readme

* update readme
2025-07-29 23:31:01 +08:00
silenceper
e1122d42b0 Update FUNDING.yml 2025-07-29 23:13:42 +08:00
silenceper
be3f0d8bd5 Update FUNDING.yml 2025-07-29 22:52:50 +08:00
silenceper
66f9794d2f Update FUNDING.yml (#847) 2025-07-29 22:41:02 +08:00
silenceper
ee5f045b89 fix panic (#844) 2025-07-24 09:59:13 +08:00
silenceper
d35f0f0865 Ai dev (#846)
* add Claude Code workflow

* add Claude Code model
2025-07-23 23:43:46 +08:00
silenceper
bbad169706 add Claude Code workflow (#845) 2025-07-23 22:56:33 +08:00
ccfish
5927c26152 追加接口【微信物流服务 /微信物流服务(商家查看) /查询组件】 (#843)
* feat: 添加 微信物流服务 /微信物流服务(商家查看) /消息组件

* fix lint issues

* fix: 查询运单详情信息返回结果结构

* 追加官方文档地址

* feat: 追加接口【微信物流服务 /微信物流服务(商家查看) /查询组件】

* fix: comments

* fix: indents
2025-07-21 10:13:47 +08:00
markwang
8ebff5c29c feat: 微信小程序-运维中心 (#838)
* feat: 微信小程序-运维中心

* feat: 微信小程序-运维中心

* feat: 微信小程序-运维中心

* feat: 微信小程序-运维中心
2025-07-14 16:16:44 +08:00
ccfish
86ef690ecd feat: 添加 微信物流服务 /微信物流服务(商家查看) /消息组件 (#842) 2025-07-05 09:01:15 +08:00
markwang
ee85790123 微信小程序-数据分析-获取小程序性能数据 (#837)
* feat: 微信小程序-数据分析-性能数据

* feat: 微信小程序-数据分析-性能数据

* feat: 微信小程序-数据分析-性能数据
2025-07-01 19:14:44 +08:00
markwang
8a810837a4 feat: 微信小程序-动态消息及订阅消息 (#835)
* feat: 微信小程序-动态消息及订阅消息

* feat: 微信小程序-动态消息及订阅消息

* feat: 微信小程序-动态消息及订阅消息
v2.1.9
2025-06-18 16:16:43 +08:00
yahuian
c51d41ee8a security 模块增加 context 调用函数 (#836) 2025-06-18 16:14:10 +08:00
Lien Li
24f812d187 feat: 支持Redis作为Cache的时候使用TLS (#834)
* feat: 支持Redis作为Cache的时候使用TLS

* feat: fix lint

* fix lint

* Update redis.go
2025-05-03 23:43:15 +08:00
markwang
dd43b7baa3 feat: 微信小程序-小程序链接 (#833)
* feat: 微信小程序-小程序链接

* feat: 微信小程序-小程序链接
2025-05-01 10:19:19 +08:00
markwang
2dfd2ff608 feat: 微信小程序-登录及用户信息 (#830)
* feat: 微信小程序-登录及用户信息

* feat: 微信小程序-登录及用户信息
v2.1.9-rc.1
2025-04-27 10:09:31 +08:00
litterGuy
23bb10b0c9 fix: ImageUpload 接口报错 'media data missing hint:' (#832) 2025-04-27 10:08:51 +08:00
lizhuang
b639d2235d Add JSSDK context method functionality (#828)
* Add JSSDK context method functionality

* 善JSSDK上下文方法,并添加测试文件

* feat: 完善JSSDK上下文方法,保证协程安全,并添加测试文件

* 修改 import 包分组处理

* feat: 修改测试文件中 fmt.Print -> t.Log

* 删除空行
2025-04-23 14:14:16 +08:00
wwek
26d2093bd7 fix typo (#831) 2025-04-22 19:40:57 +08:00
曹晶
cf42cd8d54 feat: 添加获取成员多次收消息详情API (#824)
* feat(media): add getTempFile api

add getTempFile api

* feat: 添加获取成员多次收消息详情API

- 添加customerAcquisitionGetChatInfoURL常量
- 实现GetChatInfo方法及相关请求/响应结构体
- 支持企业微信获客助手多次收消息功能

---------

Co-authored-by: caojing <jingjing.cao@trustbe.cn>
2025-04-21 10:44:12 +08:00
markwang
85ee45580b feat: 企业微信-打卡-添加打卡记录 (#829) 2025-04-21 10:42:47 +08:00
markwang
208d5c528a feat: 企业微信-打卡-新增返回字段 (#827) 2025-04-18 20:08:21 +08:00
markwang
b5f9a8933e 企业微信-通讯录管理-更新成员接口,支持更新企业邮箱别名 (#826)
* feat: 企业微信-通讯录管理,新增更新成员、更新部门、删除部门方法

* feat: 企业微信-通讯录管理-更新成员接口,支持更新企业邮箱别名
2025-04-18 14:13:26 +08:00
LarryLiu
52fb5596d3 修改最新版本的授权地址 (#823)
* Update accessToken.go

add openplatform refresh_token

* Update accessToken.go

openplatform add refresh_token expire set 10 year

* Update openplatform/context/accessToken.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update accessToken.go

修改最新的授权H5链接地址

* Update accessToken.go

增加新版本授权链接

* Update accessToken.go

增加新版本授权链接

---------

Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-31 10:51:46 +08:00
LarryLiu
44150c557e 微信开放平台增加refreshtoken缓存 (#822)
* Update accessToken.go

add openplatform refresh_token

* Update accessToken.go

openplatform add refresh_token expire set 10 year

* Update openplatform/context/accessToken.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-03-28 11:38:57 +08:00
fearlessfei
635a0c640d feat(auth): getAccessToken with context (#820) 2025-03-25 14:20:12 +08:00
mahongran
010e49c35c fix: work js-api signature (#818)
* feat: enhance WorkAccessToken to include AgentID for improved token management

- Added AgentID field to WorkAccessToken struct.
- Updated NewWorkAccessToken function to accept AgentID as a parameter.
- Modified access token cache key to incorporate AgentID, ensuring unique cache entries per agent.

This change improves the handling of access tokens in a multi-agent environment.

* refactor: enhance WorkAccessToken to improve cache key handling

- Updated the AgentID field in WorkAccessToken struct to clarify its optional nature for distinguishing applications.
- Modified the access token cache key construction to support both new and legacy formats based on the presence of AgentID.
- Added comments for better understanding of the cache key logic and its compatibility with historical versions.

This change improves the flexibility and clarity of access token management in multi-agent scenarios.

* feat(work): add JsSdk method for JavaScript SDK integration

- Introduced a new JsSdk method in the Work struct to facilitate the creation of a Js instance.
- This addition enhances the functionality of the Work module by enabling JavaScript SDK support.

This change improves the integration capabilities for developers working with the WeChat Work API.

* fix gofmt

* refactor(jsapi): simplify signature generation in GetConfig and GetAgentConfig methods

- Replaced the use of strconv to format the signature string with fmt.Sprintf for improved readability.
- Updated the signature generation logic in both GetConfig and GetAgentConfig methods to use a single formatted string.

This change enhances code clarity and maintains functionality in the signature generation process.

* fix gofmt

* fix gofmt

* fix gofmt

* fix gofmt

* refactor(js): correct initialization of Config in GetConfig method

- Removed redundant initialization of the Config variable and ensured it is instantiated correctly before use.
- This change improves code clarity and maintains the intended functionality of the GetConfig method.
v2.1.8-rc.1 v2.1.8
2025-01-14 17:24:42 +08:00
mahongran
9c87d1cb34 feat:企业微信客户端API JS-SDK wx.config 和 wx.agentConfig 方法权限签名 (#817)
* feat: enhance WorkAccessToken to include AgentID for improved token management

- Added AgentID field to WorkAccessToken struct.
- Updated NewWorkAccessToken function to accept AgentID as a parameter.
- Modified access token cache key to incorporate AgentID, ensuring unique cache entries per agent.

This change improves the handling of access tokens in a multi-agent environment.

* refactor: enhance WorkAccessToken to improve cache key handling

- Updated the AgentID field in WorkAccessToken struct to clarify its optional nature for distinguishing applications.
- Modified the access token cache key construction to support both new and legacy formats based on the presence of AgentID.
- Added comments for better understanding of the cache key logic and its compatibility with historical versions.

This change improves the flexibility and clarity of access token management in multi-agent scenarios.

* feat(work): add JsSdk method for JavaScript SDK integration

- Introduced a new JsSdk method in the Work struct to facilitate the creation of a Js instance.
- This addition enhances the functionality of the Work module by enabling JavaScript SDK support.

This change improves the integration capabilities for developers working with the WeChat Work API.

* fix gofmt
2025-01-14 10:52:24 +08:00
mahongran
71c8ab58fb F ix work access token (#810)
* feat: enhance WorkAccessToken to include AgentID for improved token management

- Added AgentID field to WorkAccessToken struct.
- Updated NewWorkAccessToken function to accept AgentID as a parameter.
- Modified access token cache key to incorporate AgentID, ensuring unique cache entries per agent.

This change improves the handling of access tokens in a multi-agent environment.

* refactor: enhance WorkAccessToken to improve cache key handling

- Updated the AgentID field in WorkAccessToken struct to clarify its optional nature for distinguishing applications.
- Modified the access token cache key construction to support both new and legacy formats based on the presence of AgentID.
- Added comments for better understanding of the cache key logic and its compatibility with historical versions.

This change improves the flexibility and clarity of access token management in multi-agent scenarios.

* feat: enhance WorkAccessToken with new constructor for AgentID support

- Introduced NewWorkAccessTokenWithAgentID function to maintain backward compatibility while allowing for AgentID usage.
- Updated NewWorkAccessToken to call the new constructor, ensuring seamless integration.
- Improved error handling in GetAccessTokenContext by checking for cache availability and handling potential errors during cache operations.

This change enhances the flexibility of access token management, particularly in multi-agent scenarios, while ensuring compatibility with existing implementations.
2025-01-07 22:19:21 +08:00
mqf20
92bf6c7699 use context when getting access token (#815)
* use context

Signed-off-by: mqf20 <mingqingfoo@gmail.com>

* added docs

Signed-off-by: mqf20 <mingqingfoo@gmail.com>

* improved docs

Signed-off-by: mqf20 <mingqingfoo@gmail.com>

* added SetAccessTokenContextHandle

Signed-off-by: mqf20 <mingqingfoo@gmail.com>

---------

Signed-off-by: mqf20 <mingqingfoo@gmail.com>
2025-01-07 22:13:03 +08:00
mqf20
6b9d4f82da added GetPhoneNumberWithContext (#812)
Signed-off-by: mqf20 <mingqingfoo@gmail.com>
2025-01-07 13:31:43 +08:00
markwang
17521d047e feat: 企业微信-微信客服,客服账号列表接口支持分页拉取,接待人员增加部门ID (#798)
Co-authored-by: houseme <qzg40737@163.com>
2025-01-06 14:52:42 +08:00
Lien Li
d38e750876 add is_expire field for generateScheme (#808) 2025-01-03 10:32:30 +08:00
markwang
3bd886d7f2 feat: 企业微信-通讯录管理,新增更新成员、更新部门、删除部门方法 (#799) 2024-12-20 14:34:48 +08:00
曹晶
35af33f0bc feat(media): add UploadImgFromReader api (#802)
* feat(media): add getTempFile api

add getTempFile api

* feat(media): handle error in GetTempFile

handle error in GetTempFile

* feat(media): add UploadImgFromReader api

add UploadImgFromReader api

* fix(media): fixed not return common error

fixed not return common error
2024-12-20 14:34:27 +08:00
yangyl12345
4a8371e178 Feature/mini program template (#806)
* feat: 小程序发送订阅消息支持返回 msgid

* 小程序发送订阅消息支持返回 msgid

---------

Co-authored-by: w_yangyili <w_yangyili@xiwang.com>
2024-11-27 11:56:14 +08:00
yangyl12345
a571bf3546 Update default_access_token.go (#805)
* Update default_access_token.go

微信获取稳定版token,只有不等于空字符串的情况下才会返回access_token信息,未空的情况,继续调去微信服务

* 微信稳定性获取 access_token 接口,添加防止并发性获取 access_token 和多次微信服务获取代码

---------

Co-authored-by: w_yangyili <w_yangyili@xiwang.com>
2024-11-26 12:13:49 +08:00
CyJaySong
3fbe8634d9 officeaccount 和 miniprogram 添加UseStableAK 配置项 (#788) 2024-11-23 18:25:24 +08:00
markwang
990ba6ede9 feat: 企业微信-接待人员管理增加部门ID及停止接待子类型 (#800) 2024-10-16 16:11:20 +08:00
曹晶
44b09c7c3b feat(media): add getTempFile api (#801)
add getTempFile api
2024-10-16 16:11:03 +08:00
Lien Li
2e0708845b add-show_splash_ad-for-qrcodeparam (#794) v2.1.7 2024-08-26 10:20:39 +08:00
oah8
c1770130a0 add stream_upload_source (#786)
Co-authored-by: _oah <57302072@qq.com>
2024-08-22 14:21:58 +08:00