Skip to content

Commit fd0ef07

Browse files
committed
Merge branch 'develop'
2 parents ae9180a + 1a0a4da commit fd0ef07

File tree

16 files changed

+1141
-387
lines changed

16 files changed

+1141
-387
lines changed

.bumpversion.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[bumpversion]
2+
current_version = 1.3.0
3+
commit = True
4+
tag = True
5+
6+
[bumpversion:file:werobot/__init__.py]
7+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ pip-selfcheck.json
6363
venv
6464

6565
*.sqlite3
66+
.pytest_cache

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
os: osx
22
language: generic
3-
osx_image: xcode8.2
3+
osx_image: xcode8.3
44
matrix:
55
include:
66
- env:
@@ -14,7 +14,7 @@ matrix:
1414
- PYTHON_VERSION="2.7.12"
1515
- env:
1616
- PYTHON_MAJOR=pypy
17-
- PYTHON_VERSION="pypy-5.0.0"
17+
- PYTHON_VERSION="pypy2.7-5.10.0"
1818
cache:
1919
directories:
2020
- $HOME/.pyenv

dev-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
flake8==3.5.0
33
tox
44
django
5+
bumpversion

docs/changelog.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=============
33

4+
Version 1.3.0
5+
----------------
6+
+ 增加 :class:`werobot.messages.events.UserScanProductEvent`
7+
+ 增加 :class:`werobot.messages.events.UserScanProductEnterSessionEvent`
8+
+ 增加 :class:`werobot.messages.events.UserScanProductAsyncEvent`
9+
+ 增加 :class:`werobot.messages.events.UserScanProductVerifyActionEvent`
10+
+ 增加 :class:`werobot.messages.events.PicSysphotoEvent`
11+
+ 增加 :class:`werobot.messages.events.PicPhotoOrAlbumEvent`
12+
+ 增加 :class:`werobot.messages.events.PicWeixinEvent`
13+
+ 增加 :class:`werobot.messages.events.LocationSelectEvent`
14+
415
Version 1.2.0
516
----------------
617
+ 增加 :class:`werobot.session.mysqlstorage.MySQLStorage`

docs/events.rst

Lines changed: 129 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SubscribeEvent 的属性:
2424
======== ===================================
2525
name value
2626
======== ===================================
27-
type 'subscribe'
27+
type 'subscribe_event'
2828
key 事件 key 值。 当且仅当未关注公众号扫描二维码时存在
2929
ticket 二维码的 ticket。 当且仅当未关注公众号扫描二维码时存在
3030
======== ===================================
@@ -37,7 +37,7 @@ UnSubscribeEvent 的属性:
3737
======== ===================================
3838
name value
3939
======== ===================================
40-
type 'unsubscribe'
40+
type 'unsubscribe_event'
4141
======== ===================================
4242

4343
ScanEvent
@@ -75,11 +75,70 @@ ScanCodeWaitMsgEvent 的属性:
7575
============ ===================================
7676
name value
7777
============ ===================================
78-
type 'scancode_waitmsg'
78+
type 'scancode_waitmsg_event'
7979
scan_type 扫描类型,一般是qrcode
8080
scan_result 扫描结果,即二维码对应的字符串信息
8181
============ ===================================
8282

83+
PicSysphotoEvent
84+
--------------------
85+
86+
弹出系统拍照发图的事件推送的 Event。属性:
87+
88+
============ =========================================
89+
name value
90+
============ =========================================
91+
type 'pic_sysphoto_event'
92+
key 事件KEY值,由开发者在创建菜单时设定
93+
count 发送的图片数量
94+
pic_list 图片列表,例如 [{'pic_md5_sum': '123'}]
95+
============ =========================================
96+
97+
PicPhotoOrAlbumEvent
98+
--------------------
99+
100+
弹出拍照或者相册发图的事件推送的 Event。属性:
101+
102+
============ =========================================
103+
name value
104+
============ =========================================
105+
type 'pic_photo_or_album_event'
106+
key 事件KEY值,由开发者在创建菜单时设定
107+
count 发送的图片数量
108+
pic_list 图片列表,例如 [{'pic_md5_sum': '123'}]
109+
============ =========================================
110+
111+
PicWeixinEvent
112+
--------------------
113+
114+
弹出微信相册发图器的事件推送的 Event。属性:
115+
116+
============ =========================================
117+
name value
118+
============ =========================================
119+
type 'pic_weixin_event'
120+
key 事件KEY值,由开发者在创建菜单时设定
121+
count 发送的图片数量
122+
pic_list 图片列表,例如 [{'pic_md5_sum': '123'}]
123+
============ =========================================
124+
125+
LocationSelectEvent
126+
--------------------
127+
128+
弹出地理位置选择器的事件推送的 Event。属性:
129+
130+
============ ==================================================
131+
name value
132+
============ ==================================================
133+
type 'location_select_event'
134+
key 事件KEY值,由开发者在创建菜单时设定
135+
location_x X坐标信息
136+
location_y Y坐标信息
137+
scale 精度,可理解为精度或者比例尺、越精细的话 scale 越高
138+
label 地理位置的字符串信息
139+
poi_name 朋友圈POI的名字,可能为 None
140+
============ ==================================================
141+
83142
ClickEvent
84143
----------
85144

@@ -88,7 +147,7 @@ ClickEvent 的属性:
88147
======== ===================================
89148
name value
90149
======== ===================================
91-
type 'click'
150+
type 'click_event'
92151
key 事件 key 值。
93152
======== ===================================
94153

@@ -100,7 +159,7 @@ ViewEvent 的属性:
100159
======== ===================================
101160
name value
102161
======== ===================================
103-
type 'view'
162+
type 'view_event'
104163
key 事件 key 值。
105164
======== ===================================
106165

@@ -112,7 +171,7 @@ LocationEvent 的属性:
112171
=========== ===================================
113172
name value
114173
=========== ===================================
115-
type 'location'
174+
type 'location_event'
116175
latitude 地理位置纬度
117176
longitude 地理位置经度
118177
precision 地理位置精度
@@ -129,6 +188,69 @@ name value
129188
status 发送是否成功。为 'success' 或失败原因
130189
=========== ===================================
131190

191+
UserScanProductEvent
192+
--------------------
193+
194+
打开商品主页事件推送的 Event。属性:
195+
196+
============= ======================================================================
197+
name value
198+
============= ======================================================================
199+
type 'user_scan_product_event'
200+
key_standard 商品编码标准。
201+
key_str 商品编码内容。
202+
country 用户在微信内设置的国家。
203+
province 用户在微信内设置的省份。
204+
city 用户在微信内设置的城市。
205+
sex 用户的性别,1为男性,2为女性,0代表未知。
206+
scene 打开商品主页的场景,1为扫码,2为其他打开场景(如会话、收藏或朋友圈)。
207+
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。
208+
============= ======================================================================
209+
210+
UserScanProductEnterSessionEvent
211+
--------------------------------
212+
213+
当用户从商品主页进入公众号会话时推送的 Event。属性:
214+
215+
============= ======================================================================
216+
name value
217+
============= ======================================================================
218+
type 'user_scan_product_enter_session_event'
219+
key_standard 商品编码标准。
220+
key_str 商品编码内容。
221+
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。
222+
============= ======================================================================
223+
224+
UserScanProductAsyncEvent
225+
-------------------------
226+
227+
当用户打开商品主页,微信会将该用户实时的地理位置信息以异步事件的形式推送的 Event。属性:
228+
229+
============= ============================================================================================================================================
230+
name value
231+
============= ============================================================================================================================================
232+
type 'user_scan_product_async_event'
233+
key_standard 商品编码标准。
234+
key_str 商品编码内容。
235+
ext_info 调用“获取商品二维码接口”时传入的 extinfo,为标识参数。
236+
region_code 用户的实时地理位置信息(目前只精确到省一级),可在国家统计局网站查到对应明细: http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201504/t20150415_712722.html
237+
============= ============================================================================================================================================
238+
239+
UserScanProductVerifyActionEvent
240+
--------------------------------
241+
242+
提交审核的商品,完成审核后,微信会将审核结果以事件的形式推送的 Event。属性:
243+
244+
============= ======================================================================
245+
name value
246+
============= ======================================================================
247+
type 'user_scan_product_verify_action_event'
248+
key_standard 商品编码标准。
249+
key_str 商品编码内容。
250+
result 审核结果。verify_ok表示审核通过,verify_not_pass表示审核未通过。
251+
reason_msg 审核未通过的原因。
252+
============= ======================================================================
253+
132254
UnknownEvent
133255
------------
134256

@@ -137,7 +259,7 @@ UnknownEvent 的属性:
137259
========= =====================================
138260
name value
139261
========= =====================================
140-
type 'unknown'
262+
type 'unknown_event'
141263
raw 请求的正文部分。标准的XML格式。
142264
========= =====================================
143265

docs/handlers.rst

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,33 @@ WeRoBot会将合法的请求发送给 handlers 依次执行。
5353

5454
在 WeRobot 中我们把请求分成了 Message 和 Event 两种类型,针对两种类型的请求分别有不同的 Handler。
5555

56-
====================== =================
57-
修饰符 类型
58-
====================== =================
59-
robot.text 文本 (Message)
60-
robot.image 图像 (Message)
61-
robot.location 位置 (Message)
62-
robot.link 链接 (Message)
63-
robot.voice 语音 (Message)
64-
robot.unknown 未知类型 (Message)
65-
robot.subscribe 被关注 (Event)
66-
robot.unsubscribe 被取消关注 (Event)
67-
robot.click 自定义菜单事件 (Event)
68-
robot.view 链接 (Event)
69-
robot.scancode_push 扫描推送 (Event)
70-
robot.scancode_waitmsg 扫描弹消息 (Event)
71-
robot.location_event 上报位置 (Event)
72-
robot.unknown_event 未知类型 (Event)
73-
====================== =================
56+
====================================== =================
57+
修饰符 类型
58+
====================================== =================
59+
robot.text 文本 (Message)
60+
robot.image 图像 (Message)
61+
robot.location 位置 (Message)
62+
robot.link 链接 (Message)
63+
robot.voice 语音 (Message)
64+
robot.unknown 未知类型 (Message)
65+
robot.subscribe 被关注 (Event)
66+
robot.unsubscribe 被取消关注 (Event)
67+
robot.click 自定义菜单事件 (Event)
68+
robot.view 链接 (Event)
69+
robot.scancode_push 扫描推送 (Event)
70+
robot.scancode_waitmsg 扫描弹消息 (Event)
71+
robot.pic_sysphoto 弹出系统拍照发图(Event)
72+
robot.pic_photo_or_album 弹出拍照或者相册发图(Event)
73+
robot.pic_weixin 弹出微信相册发图器(Event)
74+
robot.location_select 弹出地理位置选择器(Event)
75+
robot.scan 已关注扫描二维码(Event)
76+
robot.user_scan_product 打开商品主页事件推送(Event)
77+
robot.user_scan_product_enter_session 进入公众号事件推送(Event)
78+
robot.user_scan_product_async 地理位置信息异步推送(Event)
79+
robot.user_scan_product_verify_action 商品审核结果推送(Event)
80+
robot.location_event 上报位置 (Event)
81+
robot.unknown_event 未知类型 (Event)
82+
====================================== =================
7483

7584
额,这个 handler 想处理文本信息和地理位置信息? ::
7685

0 commit comments

Comments
 (0)