wx_ext 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/wx_ext/version.rb +1 -1
- data/lib/wx_ext.rb +16 -7
- data/spec/test.png +0 -0
- data/spec/wx_ext/weixin_spec.rb +15 -9
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11f6350756900eb4f1151d46a2ed8db198b630e1
|
4
|
+
data.tar.gz: 1805b3f7dc380df8509b83665a8b6c9559b26c12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de1796e01dfe58fe60a5999258e56e1b72acc5b9d94bba72d27bfee5e1e1041b7d608ed9116b1cdba93f5c2a956c15b40f0be316f985c6d61f0e45fdd74e97f6
|
7
|
+
data.tar.gz: 5adad9873d3c6d8b98bd600bb40d930cdc2e311408e58b1af5dfda06561e3be10c334d1a19f0244b55ac9f31f12ce867f54c2240be83f186b9cd9ceafa552dc5
|
data/README.md
CHANGED
data/lib/wx_ext/version.rb
CHANGED
data/lib/wx_ext.rb
CHANGED
@@ -242,13 +242,14 @@ module WxExt
|
|
242
242
|
day_msg_count.to_i
|
243
243
|
end
|
244
244
|
|
245
|
-
# 获取 last_msg_id 和
|
246
|
-
def
|
247
|
-
url = 'https://mp.weixin.qq.com/cgi-bin/message?t=message/list
|
248
|
-
"&
|
245
|
+
# 获取 total_count, count, day, frommsgid, can_search_msg, offset, action=search, keyword, last_msg_id, filterivrmsg=0/1 和 msg_items
|
246
|
+
def get_msg_items(count = 20, day = 7, filterivrmsg = 1, action='', keyword='', frommsgid='', offset='')
|
247
|
+
url = 'https://mp.weixin.qq.com/cgi-bin/message?t=message/list'\
|
248
|
+
"&action=#{action}&keyword=#{keyword}&frommsgid=#{frommsgid}&offset=#{offset}&count=#{count}"\
|
249
|
+
"&day=#{day}filterivrmsg=#{filterivrmsg}&token=#{@token}&lang=zh_CN"
|
249
250
|
resource = RestClient::Resource.new(url, cookies: @cookies)
|
250
251
|
res = resource.get
|
251
|
-
reg = /.*total_count\s*:\s*(\d*).*latest_msg_id\s*:\s*\'(\d*)\'.*list\s*:\s*\((.*)\)\.msg_item
|
252
|
+
reg = /.*total_count\s*:\s*(\d*).*latest_msg_id\s*:\s*\'(\d*)\'.*list\s*:\s*\((.*)\)\.msg_item,.*filterivrmsg\s*:\s*\"(\d*)\".*/m
|
252
253
|
return_hash = {
|
253
254
|
status: -1,
|
254
255
|
msg: 'system_error'
|
@@ -259,12 +260,21 @@ module WxExt
|
|
259
260
|
msg: 'ok',
|
260
261
|
total_count: $1,
|
261
262
|
latest_msg_id: $2,
|
262
|
-
|
263
|
+
count: 20,
|
264
|
+
day: 7,
|
265
|
+
frommsgid: '',
|
266
|
+
can_search_msg: '1',
|
267
|
+
offset: '',
|
268
|
+
action: '',
|
269
|
+
keyword: '',
|
270
|
+
msg_items: JSON.parse($3)['msg_item'],
|
271
|
+
filterivrmsg: $4
|
263
272
|
}
|
264
273
|
end
|
265
274
|
return_hash
|
266
275
|
end
|
267
276
|
|
277
|
+
# 获取粉丝数目
|
268
278
|
def get_fans_count
|
269
279
|
url = 'https://mp.weixin.qq.com/cgi-bin/contactmanage?t=user/index'\
|
270
280
|
"&pagesize=10&pageidx=0&type=0&token=#{ @token }&lang=zh_CN"
|
@@ -289,7 +299,6 @@ module WxExt
|
|
289
299
|
return_hash
|
290
300
|
end
|
291
301
|
|
292
|
-
# https://mp.weixin.qq.com/cgi-bin/singlesend?t=ajax-response&f=json&token=593714377&lang=zh_CN
|
293
302
|
# {"base_resp":{"ret":10706,"err_msg":"customer block"}} 48小时内的才行
|
294
303
|
# {"base_resp":{"ret":0,"err_msg":"ok"}}
|
295
304
|
# 快速回复
|
data/spec/test.png
ADDED
Binary file
|
data/spec/wx_ext/weixin_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe WxExt::WeiXin do
|
|
5
5
|
before(:all) do
|
6
6
|
@weixin = WxExt::WeiXin.new 'flowerwrong@hotmail.com', '1*flower@wrong*1'
|
7
7
|
end
|
8
|
-
|
8
|
+
=begin
|
9
9
|
it 'should login to the mp' do
|
10
10
|
res_hash = @weixin.login
|
11
11
|
expect(res_hash[:status]).to eql(0)
|
@@ -64,6 +64,7 @@ describe WxExt::WeiXin do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
|
67
68
|
it 'should star msg' do
|
68
69
|
res_hash = @weixin.login
|
69
70
|
flag = @weixin.init
|
@@ -85,7 +86,7 @@ describe WxExt::WeiXin do
|
|
85
86
|
expect(star_res_hash['ret'].to_s).to eql('0')
|
86
87
|
end
|
87
88
|
end
|
88
|
-
|
89
|
+
=end
|
89
90
|
|
90
91
|
it 'should get fans count' do
|
91
92
|
res_hash = @weixin.login
|
@@ -98,15 +99,20 @@ describe WxExt::WeiXin do
|
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
101
|
-
it 'should get
|
102
|
+
it 'should get total_count, count, day, frommsgid, can_search_msg, offset, action=search, keyword, last_msg_id, filterivrmsg=0/1 和 msg_items' do
|
103
|
+
|
102
104
|
res_hash = @weixin.login
|
103
105
|
flag = @weixin.init
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
106
|
+
if flag
|
107
|
+
res_hash = @weixin.get_msg_items(20, 7, 1, '', '', '', '')
|
108
|
+
puts '==' * 20
|
109
|
+
puts res_hash
|
110
|
+
expect(res_hash[:status]).to eql(0)
|
111
|
+
else
|
112
|
+
puts 'init failed'
|
113
|
+
end
|
108
114
|
end
|
109
|
-
|
115
|
+
=begin
|
110
116
|
it "should get new msg num" do
|
111
117
|
res_hash = @weixin.login
|
112
118
|
flag = @weixin.init
|
@@ -262,5 +268,5 @@ describe WxExt::WeiXin do
|
|
262
268
|
puts msg_hash["app_msg_info"]["item"][0]["app_id"]
|
263
269
|
expect(msg_hash["base_resp"]["ret"].to_s).to eql("0")
|
264
270
|
end
|
265
|
-
|
271
|
+
=end
|
266
272
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wx_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- flowerwrong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/wx_ext.rb
|
96
96
|
- lib/wx_ext/version.rb
|
97
97
|
- spec/spec_helper.rb
|
98
|
+
- spec/test.png
|
98
99
|
- spec/wx_ext/weixin_spec.rb
|
99
100
|
- wx_ext.gemspec
|
100
101
|
homepage: http://thecampus.cc
|
@@ -123,4 +124,5 @@ specification_version: 4
|
|
123
124
|
summary: a gem to hack mp.weixin.qq.com
|
124
125
|
test_files:
|
125
126
|
- spec/spec_helper.rb
|
127
|
+
- spec/test.png
|
126
128
|
- spec/wx_ext/weixin_spec.rb
|