blsm-mp-wx 0.2.6 → 0.2.7
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 +1 -0
- data/Gemfile.lock +3 -1
- data/blsm-mp-wx.gemspec +1 -0
- data/lib/blsm-mp-wx/version.rb +1 -1
- data/lib/blsm-mp-wx.rb +40 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7485f83a5b5038818e2ab3845c6ec95db95c7140
|
4
|
+
data.tar.gz: 150942cc1c2b3dc0f94153641dd95c272326e1fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3745c7abee89ff7ec202bc9f9c0c5150eefb93c130b89656421dd74f6946fd3ddff54299652caf9cef0dd9e98867a6bc83216eb3931490081941a4bf9d7edb0d
|
7
|
+
data.tar.gz: 9dc5bd93b24c812f5eb8ea9d86d75e811f3527e0482f165721ebbd9f790a99e698e6f44caa8806096aa623a2c58ba2d2ff164b1643627de63948e99aea60ea4c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blsm-mp-wx (0.2.
|
4
|
+
blsm-mp-wx (0.2.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://ruby.taobao.org/
|
@@ -35,6 +35,7 @@ GEM
|
|
35
35
|
multi_json (~> 1.0)
|
36
36
|
arel (3.0.3)
|
37
37
|
builder (3.0.4)
|
38
|
+
certified (1.0.0)
|
38
39
|
diff-lcs (1.2.5)
|
39
40
|
erubis (2.7.0)
|
40
41
|
faraday (0.9.1)
|
@@ -110,6 +111,7 @@ DEPENDENCIES
|
|
110
111
|
activesupport (~> 3.2)
|
111
112
|
blsm-mp-wx!
|
112
113
|
bundler (~> 1.9)
|
114
|
+
certified
|
113
115
|
faraday (~> 0.9)
|
114
116
|
mysql2 (~> 0.3.16)
|
115
117
|
rails (~> 3.2)
|
data/blsm-mp-wx.gemspec
CHANGED
data/lib/blsm-mp-wx/version.rb
CHANGED
data/lib/blsm-mp-wx.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require 'cgi'
|
3
3
|
require 'rails'
|
4
|
+
require 'openssl'
|
5
|
+
require 'open-uri'
|
6
|
+
require 'net/https'
|
4
7
|
require 'active_model'
|
5
8
|
require 'active_record'
|
6
9
|
require 'active_support'
|
@@ -314,6 +317,43 @@ module BlsmMpWx
|
|
314
317
|
json_obj.inject({}) { |memo, (key, v)| memo[key.to_s.to_sym]=v; memo }
|
315
318
|
end
|
316
319
|
|
320
|
+
|
321
|
+
def all_openid(app_id=nil, next_openid='', returned_openids = [])
|
322
|
+
app_id ||= self.APP_ID
|
323
|
+
p "getting openid... next_openid:#{next_openid}"
|
324
|
+
|
325
|
+
begin
|
326
|
+
conn = Faraday.new(:url => 'https://api.weixin.qq.com')
|
327
|
+
response = conn.get do |req|
|
328
|
+
req.url '/cgi-bin/user/get'
|
329
|
+
req.headers['Content-Type'] = 'application/json'
|
330
|
+
req.params[:access_token] = access_token(app_id)
|
331
|
+
req.params[:next_openid] = next_openid
|
332
|
+
end
|
333
|
+
response_body = response.body
|
334
|
+
p response_body
|
335
|
+
jobject = JSON.parse(response_body)
|
336
|
+
|
337
|
+
if jobject
|
338
|
+
if jobject['data'] && jobject['data']['openid']
|
339
|
+
p "total:#{jobject['total']},count:#{jobject['count']}"
|
340
|
+
returned_openids += jobject['data']['openid']
|
341
|
+
end
|
342
|
+
|
343
|
+
if jobject['next_openid'].to_s != ''
|
344
|
+
return all_openid(jobject['next_openid'], returned_openids)
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
if !jobject || jobject['next_openid'].to_s ==''
|
349
|
+
return returned_openids
|
350
|
+
end
|
351
|
+
rescue Exception => e
|
352
|
+
puts e
|
353
|
+
end
|
354
|
+
returned_openids
|
355
|
+
end
|
356
|
+
|
317
357
|
private
|
318
358
|
#解析json类型的数据,并将最后的数据转为hash或array
|
319
359
|
# +json_data_str+ 要转换的json数据
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blsm-mp-wx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.9'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: certified
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description: "包括access_token、js_api_ticket的获取,发送消息,模板消息,生成二维码,获取用户信息等。"
|
140
154
|
email:
|
141
155
|
- 15201280641@qq.com
|