weixin_rails_middleware 1.3.2 → 1.3.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93c071e9165390e9d9f396c1437bbe4273e2e34608a988f74ad7c011885620a9
|
4
|
+
data.tar.gz: 5bd7edf8b0fa48aadd37077b756e3d50dcc2dfcd31e0cb16012af36b17ef84b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5739cd1e7912b5e7a414eff1a17a7e462e93a61e15225b812c1aa34793af22f9cd18ef5337b1e73c246f013b2006d6bbfd377ea6003135caa6e99811eb78370
|
7
|
+
data.tar.gz: 6b2588a06fe7e778d1dd00e44238d136f118c716cbc194bea15ebfb549db67ccd2e611182f17c3a3b8c76a3372b41b4717d78042fb26449cd1457f0f60e53c4f
|
@@ -2,10 +2,12 @@ module WeixinRailsMiddleware
|
|
2
2
|
class WeixinController < ActionController::Base
|
3
3
|
include ReplyWeixinMessageHelper
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
skip_before_action :verify_authenticity_token
|
6
|
+
|
7
|
+
before_action :check_is_encrypt, only: [:index, :reply]
|
8
|
+
before_action :initialize_adapter, :check_weixin_legality, only: [:index, :reply]
|
9
|
+
before_action :set_weixin_public_account, :set_weixin_message, only: :reply
|
10
|
+
before_action :set_keyword, only: :reply
|
9
11
|
|
10
12
|
def index
|
11
13
|
end
|
@@ -2,10 +2,19 @@
|
|
2
2
|
# 1, @weixin_message: 获取微信所有参数.
|
3
3
|
# 2, @weixin_public_account: 如果配置了public_account_class选项,则会返回当前实例,否则返回nil.
|
4
4
|
# 3, @keyword: 目前微信只有这三种情况存在关键字: 文本消息, 事件推送, 接收语音识别结果
|
5
|
+
|
6
|
+
# 兼容Rails6.0的目录加载机制
|
7
|
+
# https://github.com/fxn/zeitwerk
|
8
|
+
begin
|
9
|
+
class Controllers::WeixinRailsMiddleware::WeixinControllerDecorator;end
|
10
|
+
rescue
|
11
|
+
end
|
12
|
+
|
5
13
|
WeixinRailsMiddleware::WeixinController.class_eval do
|
6
14
|
|
7
15
|
def reply
|
8
|
-
|
16
|
+
result = send("response_#{@weixin_message.MsgType}_message", {})
|
17
|
+
render result.is_a?(String) ? {xml: result} : {nothing: true}
|
9
18
|
end
|
10
19
|
|
11
20
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weixin_rails_middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lanrion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.7.6
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: weixin_rails_middleware for integration weixin
|