eric_weixin 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71e30df53ea57b8653478a30c1b372acfe6cfd0d
4
- data.tar.gz: fb343a19e2dc59e4f2f85c7641f93b78ae4012f6
3
+ metadata.gz: 7f29f909c20410c0a61f11dfc44df76554a68386
4
+ data.tar.gz: 44a3539640613c1c2281f49d1ccf2c88c5a0cc41
5
5
  SHA512:
6
- metadata.gz: a29371faa84e186eef8cc9f8aa3095c916d89c7bb3dda275205d036f6c17cce7ea82c6c359e0c39705002702efae1591e27c514477633b375309ce58b3623926
7
- data.tar.gz: ca2330aee0b3809223b7586c8e254e314dd1e7cff9e2bcac202d55e66437b6b104b6ae07493eac939b51fd6c58436ce5a037694a39a911fcb5ceac746d1e8a25
6
+ metadata.gz: 088e1eaaf3b8ad4e61894ec96f18b8c9e8f1c38527a6d9893cff879f429690ba8726d24fe7a14c97c68c3d6264ab37ad355b3a4bb502ee8ae01a6e3d4e5bf531
7
+ data.tar.gz: 29c4be8c6cbe0edeff83c45892a82523dbd21ba27b7848137e355194773dd007f739129bf5383ad5663f6da725a7b65502025eabf080049ba89636da58a3836c
data/.idea/workspace.xml CHANGED
@@ -2,7 +2,18 @@
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
4
  <list default="true" id="825e533a-b0a1-462f-abd1-eefea8ff703f" name="Default" comment="">
5
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/model/message_log.rb" />
6
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/moudles/mult_customer.rb" />
7
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/moudles/snsapi.rb" />
8
+ <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/moudles/two_dimension_code.rb" />
9
+ <change type="MOVED" beforePath="$PROJECT_DIR$/lib/eric_weixin/reply_message.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb" />
10
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb" />
11
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb" />
5
12
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin.rb" />
13
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb" />
14
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/model/template_message_log.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/model/template_message_log.rb" />
15
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb" />
16
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb" afterPath="$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb" />
6
17
  <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
7
18
  </list>
8
19
  <ignored path="eric_weixin.iws" />
@@ -26,31 +37,71 @@
26
37
  </component>
27
38
  <component name="FileEditorManager">
28
39
  <leaf>
29
- <file leaf-file-name="eric_weixin.gemspec" pinned="false" current="false" current-in-tab="false">
30
- <entry file="file://$PROJECT_DIR$/eric_weixin.gemspec">
40
+ <file leaf-file-name="aa.erb" pinned="false" current="false" current-in-tab="false">
41
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb">
31
42
  <provider selected="true" editor-type-id="text-editor">
32
- <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="684">
33
- <caret line="28" column="68" selection-start-line="28" selection-start-column="68" selection-end-line="28" selection-end-column="68" />
43
+ <state vertical-scroll-proportion="-1.3333334" vertical-offset="0" max-vertical-offset="144">
44
+ <caret line="2" column="31" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
34
45
  <folding />
35
46
  </state>
36
47
  </provider>
37
48
  </entry>
38
49
  </file>
39
- <file leaf-file-name="version.rb" pinned="false" current="true" current-in-tab="true">
40
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/version.rb">
50
+ <file leaf-file-name="snsapi.rb" pinned="false" current="false" current-in-tab="false">
51
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/snsapi.rb">
41
52
  <provider selected="true" editor-type-id="text-editor">
42
- <state vertical-scroll-proportion="0.02549575" vertical-offset="0" max-vertical-offset="706">
43
- <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
53
+ <state vertical-scroll-proportion="23.538462" vertical-offset="702" max-vertical-offset="1422">
54
+ <caret line="5" column="11" selection-start-line="5" selection-start-column="11" selection-end-line="5" selection-end-column="11" />
55
+ <folding />
56
+ </state>
57
+ </provider>
58
+ </entry>
59
+ </file>
60
+ <file leaf-file-name="access_token.rb" pinned="false" current="false" current-in-tab="false">
61
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb">
62
+ <provider selected="true" editor-type-id="text-editor">
63
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1008">
64
+ <caret line="0" column="17" selection-start-line="0" selection-start-column="7" selection-end-line="0" selection-end-column="17" />
65
+ <folding />
66
+ </state>
67
+ </provider>
68
+ </entry>
69
+ </file>
70
+ <file leaf-file-name="reply_message.rb" pinned="false" current="false" current-in-tab="false">
71
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb">
72
+ <provider selected="true" editor-type-id="text-editor">
73
+ <state vertical-scroll-proportion="0.0" vertical-offset="918" max-vertical-offset="1566">
74
+ <caret line="66" column="81" selection-start-line="66" selection-start-column="81" selection-end-line="67" selection-end-column="83" />
75
+ <folding />
76
+ </state>
77
+ </provider>
78
+ </entry>
79
+ </file>
80
+ <file leaf-file-name="mult_customer.rb" pinned="false" current="true" current-in-tab="true">
81
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/mult_customer.rb">
82
+ <provider selected="true" editor-type-id="text-editor">
83
+ <state vertical-scroll-proportion="0.6523605" vertical-offset="650" max-vertical-offset="1116">
84
+ <caret line="53" column="7" selection-start-line="53" selection-start-column="7" selection-end-line="53" selection-end-column="7" />
85
+ <folding />
86
+ </state>
87
+ </provider>
88
+ </entry>
89
+ </file>
90
+ <file leaf-file-name="two_dimension_code.rb" pinned="false" current="false" current-in-tab="false">
91
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/two_dimension_code.rb">
92
+ <provider selected="true" editor-type-id="text-editor">
93
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="432">
94
+ <caret line="8" column="0" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
44
95
  <folding />
45
96
  </state>
46
97
  </provider>
47
98
  </entry>
48
99
  </file>
49
- <file leaf-file-name="eric_weixin.rb" pinned="false" current="false" current-in-tab="false">
50
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin.rb">
100
+ <file leaf-file-name="version.rb" pinned="false" current="false" current-in-tab="false">
101
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/version.rb">
51
102
  <provider selected="true" editor-type-id="text-editor">
52
- <state vertical-scroll-proportion="0.0" vertical-offset="279" max-vertical-offset="972">
53
- <caret line="18" column="2" selection-start-line="18" selection-start-column="2" selection-end-line="18" selection-end-column="2" />
103
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="162">
104
+ <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
54
105
  <folding />
55
106
  </state>
56
107
  </provider>
@@ -73,29 +124,38 @@
73
124
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/models/public_account.rb" />
74
125
  <option value="$PROJECT_DIR$/lib/eric_weixin/model/public_account.rb" />
75
126
  <option value="$PROJECT_DIR$/lib/eric_weixin/public_account.rb" />
76
- <option value="$PROJECT_DIR$/lib/eric_weixin/reply_message.rb" />
77
- <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb" />
78
127
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/news.rb" />
79
128
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/article.rb" />
80
129
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/article_news.rb" />
81
130
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/base_controller.rb" />
82
131
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/views/weixin/aa.erb" />
83
132
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/controllers/big_application_controller.rb" />
84
- <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb" />
85
- <option value="$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb" />
86
- <option value="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb" />
87
133
  <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/public_account.rb" />
88
- <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb" />
89
134
  <option value="$PROJECT_DIR$/eric_weixin.gemspec" />
135
+ <option value="$PROJECT_DIR$/lib/eric_weixin/config/routes.rb" />
136
+ <option value="$PROJECT_DIR$/Gemfile.lock" />
137
+ <option value="$PROJECT_DIR$/lib/eric_weixin/reply_message.rb" />
138
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb" />
139
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/template_message_log.rb" />
140
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/message_log.rb" />
141
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/moudles/user_location.rb" />
142
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb" />
143
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb" />
144
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb" />
90
145
  <option value="$PROJECT_DIR$/lib/eric_weixin.rb" />
91
146
  <option value="$PROJECT_DIR$/lib/eric_weixin/version.rb" />
147
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb" />
148
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/moudles/two_dimension_code.rb" />
149
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/moudles/snsapi.rb" />
150
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb" />
151
+ <option value="$PROJECT_DIR$/lib/eric_weixin/app/moudles/mult_customer.rb" />
92
152
  </list>
93
153
  </option>
94
154
  </component>
95
155
  <component name="ProjectFrameBounds">
96
156
  <option name="y" value="23" />
97
157
  <option name="width" value="1440" />
98
- <option name="height" value="829" />
158
+ <option name="height" value="832" />
99
159
  </component>
100
160
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
101
161
  <OptionsSetting value="true" id="Add" />
@@ -123,7 +183,6 @@
123
183
  <sortByType />
124
184
  </navigator>
125
185
  <panes>
126
- <pane id="Scope" />
127
186
  <pane id="ProjectPane">
128
187
  <subPane>
129
188
  <PATH>
@@ -208,6 +267,32 @@
208
267
  <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
209
268
  </PATH_ELEMENT>
210
269
  </PATH>
270
+ <PATH>
271
+ <PATH_ELEMENT>
272
+ <option name="myItemId" value="eric_weixin" />
273
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
274
+ </PATH_ELEMENT>
275
+ <PATH_ELEMENT>
276
+ <option name="myItemId" value="eric_weixin" />
277
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
278
+ </PATH_ELEMENT>
279
+ <PATH_ELEMENT>
280
+ <option name="myItemId" value="lib" />
281
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
282
+ </PATH_ELEMENT>
283
+ <PATH_ELEMENT>
284
+ <option name="myItemId" value="eric_weixin" />
285
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
286
+ </PATH_ELEMENT>
287
+ <PATH_ELEMENT>
288
+ <option name="myItemId" value="app" />
289
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
290
+ </PATH_ELEMENT>
291
+ <PATH_ELEMENT>
292
+ <option name="myItemId" value="moudles" />
293
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
294
+ </PATH_ELEMENT>
295
+ </PATH>
211
296
  <PATH>
212
297
  <PATH_ELEMENT>
213
298
  <option name="myItemId" value="eric_weixin" />
@@ -266,6 +351,7 @@
266
351
  </PATH>
267
352
  </subPane>
268
353
  </pane>
354
+ <pane id="Scope" />
269
355
  </panes>
270
356
  </component>
271
357
  <component name="PropertiesComponent">
@@ -276,12 +362,14 @@
276
362
  </component>
277
363
  <component name="RecentsManager">
278
364
  <key name="CopyFile.RECENT_KEYS">
365
+ <recent name="$PROJECT_DIR$/lib/eric_weixin/app/moudles" />
366
+ <recent name="$PROJECT_DIR$/lib/eric_weixin/app/model" />
367
+ <recent name="$PROJECT_DIR$/lib/eric_weixin/config" />
279
368
  <recent name="$PROJECT_DIR$/lib/eric_weixin/app/controllers" />
280
369
  <recent name="$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin" />
281
- <recent name="$PROJECT_DIR$/lib/eric_weixin/app/model" />
282
- <recent name="$PROJECT_DIR$/lib/app/models" />
283
370
  </key>
284
371
  <key name="MoveFile.RECENT_KEYS">
372
+ <recent name="$PROJECT_DIR$/lib/eric_weixin/app/moudles" />
285
373
  <recent name="$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin" />
286
374
  <recent name="$PROJECT_DIR$/lib/eric_weixin/app/model" />
287
375
  <recent name="$PROJECT_DIR$/lib/eric_weixin" />
@@ -387,15 +475,16 @@
387
475
  <servers />
388
476
  </component>
389
477
  <component name="ToolWindowManager">
390
- <frame x="0" y="23" width="1440" height="829" extended-state="0" />
478
+ <frame x="0" y="23" width="1440" height="832" extended-state="0" />
391
479
  <editor active="true" />
392
480
  <layout>
393
481
  <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
394
- <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
482
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32971507" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
395
483
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
484
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.21573949" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
396
485
  <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
397
486
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
398
- <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25178826" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
487
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21459228" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
399
488
  <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
400
489
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
401
490
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
@@ -403,12 +492,31 @@
403
492
  <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
404
493
  <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
405
494
  <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
406
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.42098093" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
407
495
  <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
408
496
  <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
409
- <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
410
497
  <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
498
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
411
499
  </layout>
500
+ <layout-to-restore>
501
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
502
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
503
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
504
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
505
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
506
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.19402985" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
507
+ <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
508
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
509
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
510
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
511
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
512
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
513
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
514
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
515
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2746781" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
516
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
517
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
518
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
519
+ </layout-to-restore>
412
520
  </component>
413
521
  <component name="Vcs.Log.UiProperties">
414
522
  <option name="RECENTLY_FILTERED_USER_GROUPS">
@@ -427,57 +535,11 @@
427
535
  </option>
428
536
  </component>
429
537
  <component name="XDebuggerManager">
430
- <breakpoint-manager />
538
+ <breakpoint-manager>
539
+ <option name="time" value="1" />
540
+ </breakpoint-manager>
431
541
  </component>
432
542
  <component name="editorHistoryManager">
433
- <entry file="file://$PROJECT_DIR$/eric_weixin.gemspec">
434
- <provider selected="true" editor-type-id="text-editor">
435
- <state vertical-scroll-proportion="0.0" vertical-offset="504" max-vertical-offset="684">
436
- <caret line="28" column="68" selection-start-line="28" selection-start-column="68" selection-end-line="28" selection-end-column="68" />
437
- <folding />
438
- </state>
439
- </provider>
440
- </entry>
441
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb">
442
- <provider selected="true" editor-type-id="text-editor">
443
- <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="774">
444
- <caret line="31" column="7" selection-start-line="31" selection-start-column="7" selection-end-line="31" selection-end-column="7" />
445
- <folding />
446
- </state>
447
- </provider>
448
- </entry>
449
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb">
450
- <provider selected="true" editor-type-id="text-editor">
451
- <state vertical-scroll-proportion="0.0" vertical-offset="306" max-vertical-offset="1710">
452
- <caret line="17" column="10" selection-start-line="17" selection-start-column="10" selection-end-line="17" selection-end-column="10" />
453
- <folding />
454
- </state>
455
- </provider>
456
- </entry>
457
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/public_account.rb">
458
- <provider selected="true" editor-type-id="text-editor">
459
- <state vertical-scroll-proportion="0.0" vertical-offset="612" max-vertical-offset="3438">
460
- <caret line="34" column="24" selection-start-line="34" selection-start-column="24" selection-end-line="34" selection-end-column="24" />
461
- <folding />
462
- </state>
463
- </provider>
464
- </entry>
465
- <entry file="file://$PROJECT_DIR$/eric_weixin.gemspec">
466
- <provider selected="true" editor-type-id="text-editor">
467
- <state vertical-scroll-proportion="0.0" vertical-offset="414" max-vertical-offset="702">
468
- <caret line="23" column="2" selection-start-line="23" selection-start-column="2" selection-end-line="23" selection-end-column="55" />
469
- <folding />
470
- </state>
471
- </provider>
472
- </entry>
473
- <entry file="file://$PROJECT_DIR$/Gemfile">
474
- <provider selected="true" editor-type-id="text-editor">
475
- <state vertical-scroll-proportion="0.0" vertical-offset="72" max-vertical-offset="180">
476
- <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
477
- <folding />
478
- </state>
479
- </provider>
480
- </entry>
481
543
  <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb">
482
544
  <provider selected="true" editor-type-id="text-editor">
483
545
  <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="126">
@@ -638,7 +700,7 @@
638
700
  </state>
639
701
  </provider>
640
702
  </entry>
641
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/reply_message.rb">
703
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb">
642
704
  <provider selected="true" editor-type-id="text-editor">
643
705
  <state vertical-scroll-proportion="0.0" vertical-offset="791" max-vertical-offset="1656">
644
706
  <caret line="70" column="27" selection-start-line="70" selection-start-column="27" selection-end-line="70" selection-end-column="27" />
@@ -673,7 +735,7 @@
673
735
  </state>
674
736
  </provider>
675
737
  </entry>
676
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/reply_message.rb">
738
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb">
677
739
  <provider selected="true" editor-type-id="text-editor">
678
740
  <state vertical-scroll-proportion="0.0" vertical-offset="504" max-vertical-offset="1656">
679
741
  <caret line="28" column="24" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" />
@@ -725,95 +787,145 @@
725
787
  </state>
726
788
  </provider>
727
789
  </entry>
728
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/reply_message.rb">
790
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/article_news.rb">
729
791
  <provider selected="true" editor-type-id="text-editor">
730
- <state vertical-scroll-proportion="0.5955056" vertical-offset="677" max-vertical-offset="1656">
731
- <caret line="70" column="27" selection-start-line="70" selection-start-column="27" selection-end-line="70" selection-end-column="27" />
792
+ <state vertical-scroll-proportion="0.11031665" vertical-offset="0" max-vertical-offset="979">
793
+ <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
732
794
  </state>
733
795
  </provider>
734
796
  </entry>
735
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/article_news.rb">
797
+ <entry file="file://$PROJECT_DIR$/Gemfile">
736
798
  <provider selected="true" editor-type-id="text-editor">
737
- <state vertical-scroll-proportion="0.11031665" vertical-offset="0" max-vertical-offset="979">
738
- <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
799
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="180">
800
+ <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
801
+ <folding />
739
802
  </state>
740
803
  </provider>
741
804
  </entry>
742
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb">
805
+ <entry file="file://$PROJECT_DIR$/eric_weixin.gemspec">
743
806
  <provider selected="true" editor-type-id="text-editor">
744
- <state vertical-scroll-proportion="0.0" vertical-offset="172" max-vertical-offset="918">
745
- <caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
807
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="684">
808
+ <caret line="18" column="30" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="30" />
746
809
  <folding />
747
810
  </state>
748
811
  </provider>
749
812
  </entry>
750
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb">
813
+ <entry file="file://$PROJECT_DIR$/Gemfile.lock">
751
814
  <provider selected="true" editor-type-id="text-editor">
752
- <state vertical-scroll-proportion="0.0" vertical-offset="1415" max-vertical-offset="2052">
753
- <caret line="105" column="15" selection-start-line="105" selection-start-column="15" selection-end-line="105" selection-end-column="15" />
815
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="378">
816
+ <caret line="14" column="2" selection-start-line="14" selection-start-column="2" selection-end-line="14" selection-end-column="2" />
817
+ <folding />
754
818
  </state>
755
819
  </provider>
756
820
  </entry>
757
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb">
821
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/public_account.rb">
758
822
  <provider selected="true" editor-type-id="text-editor">
759
- <state vertical-scroll-proportion="0.0" vertical-offset="18" max-vertical-offset="126">
760
- <caret line="1" column="17" selection-start-line="1" selection-start-column="17" selection-end-line="1" selection-end-column="17" />
823
+ <state vertical-scroll-proportion="0.32642487" vertical-offset="0" max-vertical-offset="3438">
824
+ <caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
761
825
  <folding />
762
826
  </state>
763
827
  </provider>
764
828
  </entry>
765
- <entry file="file://$PROJECT_DIR$/Gemfile">
829
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/template_message_log.rb">
766
830
  <provider selected="true" editor-type-id="text-editor">
767
- <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="180">
768
- <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
831
+ <state vertical-scroll-proportion="1.1317716" vertical-offset="271" max-vertical-offset="1314">
832
+ <caret line="58" column="21" selection-start-line="58" selection-start-column="21" selection-end-line="58" selection-end-column="21" />
769
833
  <folding />
770
834
  </state>
771
835
  </provider>
772
836
  </entry>
773
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb">
837
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/message_log.rb">
774
838
  <provider selected="true" editor-type-id="text-editor">
775
- <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="774">
776
- <caret line="31" column="7" selection-start-line="31" selection-start-column="7" selection-end-line="31" selection-end-column="7" />
839
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="630">
840
+ <caret line="18" column="216" selection-start-line="18" selection-start-column="216" selection-end-line="18" selection-end-column="216" />
777
841
  <folding />
778
842
  </state>
779
843
  </provider>
780
844
  </entry>
781
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/public_account.rb">
845
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/reply_message_rule.rb">
782
846
  <provider selected="true" editor-type-id="text-editor">
783
- <state vertical-scroll-proportion="0.0" vertical-offset="21" max-vertical-offset="3438">
784
- <caret line="32" column="11" selection-start-line="32" selection-start-column="11" selection-end-line="32" selection-end-column="11" />
847
+ <state vertical-scroll-proportion="-4.1538463" vertical-offset="1260" max-vertical-offset="2826">
848
+ <caret line="76" column="34" selection-start-line="76" selection-start-column="34" selection-end-line="76" selection-end-column="34" />
849
+ <folding />
850
+ </state>
851
+ </provider>
852
+ </entry>
853
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/access_token.rb">
854
+ <provider selected="true" editor-type-id="text-editor">
855
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1008">
856
+ <caret line="0" column="17" selection-start-line="0" selection-start-column="7" selection-end-line="0" selection-end-column="17" />
857
+ <folding />
858
+ </state>
859
+ </provider>
860
+ </entry>
861
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/version.rb">
862
+ <provider selected="true" editor-type-id="text-editor">
863
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="162">
864
+ <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
785
865
  <folding />
786
866
  </state>
787
867
  </provider>
788
868
  </entry>
789
869
  <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/model/weixin_user.rb">
790
870
  <provider selected="true" editor-type-id="text-editor">
791
- <state vertical-scroll-proportion="0.0" vertical-offset="360" max-vertical-offset="1710">
792
- <caret line="40" column="8" selection-start-line="40" selection-start-column="8" selection-end-line="40" selection-end-column="8" />
871
+ <state vertical-scroll-proportion="0.06703911" vertical-offset="216" max-vertical-offset="1782">
872
+ <caret line="14" column="2" selection-start-line="14" selection-start-column="2" selection-end-line="14" selection-end-column="2" />
793
873
  <folding />
794
874
  </state>
795
875
  </provider>
796
876
  </entry>
797
- <entry file="file://$PROJECT_DIR$/eric_weixin.gemspec">
877
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb">
798
878
  <provider selected="true" editor-type-id="text-editor">
799
- <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="684">
800
- <caret line="28" column="68" selection-start-line="28" selection-start-column="68" selection-end-line="28" selection-end-column="68" />
879
+ <state vertical-scroll-proportion="-1.3333334" vertical-offset="0" max-vertical-offset="144">
880
+ <caret line="2" column="31" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
801
881
  <folding />
802
882
  </state>
803
883
  </provider>
804
884
  </entry>
805
885
  <entry file="file://$PROJECT_DIR$/lib/eric_weixin.rb">
806
886
  <provider selected="true" editor-type-id="text-editor">
807
- <state vertical-scroll-proportion="0.0" vertical-offset="279" max-vertical-offset="972">
808
- <caret line="18" column="2" selection-start-line="18" selection-start-column="2" selection-end-line="18" selection-end-column="2" />
887
+ <state vertical-scroll-proportion="0.37818182" vertical-offset="44" max-vertical-offset="666">
888
+ <caret line="14" column="9" selection-start-line="14" selection-start-column="9" selection-end-line="14" selection-end-column="9" />
809
889
  <folding />
810
890
  </state>
811
891
  </provider>
812
892
  </entry>
813
- <entry file="file://$PROJECT_DIR$/lib/eric_weixin/version.rb">
893
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/two_dimension_code.rb">
814
894
  <provider selected="true" editor-type-id="text-editor">
815
- <state vertical-scroll-proportion="0.02549575" vertical-offset="0" max-vertical-offset="706">
816
- <caret line="1" column="18" selection-start-line="1" selection-start-column="18" selection-end-line="1" selection-end-column="18" />
895
+ <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="432">
896
+ <caret line="8" column="0" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
897
+ <folding />
898
+ </state>
899
+ </provider>
900
+ </entry>
901
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/controllers/weixin/weixin_controller.rb">
902
+ <provider selected="true" editor-type-id="text-editor">
903
+ <state vertical-scroll-proportion="1.9776536" vertical-offset="0" max-vertical-offset="1548">
904
+ <caret line="59" column="17" selection-start-line="59" selection-start-column="17" selection-end-line="59" selection-end-column="17" />
905
+ <folding />
906
+ </state>
907
+ </provider>
908
+ </entry>
909
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/snsapi.rb">
910
+ <provider selected="true" editor-type-id="text-editor">
911
+ <state vertical-scroll-proportion="23.538462" vertical-offset="702" max-vertical-offset="1422">
912
+ <caret line="5" column="11" selection-start-line="5" selection-start-column="11" selection-end-line="5" selection-end-column="11" />
913
+ <folding />
914
+ </state>
915
+ </provider>
916
+ </entry>
917
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/reply_message.rb">
918
+ <provider selected="true" editor-type-id="text-editor">
919
+ <state vertical-scroll-proportion="0.0" vertical-offset="918" max-vertical-offset="1566">
920
+ <caret line="66" column="81" selection-start-line="66" selection-start-column="81" selection-end-line="67" selection-end-column="83" />
921
+ <folding />
922
+ </state>
923
+ </provider>
924
+ </entry>
925
+ <entry file="file://$PROJECT_DIR$/lib/eric_weixin/app/moudles/mult_customer.rb">
926
+ <provider selected="true" editor-type-id="text-editor">
927
+ <state vertical-scroll-proportion="0.6523605" vertical-offset="650" max-vertical-offset="1116">
928
+ <caret line="53" column="7" selection-start-line="53" selection-start-column="7" selection-end-line="53" selection-end-column="7" />
817
929
  <folding />
818
930
  </state>
819
931
  </provider>
data/eric_weixin.gemspec CHANGED
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'actionpack', '~> 4.1', '>= 4.1.4'
28
28
  spec.add_development_dependency 'activesupport', '~> 4.1', '>= 4.1.4'
29
29
  spec.add_development_dependency 'actionview', '~> 4.1', '>= 4.1.4'
30
- spec.add_development_dependency 'eric_tools', '~> 0.0.4'
30
+ spec.add_development_dependency 'eric_tools', '~> 0.0', '>= 0.0.4'
31
31
 
32
32
  end
@@ -23,12 +23,52 @@ module EricWeixin
23
23
  weixin_public_account = EricWeixin::PublicAccount.where(weixin_app_id: params["weixin_app_id"]).first
24
24
  response = RestClient.get "https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{weixin_public_account.weixin_app_id}&secret=#{weixin_public_account.weixin_secret_key}&code=#{params[:code]}&grant_type=authorization_code"
25
25
  result_hash = JSON.parse(response.body)
26
- u = URI(Base64.decode64(params["url"]))
27
- p = URI.decode_www_form u.query||''
28
- p << ["openid", result_hash['openid']]
29
- p << ["state", params["state"]]
30
- p = URI.encode_www_form p
31
- url = [u.to_s.split('?')[0], p].join '?'
26
+ url = URI(Base64.decode64(params["url"]))
27
+ query_array = URI.decode_www_form url.query||''
28
+ query_array << ["openid", result_hash['openid']]
29
+ query_array << ["state", params["state"]]
30
+ query_str = URI.encode_www_form query_array
31
+ url = [url.to_s.split('?')[0], query_str].join '?'
32
+ redirect_to url
33
+ end
34
+
35
+ def snsapi_userinfo
36
+ require "base64"
37
+ weixin_public_account = EricWeixin::PublicAccount.where(weixin_app_id: params["weixin_app_id"]).first
38
+ url = URI(Base64.decode64(params["url"]))
39
+ query_array = URI.decode_www_form url.query||''
40
+ query_array << ["state", params["state"]]
41
+ if params[:code].blank?
42
+ #先处理用户不同意的情况下,直接跳转到业务页面,agree参数为no
43
+ query_array << ["agree", 'no']
44
+ query_str = URI.encode_www_form query_array
45
+ url = [url.to_s.split('?')[0], query_str].join '?'
46
+ redirect_to url
47
+ return
48
+ end
49
+
50
+ pp '111111'
51
+ response = RestClient.get "https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{weixin_public_account.weixin_app_id}&secret=#{weixin_public_account.weixin_secret_key}&code=#{params[:code]}&grant_type=authorization_code"
52
+ result_hash = JSON.parse(response.body)
53
+
54
+ query_array << ["openid", result_hash['openid']]
55
+ query_array << ["access_token", result_hash['access_token']]
56
+ query_array << ["expires_in", result_hash['expires_in']]
57
+ query_array << ['refresh_token', result_hash['refresh_token']]
58
+ query_array << ['scope', result_hash['scope']]
59
+ query_array << ['agree', 'yes']
60
+ pp '3333333'
61
+ response = RestClient.get "https://api.weixin.qq.com/sns/userinfo?access_token=#{result_hash['access_token']}&openid=#{result_hash['openid']}&lang=zh_CN"
62
+ user_info_hash = JSON.parse(response.body)
63
+ query_array << ["nickname", user_info_hash['nickname']]
64
+ query_array << ["sex", EricWeixin::WeixinUser::SEX[user_info_hash['nickname'].to_i]]
65
+ query_array << ["province", user_info_hash['province']]
66
+ query_array << ["city", user_info_hash['city']]
67
+ query_array << ["country", user_info_hash['country']]
68
+ query_array << ["headimgurl", user_info_hash['headimgurl']]
69
+
70
+ query_str = URI.encode_www_form query_array
71
+ url = [url.to_s.split('?')[0], query_str].join '?'
32
72
  redirect_to url
33
73
  end
34
74
 
@@ -1,8 +1,13 @@
1
1
  module EricWeixin
2
2
  class AccessToken < ActiveRecord::Base
3
- require "rest-client"
3
+
4
4
  self.table_name = "weixin_access_tokens"
5
5
 
6
+ def self.get_valid_access_token_by_app_id options
7
+ secret_key = ::EricWeixin::PublicAccount.get_secret options[:app_id]
8
+ ::EricWeixin::AccessToken.get_valid_access_token weixin_secret_key: secret_key
9
+ end
10
+
6
11
 
7
12
  # 获取有效的Token
8
13
  # 参数为: weixin_secret_key
@@ -0,0 +1,29 @@
1
+ class EricWeixin::MessageLog < ActiveRecord::Base
2
+ self.table_name = "weixin_message_logs"
3
+ class << self
4
+
5
+ def create_public_account_receive_message_log options
6
+ options = options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
7
+ options[:account_receive_flg] = 0
8
+ self.create_message_log options
9
+ end
10
+
11
+ def create_public_account_send_message_log options
12
+ options = options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
13
+ options[:account_receive_flg] = 1
14
+ self.create_message_log options
15
+ end
16
+
17
+ def create_message_log options
18
+ EricWeixin::MessageLog.transaction do
19
+ log = EricWeixin::MessageLog.new options.select{|k,v| [:openid, :app_id, :message_type, :message_id, :data, :account_receive_flg, :passive_reply_message, :process_status, :event_name, :create_time, :parent_id].include? k }
20
+ log.save!
21
+ log
22
+ end
23
+ end
24
+
25
+
26
+ end
27
+ end
28
+
29
+
@@ -37,6 +37,15 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
37
37
  def process_rule(receive_message, secret_key)
38
38
  business_type = "#{receive_message[:MsgType]}~#{receive_message[:Event]}"
39
39
 
40
+ pa = EricWeixin::PublicAccount.find_by_weixin_number receive_message[:ToUserName]
41
+ log = ::EricWeixin::MessageLog.create_public_account_receive_message_log openid: receive_message[:FromUserName],
42
+ app_id: pa.weixin_app_id,
43
+ message_type: receive_message[:MsgType],
44
+ message_id: receive_message[:MsgId],
45
+ data: receive_message.to_json,
46
+ process_status: 0, #在这里假设都处理完毕,由业务引起的更新请在工程的Process中进行修改。
47
+ event_name: receive_message[:Event],
48
+ create_time: receive_message[:CreateTime]
40
49
 
41
50
  reply_message = case business_type
42
51
  #订阅
@@ -48,6 +57,8 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
48
57
  else
49
58
  result
50
59
  end
60
+
61
+ #取消订阅
51
62
  when /event~unsubscribe/
52
63
  result = ::Weixin::Process.unsubscribe receive_message
53
64
  if result == true
@@ -56,6 +67,8 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
56
67
  else
57
68
  result
58
69
  end
70
+
71
+ #点击消息
59
72
  when /event~CLICK/
60
73
  result = ::Weixin::Process.click_event receive_message[:EventKey], receive_message
61
74
  if result == true
@@ -63,6 +76,32 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
63
76
  else
64
77
  result
65
78
  end
79
+
80
+ #查看网页事件
81
+ when /event~VIEW/
82
+ result = ::Weixin::Process.view_event receive_message[:EventKey], receive_message
83
+ if result == true
84
+ ''
85
+ else
86
+ result
87
+ end
88
+
89
+ #用户上报地理位置
90
+ when /location/
91
+ result = ::Weixin::Process.location_event receive_message
92
+ if result == true
93
+ ''
94
+ else
95
+ result
96
+ end
97
+
98
+ #模板发送完毕通知消息
99
+ when /event~TEMPLATESENDJOBFINISH/
100
+ ::EricWeixin::TemplateMessageLog.update_template_message_status receive_message[:FromUserName], receive_message[:MsgID], receive_message[:Status]
101
+ ::Weixin::Process.template_send_job_finish receive_message
102
+ ''
103
+
104
+ #文本消息
66
105
  when /text~/
67
106
  result = ::Weixin::Process.text_event receive_message[:Content], receive_message
68
107
  if result == true
@@ -70,6 +109,8 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
70
109
  else
71
110
  result
72
111
  end
112
+
113
+ #暂时识别不了的消息
73
114
  else
74
115
  result = ::Weixin::Process.another_event receive_message
75
116
  if result == true
@@ -80,6 +121,8 @@ class EricWeixin::ReplyMessageRule < ActiveRecord::Base
80
121
  end
81
122
  "message_to_wechat:".to_logger
82
123
  reply_message.to_logger
124
+ log.passive_reply_message = reply_message.to_s
125
+ log.save!
83
126
  reply_message
84
127
  end
85
128
 
@@ -0,0 +1,67 @@
1
+ class EricWeixin::TemplateMessageLog < ActiveRecord::Base
2
+ self.table_name = "weixin_template_message_logs"
3
+ class << self
4
+ # 发送模板消息
5
+ # 参数说明:
6
+ # openid: 收取消息用户的openid, 必填
7
+ # template_id: 模板id, 必填
8
+ # data: 根据模板不同,给出不同的hash参数
9
+ # url: 点击模板要去的链接,可以为空
10
+ # topcolor: 颜色设置, 默认为 #FF0000
11
+ # app_id: 微信appid
12
+ # EricWeixin::TemplateMessageLog.send_template_message openid: "osyUtswoeJ9d7p16RdpC5grOeukQ",
13
+ # template_id: "WdYZPTwhAMc59aKGs5SUCxRw9xqOM-eOkvGJlZpQahk",
14
+ # topcolor: '#00FF00',
15
+ # url: 'www.baidu.com',
16
+ # data: {
17
+ # first: {value: 'xx'},
18
+ # keyword1: {value: '王小明'},
19
+ # keyword2: {value: '001-002-001'},
20
+ # keyword3: {value: '陈小朋'},
21
+ # keyword4: {value: '小明同学今天上课表现很别棒,很认真。手工都自己做的,依恋家长比较严重。'},
22
+ # keyword5: {value: '总体来讲还很不错,心理上缺乏安全感,需要家长多陪同。'},
23
+ # remark: {value: ''}
24
+ # },
25
+ # app_id: "wx4564afc37fac0ebf"
26
+ def send_template_message options
27
+ BusinessException.raise '没有接收对象' if options[:openid].blank?
28
+ BusinessException.raise '模板未指定' if options[:template_id].blank?
29
+ BusinessException.raise '数据未指定' if options[:data].blank?
30
+ options[:topcolor] = '#FF0000' if options[:topcolor].blank?
31
+ message_json = {
32
+ :touser => options[:openid],
33
+ :template_id => options[:template_id],
34
+ :url => options[:url],
35
+ :topcolor => options[:topcolor],
36
+ :data => options[:data]
37
+ }.to_json
38
+ token = EricWeixin::AccessToken.get_valid_access_token(:weixin_secret_key => EricWeixin::PublicAccount.get_secret(options[:app_id]))
39
+ response = RestClient.post "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=#{token}", message_json
40
+ response = JSON.parse response.body
41
+ log = EricWeixin::TemplateMessageLog.new openid: options[:openid],
42
+ url: options[:url],
43
+ template_id: options[:template_id],
44
+ topcolor: options[:topcolor],
45
+ data: options[:data].to_json,
46
+ message_id: response["msgid"],
47
+ error_code: response["errcode"],
48
+ app_id: options[:app_id]
49
+ log.save!
50
+ end
51
+
52
+
53
+ def update_template_message_status openid, message_id, status
54
+
55
+ log= EricWeixin::TemplateMessageLog.where openid: openid,
56
+ message_id: message_id
57
+ pp log
58
+ return if log.blank?
59
+ log = log.first
60
+ log.status=status
61
+ log.save!
62
+ log
63
+ end
64
+ end
65
+ end
66
+
67
+
@@ -1,13 +1,17 @@
1
1
  class EricWeixin::WeixinUser < ActiveRecord::Base
2
+ SEX = {1=>'男' , 2=>'女', 0=>'未知'}
2
3
  belongs_to :member_info
3
4
  belongs_to :weixin_public_account, :class_name => '::EricWeixin::PublicAccount', :foreign_key => 'weixin_public_account_id'
4
5
  validates_uniqueness_of :openid, scope: :weixin_secret_key
5
6
  validates_presence_of :openid, :weixin_secret_key, :weixin_public_account
6
7
 
8
+
7
9
  def nickname
8
10
  CGI::unescape(self.attributes["nickname"])
9
11
  end
10
12
 
13
+ ##
14
+ # 关注状态,关注返回true, 否则返回false.
11
15
  def follow_status
12
16
  self.subscribe.to_i == 1
13
17
  end
@@ -18,7 +22,7 @@ class EricWeixin::WeixinUser < ActiveRecord::Base
18
22
  # ===业务说明:创建、更新微信用户
19
23
  # * 微信用户在关注、取消关注时更新用户信息。
20
24
  # * 当用户关注微信时,创建用户。
21
- # * 当用户取消关注时,把用户标记为取消关注,同时更新用户的最新信息(包含用户名等)
25
+ # * 当用户取消关注时,把用户标记为取消关注
22
26
  # ===参数说明
23
27
  # * secret_key::公众账号的secret_key,其值取决于公众账号的设置。
24
28
  # * openid::用户的openid,微信服务器传送过来。
@@ -0,0 +1,57 @@
1
+ #多客服模块
2
+ module EricWeixin::MultCustomer
3
+ ##
4
+ # 根据from_user, to_user等信息来获取<em>多客服</em>的数据日志。TODO 待完善
5
+ # ===参数说明
6
+ # ===调用说明
7
+ def self.get_customer_service_messages options
8
+
9
+ end
10
+
11
+
12
+ # 发送多客服信息
13
+ # ====参数说明
14
+ # app_id: 微信公众账号app_id
15
+ # openid: 接收消息用户的openid
16
+ # message_type: 消息类型:包含以下:text image voice video music news#
17
+ # data: 值为一个hash, 对应着公众账号里要发送的内容,它的key为msgtype
18
+ # message_id: 如果是回复消息,则把message_id传过来,用于日志记录。此参数可选。
19
+ # weixin_number: 微信账号,与app_id二选一必填
20
+ # ====调用方法
21
+ # EricWeixin::MultCustomer.send_customer_service_message app_id: 'wx4564afc37fac0ebf',
22
+ # openid: 'osyUtswoeJ9d7p16RdpC5grOeukQ',
23
+ # message_type: 'text',
24
+ # data: {:content => 'hi, 客服消息来了'},
25
+
26
+ # #
27
+ def self.send_customer_service_message options
28
+ if options[:app_id].blank?
29
+ pa = ::EricWeixin::PublicAccount.find_by_weixin_number options[:weixin_number]
30
+ options[:app_id] = pa.weixin_app_id
31
+ end
32
+ token = ::EricWeixin::AccessToken.get_valid_access_token_by_app_id app_id: options[:app_id]
33
+ post_data = {
34
+ :touser => options[:openid],
35
+ :msgtype => options[:message_type],
36
+ options[:message_type] => options[:data]
37
+ }
38
+ url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=#{token}"
39
+ response = RestClient.post url, post_data.to_json
40
+ response = JSON.parse response.body
41
+ ::EricWeixin::MessageLog.transaction do
42
+ message = ::EricWeixin::MessageLog.where(message_id: options[:message_id])
43
+ message_id = if message.blank? then
44
+ nil
45
+ else
46
+ message.first.id
47
+ end
48
+ ::EricWeixin::MessageLog.create_public_account_send_message_log openid: options[:openid],
49
+ app_id: options[:app_id],
50
+ message_type: options[:message_type],
51
+ data: options[:data].to_json,
52
+ process_status: 0,
53
+ parent_id: message_id
54
+ end
55
+ ''
56
+ end
57
+ end
@@ -1,23 +1,16 @@
1
1
  module EricWeixin
2
+ #用于给普通用户回复消息。
2
3
  module ReplyMessage
3
- ##
4
- #根据from_user, to_user等信息来获取<em>多客服</em>的数据格式
5
- #===参数说明
6
- # #
7
- def self.get_customer_service_message options
8
-
9
- end
10
-
11
- # 获取<b>被动回复</b>消息的数据格式--类型为:<b>图文消息</b>
4
+ # 获取<b>被动回复</b>消息的数据格式。类型为:<b>图文消息</b>。
12
5
  # 一般用于用户发消息后,使用返回消息的方式向用户进行图文回复。
13
6
  # ===参数说明
14
7
  # * ToUserName: 收取方的账号
15
8
  # * FromUserName: 开发者账号
16
9
  # * news: 文章列表,EricWeixin::Article 的实例数组
17
10
  # ===示例
18
- # Tools::EricWeixin::ReplyMessage::get_reply_user_message_image_text ToUserName: 'xx',
19
- # FromUserName: 'yy',
20
- # news:[EricWeixin::ArticleData.new]
11
+ # Tools::EricWeixin::ReplyMessage::get_reply_user_message_image_text ToUserName: 'xx',
12
+ # FromUserName: 'yy',
13
+ # news:[EricWeixin::ArticleData.new]
21
14
  def self.get_reply_user_message_image_text options
22
15
  xml = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
23
16
  xml.send(:xml) {
@@ -29,10 +22,10 @@ module EricWeixin
29
22
  xml.Articles {
30
23
  options[:news].each do |news|
31
24
  xml.item {
32
- xml.Title{xml.cdata news.title}
33
- xml.Description{xml.cdata news.desc}
34
- xml.PicUrl{xml.cdata news.pic_url}
35
- xml.Url{xml.cdata news.link_url}
25
+ xml.Title { xml.cdata news.title }
26
+ xml.Description { xml.cdata news.desc }
27
+ xml.PicUrl { xml.cdata news.pic_url }
28
+ xml.Url { xml.cdata news.link_url }
36
29
  }
37
30
  end
38
31
  }
@@ -42,16 +35,17 @@ module EricWeixin
42
35
  end
43
36
 
44
37
 
45
- # 获取<b>被动回复</b>消息的数据格式--类型为:<b>文本消息</b>
38
+ # 获取<b>被动回复</b>消息的数据格式。类型为:<b>文本消息</b>
46
39
  # 一般用于用户发消息后,使用返回消息的方式向用户进行图文回复。
47
40
  # ===参数说明
48
41
  # * ToUserName: 收取方的账号
49
42
  # * FromUserName: 开发者账号
50
43
  # * Content: 回复的消息内容
51
44
  # ===示例
52
- # Tools::EricWeixin::ReplyMessage.get_reply_user_message_text ToUserName: 'xx',
53
- # FromUserName: 'yy',
54
- # Content: 'haha'
45
+ # Tools::EricWeixin::ReplyMessage.get_reply_user_message_text ToUserName: 'xx',
46
+ # FromUserName: 'yy',
47
+ # Content: 'haha'
48
+
55
49
  def self.get_reply_user_message_text options
56
50
  xml = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
57
51
  xml.send(:xml) {
@@ -65,13 +59,14 @@ module EricWeixin
65
59
  xml.to_xml
66
60
  end
67
61
 
68
- # 用于将消息转发至多客户客户端。
62
+ # 用于将消息转发至多客服客户端。
69
63
  # ===参数说明
70
64
  # * ToUserName: 收取方的账号
71
65
  # * FromUserName: 开发者账号
72
66
  # ===示例
73
- # EricWeixin::ReplyMessage::transfer_mult_customer_service ToUserName: 'xxx',
74
- # FromUserName: 'yyyy',
67
+ # EricWeixin::ReplyMessage::transfer_mult_customer_service ToUserName: 'xxx',
68
+ # FromUserName: 'yyyy'
69
+
75
70
  def self.transfer_mult_customer_service options
76
71
  xml = Nokogiri::XML::Builder.new(:encoding => 'utf-8') do |xml|
77
72
  xml.send(:xml) {
@@ -0,0 +1,73 @@
1
+ module EricWeixin::Snsapi
2
+
3
+ # 获取snsapi_base授权的完整链接.
4
+ # 每次更新菜单调整链接都需要花时间把链接整理好,再URLEncode之类的,很烦有木不?
5
+ # 来这里吧,输入几个无脑参数,分分钟获取到全链接,方便、快速、搞得定。
6
+ # 善意提醒:别说这里有个坑,这个函数生成的链接,是需要配合本Gem的Controller、action来使用的。
7
+ # ===参数说明
8
+ # * url #业务URL,即最终需要跳转到的url,域名中的主机名称可选,可以写 'www.baidu.com/xxx', 也可以写 '/xxx'。 这个地址用于最后重定向。
9
+ # * app_id #公众账号app_id
10
+ # * schema_host 当前项目的域名(包含http://):如http://www.baidu.com
11
+ # * state 这个参数可以直接带到业务页面。
12
+ # ===调用示例
13
+ # EricWeixin::Snsapi.get_snsapi_uri url:'/weixin/service1/ddd?a=1', app_id: 'wx4564afc37fac0ebf', schema_host: "http://lxq.mdcc.com"
14
+ def self.get_snsapi_base_url options
15
+ require 'base64'
16
+ p_zhongzhuan = []
17
+ p_zhongzhuan_host_path = "#{options[:schema_host]}/weixin/snsapi"
18
+ p_zhongzhuan << ["weixin_app_id", options[:app_id]]
19
+ p_zhongzhuan << ["url", Base64.encode64(options[:url])]
20
+ p_zhongzhuan = URI.encode_www_form p_zhongzhuan
21
+ p_zhongzhuan = CGI::unescape p_zhongzhuan
22
+ p_zhongzhuan_url = [p_zhongzhuan_host_path, p_zhongzhuan].join('?')
23
+
24
+ p_host_and_path = 'https://open.weixin.qq.com/connect/oauth2/authorize'
25
+ p = []
26
+ p << ['appid', options[:app_id]]
27
+ p << ['redirect_uri', CGI::escape(p_zhongzhuan_url)]
28
+ p << ['response_type', 'code']
29
+ p << ['scope', 'snsapi_base']
30
+ p << ['state', "#{options[:state]||'abc'}"]
31
+ p = URI.encode_www_form p
32
+ p = CGI::unescape p
33
+ p_url = [p_host_and_path, "#{p}#wechat_redirect"].join '?'
34
+ p_url
35
+ end
36
+
37
+
38
+
39
+ # 获取snsapi_userinfo授权的完整链接.
40
+ # 每次更新菜单调整链接都需要花时间把链接整理好,再URLEncode之类的,很烦有木不?
41
+ # 来这里吧,输入几个无脑参数,分分钟获取到全链接,方便、快速、搞得定。
42
+ # 善意提醒:别说这里有个坑,这个函数生成的链接,是需要配合本Gem的Controller、action来使用的。
43
+ # ===参数说明
44
+ # * url #业务URL,即最终需要跳转到的url,域名中的主机名称可选,可以写 'www.baidu.com/xxx', 也可以写 '/xxx'。 这个地址用于最后重定向。
45
+ # * app_id #公众账号app_id
46
+ # * schema_host 当前项目的域名(包含http://):如http://www.baidu.com
47
+ # * state 这个参数可以直接带到业务页面。
48
+ # ===调用示例
49
+ # EricWeixin::Snsapi.get_snsapi_userinfo_url url:'/weixin/service1/ddd?a=1', app_id: 'wx4564afc37fac0ebf', schema_host: "http://lxq.mdcc.club"
50
+ def self.get_snsapi_userinfo_url options
51
+ require 'base64'
52
+ p_zhongzhuan = []
53
+ p_zhongzhuan_host_path = "#{options[:schema_host]}/weixin/snsuserinfo"
54
+ p_zhongzhuan << ["weixin_app_id", options[:app_id]]
55
+ p_zhongzhuan << ["url", Base64.encode64(options[:url])]
56
+ p_zhongzhuan = URI.encode_www_form p_zhongzhuan
57
+ p_zhongzhuan = CGI::unescape p_zhongzhuan
58
+ p_zhongzhuan_url = [p_zhongzhuan_host_path, p_zhongzhuan].join('?')
59
+
60
+ p_host_and_path = 'https://open.weixin.qq.com/connect/oauth2/authorize'
61
+ p = []
62
+ p << ['appid', options[:app_id]]
63
+ p << ["redirect_uri", CGI::escape(p_zhongzhuan_url)]
64
+ p << ['response_type', 'code']
65
+ p << ['scope', 'snsapi_userinfo']
66
+ p << ['state', "#{options[:state]||'state'}"]
67
+ p = URI.encode_www_form p
68
+ p = CGI::unescape p
69
+ p_url = [p_host_and_path, "#{p}#wechat_redirect"].join '?'
70
+ p_url
71
+ end
72
+
73
+ end
@@ -0,0 +1,18 @@
1
+ # 二维码
2
+ module EricWeixin::TwoDimensionCode
3
+ # 长URL转短URL
4
+ # ===参数说明:
5
+ # * app_id 微信公众账号的app_id
6
+ # * url 需要转短url的链接
7
+ # ===调用示例:
8
+ # EricWeixin::TwoDimensionCode.short_url app_id: 'wx4564afc37fac0ebf', url: 'http://mp.weixin.qq.com/wiki/10/165c9b15eddcfbd8699ac12b0bd89ae6.html'
9
+ def self.short_url options
10
+ access_token = EricWeixin::AccessToken.get_valid_access_token_by_app_id app_id: options[:app_id]
11
+ url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=#{access_token}"
12
+ pp url
13
+ response = RestClient.post url, {action: "long2short", long_url: options[:url]}
14
+ response = JSON.parse(response.body)
15
+ pp response
16
+ response["short_url"]
17
+ end
18
+ end
@@ -1,2 +1,3 @@
1
1
  <%=@ee%><br/>
2
- <%=params[:openid]%>
2
+ <%=params[:openid]%>
3
+ <img src="<%=params[:headimgurl]%>"/>
@@ -1,3 +1,3 @@
1
1
  module EricWeixin
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/eric_weixin.rb CHANGED
@@ -1,13 +1,24 @@
1
1
  require "eric_weixin/version"
2
+ require "rest-client"
2
3
 
4
+ #加载model
3
5
  require File.dirname(__FILE__) + '/eric_weixin/app/model/access_token.rb'
4
6
  require File.dirname(__FILE__) + '/eric_weixin/app/model/article.rb'
5
7
  require File.dirname(__FILE__) + '/eric_weixin/app/model/article_news.rb'
6
8
  require File.dirname(__FILE__) + '/eric_weixin/app/model/news.rb'
7
9
  require File.dirname(__FILE__) + '/eric_weixin/app/model/public_account.rb'
8
10
  require File.dirname(__FILE__) + '/eric_weixin/app/model/reply_message_rule.rb'
11
+ require File.dirname(__FILE__) + '/eric_weixin/app/model/template_message_log.rb'
9
12
  require File.dirname(__FILE__) + '/eric_weixin/app/model/weixin_user.rb'
10
- require File.dirname(__FILE__) + '/eric_weixin/reply_message.rb'
13
+ require File.dirname(__FILE__) + '/eric_weixin/app/model/message_log.rb'
14
+
15
+ #加载moudle
16
+ require File.dirname(__FILE__) + '/eric_weixin/app/moudles/reply_message.rb'
17
+ require File.dirname(__FILE__) + '/eric_weixin/app/moudles/mult_customer.rb'
18
+ require File.dirname(__FILE__) + '/eric_weixin/app/moudles/snsapi.rb'
19
+ require File.dirname(__FILE__) + '/eric_weixin/app/moudles/two_dimension_code.rb'
20
+
21
+ #加载controller
11
22
  require File.dirname(__FILE__) + '/eric_weixin/app/controllers/weixin/weixin_controller'
12
23
 
13
24
 
@@ -15,34 +26,6 @@ module EricWeixin
15
26
  # 把gem目录放作为视图目录
16
27
  ActionController::Base.append_view_path(File.dirname(__FILE__) + '/eric_weixin/app/views')
17
28
 
18
- #获取重定向的URI
19
- #参数1: url #业务URL,即最终需要跳转到的url,域名中的主机名称可选,可以写 'www.baidu.com/xxx', 也可以写 '/xxx'。 这里主要用于重定向。
20
- #参数2: app_id #公众账号app_id
21
- #参数3: schema_host 当前项目的域名(包含http://):如http://www.baidu.com
22
- #可选参数4: state
23
- #示例:get_snsapi_uri url:'/weixin/service1/ddd?a=1', app_id: 'wx4564afc37fac0ebf', schema_host: "http://lxq.mdcc.com"
24
- def get_snsapi_url options
25
- require 'base64'
26
- p_zhongzhuan = []
27
- p_zhongzhuan_host_path = "#{options[:schema_host]}/weixin/snsapi"
28
- p_zhongzhuan << ["weixin_app_id", options[:app_id]]
29
- p_zhongzhuan << ["url", Base64.encode64(options[:url])]
30
- p_zhongzhuan = URI.encode_www_form p_zhongzhuan
31
- p_zhongzhuan = CGI::unescape p_zhongzhuan
32
- p_zhongzhuan_url = [p_zhongzhuan_host_path, p_zhongzhuan].join('?')
33
-
34
- p_host_and_path = 'https://open.weixin.qq.com/connect/oauth2/authorize'
35
- p = []
36
- p << ['appid', options[:app_id]]
37
- p << ["redirect_uri", CGI::escape(p_zhongzhuan_url)]
38
- p << ['response_type', 'code']
39
- p << ['scope', 'snsapi_base']
40
- p << ['state', "#{options[:state]||'abc'}"]
41
- p = URI.encode_www_form p
42
- p = CGI::unescape p
43
- p_url = [p_host_and_path, "#{p}#wechat_redirect"].join '?'
44
- p_url
45
- end
46
29
 
47
30
 
48
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eric_weixin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 刘晓琦
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -171,6 +171,9 @@ dependencies:
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
173
  - - ~>
174
+ - !ruby/object:Gem::Version
175
+ version: '0.0'
176
+ - - '>='
174
177
  - !ruby/object:Gem::Version
175
178
  version: 0.0.4
176
179
  type: :development
@@ -178,6 +181,9 @@ dependencies:
178
181
  version_requirements: !ruby/object:Gem::Requirement
179
182
  requirements:
180
183
  - - ~>
184
+ - !ruby/object:Gem::Version
185
+ version: '0.0'
186
+ - - '>='
181
187
  - !ruby/object:Gem::Version
182
188
  version: 0.0.4
183
189
  description: 微信插件
@@ -208,12 +214,17 @@ files:
208
214
  - lib/eric_weixin/app/model/access_token.rb
209
215
  - lib/eric_weixin/app/model/article.rb
210
216
  - lib/eric_weixin/app/model/article_news.rb
217
+ - lib/eric_weixin/app/model/message_log.rb
211
218
  - lib/eric_weixin/app/model/news.rb
212
219
  - lib/eric_weixin/app/model/public_account.rb
213
220
  - lib/eric_weixin/app/model/reply_message_rule.rb
221
+ - lib/eric_weixin/app/model/template_message_log.rb
214
222
  - lib/eric_weixin/app/model/weixin_user.rb
223
+ - lib/eric_weixin/app/moudles/mult_customer.rb
224
+ - lib/eric_weixin/app/moudles/reply_message.rb
225
+ - lib/eric_weixin/app/moudles/snsapi.rb
226
+ - lib/eric_weixin/app/moudles/two_dimension_code.rb
215
227
  - lib/eric_weixin/app/views/eric_weixin/weixin/aa.erb
216
- - lib/eric_weixin/reply_message.rb
217
228
  - lib/eric_weixin/version.rb
218
229
  homepage: ''
219
230
  licenses: