wechat 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -3
- data/CHANGELOG.md +9 -0
- data/README-CN.md +2 -1
- data/README.md +2 -1
- data/bin/wechat +5 -0
- data/lib/action_controller/wechat_responder.rb +2 -0
- data/lib/wechat/cipher.rb +1 -1
- data/lib/wechat/concern/common.rb +7 -1
- data/lib/wechat/controller_api.rb +3 -0
- data/lib/wechat/corp_api.rb +4 -0
- data.tar.gz.sig +0 -0
- metadata +29 -29
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f4fc2c468dafd46121575897e37db5a9d4ebc610f96b0f0745d5de4668783c4
|
|
4
|
+
data.tar.gz: 4a2f3f16b3ec7ba0886630c574d9213042a54a1d784a0324d44294b1030c7bcf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50a8bd9221dcdc3c49e46a37b3dd6b8947590a379ceb2b8f9de7e57f28a3bea490e7ae0434694d5ab22a3e821ee4896010459c9c44b344c5c517b9879351f5d5
|
|
7
|
+
data.tar.gz: afd5f4a1a15dec3168ae6db2a8c510804986b9a17c9c58ec2a69b297520f3f098e7065e72bb80690ae0b1505944fd5cf608ab809c56700a54297221258528224
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
=J�� Y���MI�,���E���@18������;���5*�1�˿O(�����R��$UἬ�?8R36uO�#3�8��8���|B��X]\�ν�}NF�դhI��ѻ�g����G��0�1��RP��/���#f�%����H�#Y28��;�4`O�E�i��p�H��#��|��G<���eW Lt��zé*$����@���U/�v��o�FZ)�5{�a��o�9�D6��r[qU�{t��Gn���6�gA�q=�ia�yb]O�~��d��P5FB��v�}�o^������%�yF���V�1)�Xs��>l��S»��0
|
|
2
|
+
����
|
|
3
|
+
�e���K��/ݢ]`�vU֩�
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.2.0 (released at 2026-05-22)
|
|
4
|
+
|
|
5
|
+
* Feat: api getuserid.
|
|
6
|
+
* Fix: wechat_oauth2 in corp now need agentid.
|
|
7
|
+
|
|
8
|
+
## v1.1.0 (released at 2025-11-24)
|
|
9
|
+
|
|
10
|
+
* Feat: api wxa_get_user_risk_rank. by @leepood #327
|
|
11
|
+
|
|
3
12
|
## v1.0.1 (released at 2025-07-09)
|
|
4
13
|
|
|
5
14
|
* Fix after introduce httpx, status method not available for HTTPX::ErrorResponse bug
|
data/README-CN.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
WeChat [](https://rubygems.org/gems/wechat) [](https://mixtint.semaphoreci.com/projects/wechat)
|
|
1
|
+
WeChat [](https://rubygems.org/gems/wechat) [](https://mixtint.semaphoreci.com/projects/wechat)[](https://deepwiki.com/Eric-Guo/wechat)
|
|
2
2
|
======
|
|
3
3
|
|
|
4
4
|
[](https://gitter.im/Eric-Guo/wechat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
@@ -443,6 +443,7 @@ Wechat Enterprise Account commands:
|
|
|
443
443
|
wechat department_update [DEPARTMENT_ID, NAME] # 更新部门
|
|
444
444
|
wechat getusercumulate [BEGIN_DATE, END_DATE] # 获取累计用户数据
|
|
445
445
|
wechat getusersummary [BEGIN_DATE, END_DATE] # 获取用户增减数据
|
|
446
|
+
wechat getuserid [MOBILE] # 通过手机号获取 userid
|
|
446
447
|
wechat invite_user [USER_ID] # 邀请成员关注
|
|
447
448
|
wechat material [MEDIA_ID, PATH] # 永久媒体下载
|
|
448
449
|
wechat material_add [MEDIA_TYPE, PATH] # 永久媒体上传
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
WeChat [](https://rubygems.org/gems/wechat) [](https://mixtint.semaphoreci.com/projects/wechat)
|
|
1
|
+
WeChat [](https://rubygems.org/gems/wechat) [](https://mixtint.semaphoreci.com/projects/wechat)[](https://deepwiki.com/Eric-Guo/wechat)
|
|
2
2
|
======
|
|
3
3
|
|
|
4
4
|
[](https://gitter.im/Eric-Guo/wechat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
@@ -475,6 +475,7 @@ Wechat Enterprise Account commands:
|
|
|
475
475
|
wechat department_update [DEPARTMENT_ID, NAME] # 更新部门
|
|
476
476
|
wechat getusercumulate [BEGIN_DATE, END_DATE] # 获取累计用户数据
|
|
477
477
|
wechat getusersummary [BEGIN_DATE, END_DATE] # 获取用户增减数据
|
|
478
|
+
wechat getuserid [MOBILE] # 通过手机号获取 userid
|
|
478
479
|
wechat invite_user [USER_ID] # 邀请成员关注
|
|
479
480
|
wechat material [MEDIA_ID, PATH] # 永久媒体下载
|
|
480
481
|
wechat material_add [MEDIA_TYPE, PATH] # 永久媒体上传
|
data/bin/wechat
CHANGED
|
@@ -131,6 +131,11 @@ class App < Thor
|
|
|
131
131
|
puts wechat_api.invite_user(userid)
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
+
desc 'getuserid [MOBILE]', '通过手机号获取userid'
|
|
135
|
+
def getuserid(mobile)
|
|
136
|
+
puts wechat_api.getuserid(mobile)
|
|
137
|
+
end
|
|
138
|
+
|
|
134
139
|
desc 'tag_add_department [TAG_ID, PARTY_IDS]', '增加标签部门'
|
|
135
140
|
def tag_add_department(tagid, partyids)
|
|
136
141
|
puts wechat_api.tag_add_user(tagid, nil, partyids.split(','))
|
|
@@ -4,6 +4,7 @@ module ActionController
|
|
|
4
4
|
module WechatResponder
|
|
5
5
|
def wechat_api(opts = {})
|
|
6
6
|
include Wechat::ControllerApi
|
|
7
|
+
|
|
7
8
|
account = opts.delete(:account)
|
|
8
9
|
self.wechat_cfg_account = account ? account.to_sym : :default
|
|
9
10
|
self.wechat_api_client = load_controller_wechat(wechat_cfg_account, opts)
|
|
@@ -11,6 +12,7 @@ module ActionController
|
|
|
11
12
|
|
|
12
13
|
def wechat_responder(opts = {})
|
|
13
14
|
include Wechat::Responder
|
|
15
|
+
|
|
14
16
|
account = opts.delete(:account)
|
|
15
17
|
self.account_from_request = opts.delete(:account_from_request)
|
|
16
18
|
self.wechat_cfg_account = account ? account.to_sym : :default
|
data/lib/wechat/cipher.rb
CHANGED
|
@@ -93,6 +93,12 @@ module Wechat
|
|
|
93
93
|
post 'business/getuserphonenumber', JSON.generate(code: code), base: Wechat::Api::WXA_BASE
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
def wxa_get_user_risk_rank(openid, scene, **payload)
|
|
97
|
+
# https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/sec-center/safety-control-capability/getUserRiskRank.html
|
|
98
|
+
request_body = { appid: access_token.appid, openid: openid, scene: scene }.merge(payload)
|
|
99
|
+
post 'getuserriskrank', JSON.generate(request_body), base: Wechat::Api::WXA_BASE
|
|
100
|
+
end
|
|
101
|
+
|
|
96
102
|
def wxa_get_wxacode(path, width = 430)
|
|
97
103
|
post 'getwxacode', JSON.generate(path: path, width: width), base: Wechat::Api::WXA_BASE
|
|
98
104
|
end
|
|
@@ -158,7 +164,7 @@ module Wechat
|
|
|
158
164
|
|
|
159
165
|
def material_add(type, file, opts = {})
|
|
160
166
|
params = { type: type }
|
|
161
|
-
params
|
|
167
|
+
params[:description] = opts.slice(:title, :introduction).to_json if type == 'video'
|
|
162
168
|
|
|
163
169
|
post_file 'material/add_material', file, params: params
|
|
164
170
|
end
|
|
@@ -22,9 +22,11 @@ module Wechat
|
|
|
22
22
|
if account
|
|
23
23
|
config = Wechat.config(account)
|
|
24
24
|
appid = config.corpid || config.appid
|
|
25
|
+
agentid = config.agentid
|
|
25
26
|
is_crop_account = config.corpid.present?
|
|
26
27
|
else
|
|
27
28
|
appid = self.class.corpid || self.class.appid
|
|
29
|
+
agentid = self.class.agentid
|
|
28
30
|
is_crop_account = self.class.corpid.present?
|
|
29
31
|
end
|
|
30
32
|
|
|
@@ -37,6 +39,7 @@ module Wechat
|
|
|
37
39
|
response_type: 'code',
|
|
38
40
|
state: api.jsapi_ticket.oauth2_state
|
|
39
41
|
}
|
|
42
|
+
oauth2_params[:agentid] = agentid if is_crop_account
|
|
40
43
|
|
|
41
44
|
return generate_oauth2_url(oauth2_params) unless block_given?
|
|
42
45
|
|
data/lib/wechat/corp_api.rb
CHANGED
|
@@ -53,6 +53,10 @@ module Wechat
|
|
|
53
53
|
get 'user/getuserinfo', params: { code: code }
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def getuserid(mobile)
|
|
57
|
+
post 'user/getuserid', JSON.generate(mobile: mobile)
|
|
58
|
+
end
|
|
59
|
+
|
|
56
60
|
def convert_to_openid(userid)
|
|
57
61
|
post 'user/convert_to_openid', JSON.generate(userid: userid, agentid: agentid)
|
|
58
62
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wechat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Skinnyworm
|
|
@@ -12,28 +12,28 @@ cert_chain:
|
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
13
|
MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMRMwEQYDVQQDDAplcmlj
|
|
14
14
|
Lmd1b2N6MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
|
|
15
|
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VR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAAS4PVX34FrNYW9Iv16
|
|
27
|
+
R4Qyoj1CMB8GA1UdEQQYMBaBFGVyaWMuZ3VvY3pAZ21haWwuY29tMB8GA1UdEgQY
|
|
28
|
+
MBaBFGVyaWMuZ3VvY3pAZ21haWwuY29tMA0GCSqGSIb3DQEBCwUAA4IBgQBFdbRh
|
|
29
|
+
Wh50P882h5BMysO8Ru/cnqUENIsHxUnZsssHuFcU3Gn3Sq43ixKzFhA4uOCDfY36
|
|
30
|
+
xvX7johxHhukDAdo4lD9h+f5Vck35Qns5Ln+b0o0iTyENOFou57CgeqpWeVkDIi4
|
|
31
|
+
vlwdgCunr64KKW7snC4E76AUXRnOYC0UhZL2VQRc54sN6eMIACogJ9ZHii3h5FmG
|
|
32
|
+
ep6LMfi1oKBrU7MLT5BidvCxG3ePEtdfACGznDE7GgimLVcsb3Ft+sNeP6fBtvrM
|
|
33
|
+
OljHZezOIi+Wbot4pvwdt8tCI4eCoAWAYuoCtyav5dDRUeqI7TPdQGgMPDcVckNE
|
|
34
|
+
e3iKcBAe/0pRYSZxORE63n3SOo9MPL2oGe9A21LR/tk/CJ8kZxDdeTh4zL+Ufw3R
|
|
35
|
+
G4TR+pkSPTTDPI2Ft/RAqHjqectqrcz4gZ4e/x1nBhoF8QKrBuEvHXNTR5EtMzcz
|
|
36
|
+
CU8I1U00X8GGbinHiVIfDJnOkCq7cBmbTamZpNwZLCrgQupqUNhEP2vcZVg=
|
|
37
37
|
-----END CERTIFICATE-----
|
|
38
38
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
39
39
|
dependencies:
|
|
@@ -147,14 +147,14 @@ dependencies:
|
|
|
147
147
|
requirements:
|
|
148
148
|
- - "~>"
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: 1.
|
|
150
|
+
version: 1.84.2
|
|
151
151
|
type: :development
|
|
152
152
|
prerelease: false
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
|
155
155
|
- - "~>"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: 1.
|
|
157
|
+
version: 1.84.2
|
|
158
158
|
- !ruby/object:Gem::Dependency
|
|
159
159
|
name: rails
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -175,14 +175,14 @@ dependencies:
|
|
|
175
175
|
requirements:
|
|
176
176
|
- - "~>"
|
|
177
177
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
178
|
+
version: '8.0'
|
|
179
179
|
type: :development
|
|
180
180
|
prerelease: false
|
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
|
182
182
|
requirements:
|
|
183
183
|
- - "~>"
|
|
184
184
|
- !ruby/object:Gem::Version
|
|
185
|
-
version: '
|
|
185
|
+
version: '8.0'
|
|
186
186
|
- !ruby/object:Gem::Dependency
|
|
187
187
|
name: rspec-mocks
|
|
188
188
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -271,8 +271,8 @@ licenses:
|
|
|
271
271
|
metadata:
|
|
272
272
|
bug_tracker_uri: https://github.com/Eric-Guo/wechat/issues
|
|
273
273
|
changelog_uri: https://github.com/Eric-Guo/wechat/releases
|
|
274
|
-
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v1.0
|
|
275
|
-
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v1.0
|
|
274
|
+
documentation_uri: https://github.com/Eric-Guo/wechat/tree/v1.2.0#readme
|
|
275
|
+
source_code_uri: https://github.com/Eric-Guo/wechat/tree/v1.2.0
|
|
276
276
|
rubygems_mfa_required: 'true'
|
|
277
277
|
post_install_message: |2
|
|
278
278
|
|
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
291
291
|
- !ruby/object:Gem::Version
|
|
292
292
|
version: 3.1.6
|
|
293
293
|
requirements: []
|
|
294
|
-
rubygems_version:
|
|
294
|
+
rubygems_version: 4.0.12
|
|
295
295
|
specification_version: 4
|
|
296
296
|
summary: DSL for wechat message handling and API
|
|
297
297
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|