blsm-mp-wx 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/blsm-mp-wx/version.rb +1 -1
- data/lib/blsm-mp-wx.rb +18 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1e280500c9517d27b7a84c8795028f0c622e76
|
4
|
+
data.tar.gz: 97567fef806c56123168565da3ff045ccdc8f50b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1fbe6f0b605f0372c0e6e9010f6dbaa45db5f85d2d53c0b51e3302a24e7688d1ec65d82c7639ef3b3fb8b1f8d357669dbd1ba502e030f097b03c9f4d216661
|
7
|
+
data.tar.gz: e372200ca0b8f0b20cb9cdc13cddbc368f0222427b17fef11998d7f7a212066270772e68ef303c878cca720b1c2b36ad08b52d8d798a22a85e1f47429170d8fc
|
data/Gemfile.lock
CHANGED
data/lib/blsm-mp-wx/version.rb
CHANGED
data/lib/blsm-mp-wx.rb
CHANGED
@@ -15,10 +15,13 @@ module BlsmMpWx
|
|
15
15
|
ERROR_CODES = {
|
16
16
|
404 => {code: 404, msg: '未知的公众号,如有疑问,请联系xi.liu@abcomb.com'}
|
17
17
|
}
|
18
|
+
|
18
19
|
class << self
|
19
20
|
attr_accessor :APP_ID
|
20
21
|
attr_accessor :APP_ID_2
|
21
22
|
|
23
|
+
MP_MSG_TYPES = %w(new_order balance score_change distribute custom split_order order todo) #微信公众号消息类型
|
24
|
+
|
22
25
|
#根据app_id获取access_token
|
23
26
|
#系统会根据当前的access_token即过期时间,自动更新并返回
|
24
27
|
#开发者无需关心这里的access_token怎么更新
|
@@ -219,17 +222,30 @@ module BlsmMpWx
|
|
219
222
|
app_id ||= self.APP_ID
|
220
223
|
return nil unless openid
|
221
224
|
return nil unless content[:touser]==openid
|
222
|
-
return nil unless
|
225
|
+
return nil unless MP_MSG_TYPES.include?(msg_name)
|
223
226
|
VdMpMsg.create({
|
224
227
|
app_id: app_id,
|
225
228
|
openid: openid,
|
226
229
|
content: content.to_json,
|
227
230
|
msg_name: msg_name,
|
228
|
-
template_msg:
|
231
|
+
template_msg: MP_MSG_TYPES.include?(msg_name),
|
229
232
|
status: 'none'
|
230
233
|
})
|
231
234
|
end
|
232
235
|
|
236
|
+
|
237
|
+
def create_msg!(app_id=nil, openid, content, msg_name)
|
238
|
+
app_id ||= self.APP_ID
|
239
|
+
VdMpMsg.create!({
|
240
|
+
app_id: app_id,
|
241
|
+
openid: openid,
|
242
|
+
content: content.to_json,
|
243
|
+
msg_name: msg_name,
|
244
|
+
template_msg: MP_MSG_TYPES.include?(msg_name),
|
245
|
+
status: 'none'
|
246
|
+
})
|
247
|
+
end
|
248
|
+
|
233
249
|
#批量获取公众号的素材列表
|
234
250
|
#=====Parameters
|
235
251
|
# * +app_id+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|