third_party_wxa 0.1.8 → 0.1.9
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
- data/Gemfile.lock +1 -1
- data/lib/third_party_wxa/api/authorize.rb +19 -0
- data/lib/third_party_wxa/api/base_info.rb +0 -0
- data/lib/third_party_wxa/api/code.rb +74 -0
- data/lib/third_party_wxa/api/login.rb +19 -0
- data/lib/third_party_wxa/api/member.rb +7 -11
- data/lib/third_party_wxa/api/qrcode.rb +14 -10
- data/lib/third_party_wxa/api/server.rb +22 -0
- data/lib/third_party_wxa/plugin.rb +23 -22
- data/lib/third_party_wxa/token/local_store.rb +6 -6
- data/lib/third_party_wxa/token/redis_store.rb +14 -14
- data/lib/third_party_wxa/version.rb +1 -1
- metadata +5 -3
- data/lib/third_party_wxa/api/proxy.rb +0 -49
- data/lib/third_party_wxa/api/token.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f9b989909e595300c5dadc3025adf32adceb591898cf561a93ebee95294a619
|
4
|
+
data.tar.gz: a908be134d4376272ed6e49fcbd08df9ddbf6caad03410705c90eae25f6e4a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d049c25477f43c5da6bc59278e6149da7d8a1663d65663d644d50762245df88c98a0c6a259973e25d287cabcdc3af6472b51c156867c03a519c128a9a7f6a3ab
|
7
|
+
data.tar.gz: 387a2af728331edd00e8d51ad2e265e49cd22b6ee242dd1e989b167d52ed4bfc19578f672a8fb6735e4bdfdf625ab6deedfde8444b715bc00e0a76b523fe40ee
|
data/Gemfile.lock
CHANGED
@@ -2,6 +2,25 @@ module ThirdPartyWxa
|
|
2
2
|
module Api
|
3
3
|
module Authorize
|
4
4
|
|
5
|
+
# https://api.weixin.qq.com/cgi-bin/component/api_component_token
|
6
|
+
def component_access_token_api
|
7
|
+
params = {component_appid: appid, component_appsecret: appsecret, component_verify_ticket: component_verify_ticket}
|
8
|
+
ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin',
|
9
|
+
'component/api_component_token',
|
10
|
+
params
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
# 通过component_access_token获取pre_auth_code
|
15
|
+
# https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx
|
16
|
+
def pre_auth_code_api
|
17
|
+
params = {component_appid: appid}
|
18
|
+
ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin',
|
19
|
+
'component/api_create_preauthcode',
|
20
|
+
params,
|
21
|
+
{component_access_token: get_component_access_token}
|
22
|
+
end
|
23
|
+
|
5
24
|
def componentloginpage_url redirect, sign, type=2
|
6
25
|
redirect_uri = "#{redirect}?sign=#{sign}"
|
7
26
|
"https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=#{appid}&pre_auth_code=#{get_pre_auth_code}&auth_type=#{type}&redirect_uri=#{redirect_uri}"
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module ThirdPartyWxa
|
2
|
+
module Api
|
3
|
+
module Code
|
4
|
+
|
5
|
+
# 1、为授权的小程序帐号上传小程序代码
|
6
|
+
# post https://api.weixin.qq.com/wxa/commit?access_token=TOKEN
|
7
|
+
def commit options={}
|
8
|
+
rest = options.slice!(:template_id, :ext_json, :user_version, :user_desc)
|
9
|
+
http_post_with_token rest, 'wxa', 'commit', options
|
10
|
+
end
|
11
|
+
|
12
|
+
# 2、获取体验小程序的体验二维码
|
13
|
+
# get https://api.weixin.qq.com/wxa/get_qrcode?access_token=TOKEN&path=page%2Findex%3Faction%3D1
|
14
|
+
def get_qrcode options={}
|
15
|
+
rest = options.slice!(:path)
|
16
|
+
http_get_with_token rest, 'wxa', 'get_qrcode', options
|
17
|
+
end
|
18
|
+
|
19
|
+
# 3、获取授权小程序帐号已设置的类目
|
20
|
+
# get https://api.weixin.qq.com/wxa/get_category?access_token=TOKEN
|
21
|
+
def get_category options={}
|
22
|
+
http_get_with_token options, 'wxa', 'get_category'
|
23
|
+
end
|
24
|
+
|
25
|
+
# 4、获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用)
|
26
|
+
# get https://api.weixin.qq.com/wxa/get_page?access_token=TOKEN
|
27
|
+
def get_page options={}
|
28
|
+
http_get_with_token options, 'wxa', 'get_page'
|
29
|
+
end
|
30
|
+
|
31
|
+
# 5、将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用)
|
32
|
+
# post https://api.weixin.qq.com/wxa/submit_audit?access_token=TOKEN
|
33
|
+
def submit_audit options={}
|
34
|
+
rest = options.slice!(:item_list, :feedback_info, :feedback_stuff)
|
35
|
+
http_post_with_token rest, 'wxa', 'submit_audit', options
|
36
|
+
end
|
37
|
+
|
38
|
+
# 7、查询某个指定版本的审核状态(仅供第三方代小程序调用)
|
39
|
+
# post https://api.weixin.qq.com/wxa/get_auditstatus?access_token=TOKEN
|
40
|
+
def get_auditstatus options={}
|
41
|
+
rest = options.slice!(:auditid)
|
42
|
+
http_post_with_token rest, 'wxa', 'get_auditstatus', options
|
43
|
+
end
|
44
|
+
|
45
|
+
# 8、查询最新一次提交的审核状态(仅供第三方代小程序调用)
|
46
|
+
# get https://api.weixin.qq.com/wxa/get_latest_auditstatus?access_token=TOKEN
|
47
|
+
def get_latest_auditstatus options
|
48
|
+
http_get_with_token options, 'wxa', 'get_latest_auditstatus'
|
49
|
+
end
|
50
|
+
|
51
|
+
# 9、发布已通过审核的小程序(仅供第三方代小程序调用)
|
52
|
+
# post https://api.weixin.qq.com/wxa/release?access_token=TOKEN
|
53
|
+
def release options={}
|
54
|
+
http_post_with_token options, 'wxa', 'release', {}
|
55
|
+
end
|
56
|
+
|
57
|
+
# 10、修改小程序线上代码的可见状态(仅供第三方代小程序调用)
|
58
|
+
# https://api.weixin.qq.com/wxa/change_visitstatus?access_token=TOKEN
|
59
|
+
def change_visitstatus options={}
|
60
|
+
rest = options.slice!(:action)
|
61
|
+
http_post_with_token rest, 'wxa', 'change_visitstatus', options
|
62
|
+
end
|
63
|
+
|
64
|
+
# 11. 小程序版本回退(仅供第三方代小程序调用)
|
65
|
+
# get https://api.weixin.qq.com/wxa/revertcoderelease?access_token=TOKEN
|
66
|
+
def revertcoderelease options={}
|
67
|
+
http_get_with_token options, 'wxa', 'revertcoderelease'
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ThirdPartyWxa
|
2
|
+
module Api
|
3
|
+
module Login
|
4
|
+
|
5
|
+
# code 换取 session_key
|
6
|
+
# get https://api.weixin.qq.com/sns/component/jscode2session?appid=APPID&js_code=JSCODE&grant_type=authorization_code&component_appid=COMPONENT_APPID&component_access_token=ACCESS_TOKEN
|
7
|
+
# support local store only now
|
8
|
+
def jscode2session options
|
9
|
+
params = {
|
10
|
+
component_appid: appid,
|
11
|
+
component_access_token: get_component_access_token,
|
12
|
+
grant_type: 'authorization_code'
|
13
|
+
}.merge!(options.slice(:appid, :js_code))
|
14
|
+
http_get 'sns', 'component/jscode2session', params
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,25 +4,21 @@ module ThirdPartyWxa
|
|
4
4
|
|
5
5
|
# 1、绑定微信用户为小程序体验者
|
6
6
|
# https://api.weixin.qq.com/wxa/bind_tester?access_token=TOKEN
|
7
|
-
def bind_tester
|
8
|
-
http_post_with_token
|
7
|
+
def bind_tester options={}
|
8
|
+
http_post_with_token options, 'wxa', 'bind_tester', {wechatid: options.delete(:wechatid)}
|
9
9
|
end
|
10
10
|
|
11
11
|
# 2、解除绑定小程序的体验者
|
12
12
|
# https://api.weixin.qq.com/wxa/unbind_tester?access_token=TOKEN
|
13
|
-
def unbind_tester
|
14
|
-
http_post_with_token
|
13
|
+
def unbind_tester options={}
|
14
|
+
http_post_with_token options, 'wxa', 'unbind_tester', {wechatid: options.delete(:wechatid)}
|
15
15
|
end
|
16
16
|
|
17
17
|
# 3. 获取体验者列表
|
18
18
|
# https://api.weixin.qq.com/wxa/memberauth?access_token=TOKEN
|
19
|
-
def get_experiencer
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# 发送消息
|
24
|
-
def send_message sign, query_auth_code
|
25
|
-
http_post_with_token sign, 'cgi-bin', 'memberauth', {"touser": "OPENID", "msgtype": "text", "text": {"content":"#{query_auth_code}_from_api"}}
|
19
|
+
def get_experiencer options={}
|
20
|
+
options.delete(:action)
|
21
|
+
http_post_with_token options, 'wxa', 'memberauth', {action:"get_experiencer"}
|
26
22
|
end
|
27
23
|
|
28
24
|
|
@@ -5,18 +5,22 @@ module ThirdPartyWxa
|
|
5
5
|
# 获取小程序码
|
6
6
|
# 接口A: 适用于需要的码数量较少的业务场景 接口地址:
|
7
7
|
# https://api.weixin.qq.com/wxa/getwxacode?access_token=ACCESS_TOKEN
|
8
|
-
def get_wxa_code
|
9
|
-
|
10
|
-
|
8
|
+
def get_wxa_code options = {}
|
9
|
+
path = options.delete(:path)
|
10
|
+
width = options.delete(:width) || 430
|
11
|
+
http_post_with_token options,
|
12
|
+
'wxa',
|
13
|
+
'getwxacode',
|
14
|
+
{path: path, width: width}
|
11
15
|
end
|
12
16
|
|
13
|
-
# 获取体验小程序的体验二维码
|
14
|
-
# https://api.weixin.qq.com/wxa/ get_qrcode?access_token=TOKEN&path=page%2Findex%3Faction%3D1
|
15
|
-
def get_qrcode(sign, path = nil)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
17
|
+
# # 获取体验小程序的体验二维码
|
18
|
+
# # https://api.weixin.qq.com/wxa/ get_qrcode?access_token=TOKEN&path=page%2Findex%3Faction%3D1
|
19
|
+
# def get_qrcode(sign, path = nil)
|
20
|
+
# params = {}
|
21
|
+
# params.merge!({path: path}) if path.present?
|
22
|
+
# http_get_with_token sign, 'wxa', 'get_qrcode', params
|
23
|
+
# end
|
20
24
|
|
21
25
|
end
|
22
26
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ThirdPartyWxa
|
2
|
+
module Api
|
3
|
+
module Server
|
4
|
+
|
5
|
+
# 1、设置小程序服务器域名
|
6
|
+
# post https://api.weixin.qq.com/wxa/modify_domain?access_token=TOKEN
|
7
|
+
def modify_domain options={}
|
8
|
+
rest = options.slice!(:action, :requestdomain, :wsrequestdomain, :uploaddomain, :downloaddomain)
|
9
|
+
http_post_with_token rest, 'wxa', 'modify_domain', options
|
10
|
+
end
|
11
|
+
|
12
|
+
# 2、设置小程序业务域名(仅供第三方代小程序调用)
|
13
|
+
# post https://api.weixin.qq.com/wxa/setwebviewdomain?access_token=TOKEN
|
14
|
+
def setwebviewdomain options={}
|
15
|
+
rest = options.slice!(:action, :webviewdomain)
|
16
|
+
http_post_with_token rest, 'wxa', 'setwebviewdomain', options
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module ThirdPartyWxa
|
2
2
|
class Plugin
|
3
3
|
|
4
|
-
include Api::
|
5
|
-
include Api::
|
4
|
+
include Api::Authorize
|
5
|
+
include Api::Code
|
6
|
+
include Api::Login
|
6
7
|
include Api::Member
|
7
8
|
include Api::Qrcode
|
8
|
-
include Api::
|
9
|
-
include Api::
|
9
|
+
include Api::Server
|
10
|
+
include Api::Template
|
10
11
|
|
11
12
|
attr_accessor :appid, :appsecret
|
12
13
|
attr_accessor :component_verify_ticket, :ticket_expire_at
|
@@ -21,9 +22,9 @@ module ThirdPartyWxa
|
|
21
22
|
p "third party wxa use #{@token_store.class.to_s}"
|
22
23
|
end
|
23
24
|
|
24
|
-
def set_tickect ticket,
|
25
|
+
def set_tickect ticket, expire_in
|
25
26
|
@component_verify_ticket = ticket
|
26
|
-
@ticket_expire_at = ThirdPartyWxa.cal_expire_at
|
27
|
+
@ticket_expire_at = ThirdPartyWxa.cal_expire_at expire_in
|
27
28
|
self
|
28
29
|
end
|
29
30
|
|
@@ -40,7 +41,7 @@ module ThirdPartyWxa
|
|
40
41
|
def set_component_access_token
|
41
42
|
res = component_access_token_api
|
42
43
|
@component_access_token = res['component_access_token']
|
43
|
-
@component_expire_at = ThirdPartyWxa.cal_expire_at res['
|
44
|
+
@component_expire_at = ThirdPartyWxa.cal_expire_at res['expire_in']
|
44
45
|
self
|
45
46
|
end
|
46
47
|
|
@@ -57,7 +58,7 @@ module ThirdPartyWxa
|
|
57
58
|
def set_pre_auth_code
|
58
59
|
res = pre_auth_code_api
|
59
60
|
@pre_auth_code = res['pre_auth_code']
|
60
|
-
@pre_expire_at = ThirdPartyWxa.cal_expire_at res['
|
61
|
+
@pre_expire_at = ThirdPartyWxa.cal_expire_at res['expire_in'], 60
|
61
62
|
self
|
62
63
|
end
|
63
64
|
|
@@ -65,20 +66,20 @@ module ThirdPartyWxa
|
|
65
66
|
Token::Store.init_with(self)
|
66
67
|
end
|
67
68
|
|
68
|
-
def authorizer_access_token_valid?
|
69
|
-
token_store.authorizer_access_token_valid
|
69
|
+
def authorizer_access_token_valid? options={}
|
70
|
+
token_store.authorizer_access_token_valid options
|
70
71
|
end
|
71
72
|
|
72
|
-
def get_authorizer_access_token
|
73
|
-
token_store.get_authorizer_access_token
|
73
|
+
def get_authorizer_access_token options={}
|
74
|
+
token_store.get_authorizer_access_token options
|
74
75
|
end
|
75
76
|
|
76
|
-
def exchange_authorizer_access_token
|
77
|
-
token_store.exchange_authorizer_access_token
|
77
|
+
def exchange_authorizer_access_token options={}
|
78
|
+
token_store.exchange_authorizer_access_token options
|
78
79
|
end
|
79
80
|
|
80
|
-
def refresh_authorizer_access_token
|
81
|
-
token_store.refresh_authorizer_access_token
|
81
|
+
def refresh_authorizer_access_token options={}
|
82
|
+
token_store.refresh_authorizer_access_token options
|
82
83
|
end
|
83
84
|
|
84
85
|
def http_get scope, url, url_params={}
|
@@ -91,13 +92,13 @@ module ThirdPartyWxa
|
|
91
92
|
ThirdPartyWxa.http_post_without_component_access_token scope, url, post_params, url_params
|
92
93
|
end
|
93
94
|
|
94
|
-
def http_get_with_token
|
95
|
-
url_params.merge! auth_token_params
|
95
|
+
def http_get_with_token options, scope, url, url_params={}
|
96
|
+
url_params.merge! auth_token_params(options)
|
96
97
|
ThirdPartyWxa.http_get_without_component_access_token scope, url, url_params
|
97
98
|
end
|
98
99
|
|
99
|
-
def http_post_with_token
|
100
|
-
url_params.merge! auth_token_params
|
100
|
+
def http_post_with_token options, scope, url, post_params={}, url_params={}
|
101
|
+
url_params.merge! auth_token_params(options)
|
101
102
|
ThirdPartyWxa.http_post_without_component_access_token scope, url, post_params, url_params
|
102
103
|
end
|
103
104
|
|
@@ -107,8 +108,8 @@ module ThirdPartyWxa
|
|
107
108
|
{access_token: get_component_access_token}
|
108
109
|
end
|
109
110
|
|
110
|
-
def auth_token_params
|
111
|
-
{access_token: get_authorizer_access_token(
|
111
|
+
def auth_token_params options
|
112
|
+
{access_token: get_authorizer_access_token(options)}
|
112
113
|
end
|
113
114
|
|
114
115
|
def wx_redis
|
@@ -7,16 +7,16 @@ module ThirdPartyWxa
|
|
7
7
|
raise 'local_store --- please check expire_time yourself'
|
8
8
|
end
|
9
9
|
|
10
|
-
def get_authorizer_access_token
|
11
|
-
|
10
|
+
def get_authorizer_access_token options
|
11
|
+
options.del(:access_token)
|
12
12
|
end
|
13
13
|
|
14
|
-
def exchange_authorizer_access_token
|
15
|
-
plugin.authorizer_access_token_api code
|
14
|
+
def exchange_authorizer_access_token options
|
15
|
+
plugin.authorizer_access_token_api options.delete(:code)
|
16
16
|
end
|
17
17
|
|
18
|
-
def refresh_authorizer_access_token
|
19
|
-
plugin.authorizer_access_token_fresh
|
18
|
+
def refresh_authorizer_access_token options
|
19
|
+
plugin.authorizer_access_token_fresh options.delete(:appid), options.delete(:refresh_token)
|
20
20
|
end
|
21
21
|
|
22
22
|
|
@@ -4,42 +4,42 @@ module ThirdPartyWxa
|
|
4
4
|
class RedisStore < Store
|
5
5
|
|
6
6
|
|
7
|
-
def authorizer_access_token_valid?
|
8
|
-
expire_at = wx_redis.hget
|
9
|
-
return false if wx_redis.hget(
|
7
|
+
def authorizer_access_token_valid? options
|
8
|
+
expire_at = wx_redis.hget options[:redis_key], 'expire_at'
|
9
|
+
return false if wx_redis.hget(options[:redis_key], 'access_token').blank? || expire_at.blank?
|
10
10
|
Time.now.to_i <= expire_at.to_i
|
11
11
|
end
|
12
12
|
|
13
|
-
def get_authorizer_access_token
|
14
|
-
if !authorizer_access_token_valid?
|
15
|
-
if wx_redis.hget(
|
16
|
-
auth_appid = wx_redis.hget(
|
17
|
-
refresh_token = wx_redis.hget(
|
13
|
+
def get_authorizer_access_token options
|
14
|
+
if !authorizer_access_token_valid?(options) # raise exception?
|
15
|
+
if wx_redis.hget(options[:redis_key], 'refresh_token').present?
|
16
|
+
auth_appid = wx_redis.hget(options[:redis_key], 'appid')
|
17
|
+
refresh_token = wx_redis.hget(options[:redis_key], 'refresh_token')
|
18
18
|
refresh_authorizer_access_token auth_appid, refresh_token
|
19
19
|
else
|
20
20
|
raise 'refresh token is missing, please authorize again'
|
21
21
|
end
|
22
22
|
end
|
23
|
-
wx_redis.hget(
|
23
|
+
wx_redis.hget(options[:redis_key], 'access_token')
|
24
24
|
end
|
25
25
|
|
26
|
-
def exchange_authorizer_access_token
|
27
|
-
res = plugin.authorizer_access_token_api code
|
26
|
+
def exchange_authorizer_access_token options
|
27
|
+
res = plugin.authorizer_access_token_api options[:code]
|
28
28
|
authorizer_access_token = res['authorization_info']['authorizer_access_token']
|
29
29
|
authorizer_appid = res['authorization_info']['authorizer_appid']
|
30
30
|
authorizer_expire_at = ThirdPartyWxa.cal_expire_at res['authorization_info']['expires_in']
|
31
31
|
authorizer_refresh_token = res['authorization_info']['authorizer_refresh_token']
|
32
|
-
wx_redis.hset
|
32
|
+
wx_redis.hset options[:redis_key], 'access_token', authorizer_access_token, 'appid', authorizer_appid,
|
33
33
|
'expire_at', authorizer_expire_at, 'refresh_token', authorizer_refresh_token
|
34
34
|
authorizer_access_token
|
35
35
|
end
|
36
36
|
|
37
|
-
def refresh_authorizer_access_token auth_appid,
|
37
|
+
def refresh_authorizer_access_token auth_appid, refresh_token
|
38
38
|
res = plugin.authorizer_access_token_fresh auth_appid, refresh_tokne
|
39
39
|
authorizer_access_token = res['authorizer_access_token']
|
40
40
|
authorizer_expire_at = ThirdPartyWxa.cal_expire_at res['expires_in']
|
41
41
|
authorizer_refresh_token = res['authorizer_refresh_token']
|
42
|
-
wx_redis.hset
|
42
|
+
wx_redis.hset options[:redis_key], 'access_token', authorizer_access_token,
|
43
43
|
'expire_at', authorizer_expire_at, 'refresh_token', authorizer_refresh_token
|
44
44
|
authorizer_access_token
|
45
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: third_party_wxa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hzy
|
@@ -97,11 +97,13 @@ files:
|
|
97
97
|
- lib/third_party_wxa.rb
|
98
98
|
- lib/third_party_wxa/api.rb
|
99
99
|
- lib/third_party_wxa/api/authorize.rb
|
100
|
+
- lib/third_party_wxa/api/base_info.rb
|
101
|
+
- lib/third_party_wxa/api/code.rb
|
102
|
+
- lib/third_party_wxa/api/login.rb
|
100
103
|
- lib/third_party_wxa/api/member.rb
|
101
|
-
- lib/third_party_wxa/api/proxy.rb
|
102
104
|
- lib/third_party_wxa/api/qrcode.rb
|
105
|
+
- lib/third_party_wxa/api/server.rb
|
103
106
|
- lib/third_party_wxa/api/template.rb
|
104
|
-
- lib/third_party_wxa/api/token.rb
|
105
107
|
- lib/third_party_wxa/config.rb
|
106
108
|
- lib/third_party_wxa/plugin.rb
|
107
109
|
- lib/third_party_wxa/token/local_store.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module ThirdPartyWxa
|
2
|
-
module Api
|
3
|
-
module Proxy
|
4
|
-
|
5
|
-
# 获取授权小程序帐号的可选类目
|
6
|
-
# https://api.weixin.qq.com/wxa/get_category?access_token=TOKEN
|
7
|
-
def get_category sign
|
8
|
-
http_get_with_token sign, 'wxa', 'get_category'
|
9
|
-
end
|
10
|
-
|
11
|
-
# 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用)
|
12
|
-
# https://api.weixin.qq.com/wxa/get_page?access_token=TOKEN
|
13
|
-
def get_page sign
|
14
|
-
http_get_with_token 'sign', 'wxa', 'get_page'
|
15
|
-
end
|
16
|
-
|
17
|
-
# 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用
|
18
|
-
# https://api.weixin.qq.com/wxa/submit_audit?access_token=TOKEN
|
19
|
-
def submit_audit sign, config_json
|
20
|
-
http_post_with_token 'sign', 'wxa', 'submit_audit', config_json
|
21
|
-
end
|
22
|
-
|
23
|
-
# 7、查询某个指定版本的审核状态(仅供第三方代小程序调用
|
24
|
-
# https://api.weixin.qq.com/wxa/get_auditstatus?access_token=TOKEN
|
25
|
-
def get_auditstatus sign, auditid
|
26
|
-
http_post_with_token sign, 'wxa', 'get_auditstatus', {auditid: auditid}
|
27
|
-
end
|
28
|
-
|
29
|
-
# 8、查询最新一次提交的审核状态(仅供第三方代小程序调用)
|
30
|
-
# https://api.weixin.qq.com/wxa/get_latest_auditstatus?access_token=TOKEN
|
31
|
-
def get_latest_auditstatus sign
|
32
|
-
http_get_with_token 'sign', 'wxa', 'get_latest_auditstatus'
|
33
|
-
end
|
34
|
-
|
35
|
-
# 9、发布已通过审核的小程序(仅供第三方代小程序调用)
|
36
|
-
# https://api.weixin.qq.com/wxa/release?access_token=TOKEN
|
37
|
-
def release sign
|
38
|
-
http_post_with_token sign, 'wxa', 'release'
|
39
|
-
end
|
40
|
-
|
41
|
-
# 10、修改小程序线上代码的可见状态(仅供第三方代小程序调用)close为不可见,open为可见
|
42
|
-
# https://api.weixin.qq.com/wxa/change_visitstatus?access_token=TOKEN
|
43
|
-
def change_visitstatus sign, action
|
44
|
-
http_post_with_token sign, 'wxa', 'change_visitstatus', {action: action}
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module ThirdPartyWxa
|
2
|
-
module Api
|
3
|
-
module Token
|
4
|
-
|
5
|
-
# https://api.weixin.qq.com/cgi-bin/component/api_component_token
|
6
|
-
def component_access_token_api
|
7
|
-
params = {component_appid: appid, component_appsecret: appsecret, component_verify_ticket: component_verify_ticket}
|
8
|
-
ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_component_token', params
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
# 通过component_access_token获取pre_auth_code
|
13
|
-
# https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=xxx
|
14
|
-
def pre_auth_code_api
|
15
|
-
params = {component_appid: appid}
|
16
|
-
ThirdPartyWxa.http_post_without_component_access_token 'cgi-bin', 'component/api_create_preauthcode', params, {component_access_token: get_component_access_token}
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|