weixin_rails_middleware 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/templates/weixin_controller.rb +30 -7
- data/lib/weixin_rails_middleware/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f46938e87116ddd8d66f7862ec7a695463b4f989
|
4
|
+
data.tar.gz: 63672ab0ec80e69d443a58128db43a2a4f424baf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be1a1c9bc714f6b654dcee5d187057ae7c6ea4dbdb6e6352b19e14add8aabc34f4b6b6814d4c1d99c8fcfc44974458c0cd74e29593bd920772efd9ea2f593bf8
|
7
|
+
data.tar.gz: 2c36247b32a22c04f817fca2e73e640706852a29c405c26f4d8e1eba3fd988a983e2279a3bcc22435b087a7258b2127634eb0720ec509e4b086f5139525a2068
|
@@ -65,13 +65,13 @@ WeixinRailsMiddleware::WeixinController.class_eval do
|
|
65
65
|
|
66
66
|
def response_event_message(options={})
|
67
67
|
event_type = @weixin_message.Event
|
68
|
-
send("
|
68
|
+
send("handle_#{event_type.downcase}_event")
|
69
69
|
end
|
70
70
|
|
71
71
|
private
|
72
72
|
|
73
73
|
# 关注公众账号
|
74
|
-
def
|
74
|
+
def handle_subscribe_event
|
75
75
|
if @keyword.present?
|
76
76
|
# 扫描带参数二维码事件: 1. 用户未关注时,进行关注后的事件推送
|
77
77
|
return reply_text_message("扫描带参数二维码事件: 1. 用户未关注时,进行关注后的事件推送, keyword: #{@keyword}")
|
@@ -80,16 +80,16 @@ WeixinRailsMiddleware::WeixinController.class_eval do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# 取消关注
|
83
|
-
def
|
83
|
+
def handle_unsubscribe_event
|
84
84
|
Rails.logger.info("取消关注")
|
85
85
|
end
|
86
86
|
|
87
87
|
# 扫描带参数二维码事件: 2. 用户已关注时的事件推送
|
88
|
-
def
|
88
|
+
def handle_scan_event
|
89
89
|
reply_text_message("扫描带参数二维码事件: 2. 用户已关注时的事件推送, keyword: #{@keyword}")
|
90
90
|
end
|
91
91
|
|
92
|
-
def
|
92
|
+
def handle_location_event # 上报地理位置事件
|
93
93
|
@lat = @weixin_message.Latitude
|
94
94
|
@lgt = @weixin_message.Longitude
|
95
95
|
@precision = @weixin_message.Precision
|
@@ -97,13 +97,36 @@ WeixinRailsMiddleware::WeixinController.class_eval do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
# 点击菜单拉取消息时的事件推送
|
100
|
-
def
|
100
|
+
def handle_click_event
|
101
101
|
reply_text_message("你点击了: #{@keyword}")
|
102
102
|
end
|
103
103
|
|
104
104
|
# 点击菜单跳转链接时的事件推送
|
105
|
-
def
|
105
|
+
def handle_view_event
|
106
106
|
Rails.logger.info("你点击了: #{@keyword}")
|
107
107
|
end
|
108
108
|
|
109
|
+
# 帮助文档: https://github.com/lanrion/weixin_authorize/issues/22
|
110
|
+
|
111
|
+
# 由于群发任务提交后,群发任务可能在一定时间后才完成,因此,群发接口调用时,仅会给出群发任务是否提交成功的提示,若群发任务提交成功,则在群发任务结束时,会向开发者在公众平台填写的开发者URL(callback URL)推送事件。
|
112
|
+
|
113
|
+
# 推送的XML结构如下(发送成功时):
|
114
|
+
|
115
|
+
# <xml>
|
116
|
+
# <ToUserName><![CDATA[gh_3e8adccde292]]></ToUserName>
|
117
|
+
# <FromUserName><![CDATA[oR5Gjjl_eiZoUpGozMo7dbBJ362A]]></FromUserName>
|
118
|
+
# <CreateTime>1394524295</CreateTime>
|
119
|
+
# <MsgType><![CDATA[event]]></MsgType>
|
120
|
+
# <Event><![CDATA[MASSSENDJOBFINISH]]></Event>
|
121
|
+
# <MsgID>1988</MsgID>
|
122
|
+
# <Status><![CDATA[sendsuccess]]></Status>
|
123
|
+
# <TotalCount>100</TotalCount>
|
124
|
+
# <FilterCount>80</FilterCount>
|
125
|
+
# <SentCount>75</SentCount>
|
126
|
+
# <ErrorCount>5</ErrorCount>
|
127
|
+
# </xml>
|
128
|
+
def handle_masssendjobfinish_event
|
129
|
+
Rails.logger.info("回调事件处理")
|
130
|
+
end
|
131
|
+
|
109
132
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weixin_rails_middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lanrion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.6.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.6.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: multi_xml
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.5.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.5.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: roxml
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: weixin_rails_middleware for integration weixin develop
|
@@ -117,12 +117,12 @@ require_paths:
|
|
117
117
|
- lib
|
118
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- -
|
125
|
+
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|