blsm-mp-wx 0.1.5 → 0.1.6
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 +8 -8
- data/Gemfile.lock +1 -1
- data/lib/blsm-mp-wx/model/vd_mp_msg.rb +7 -0
- data/lib/blsm-mp-wx/version.rb +1 -1
- data/lib/blsm-mp-wx.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDJmYWNiNzAwZmNlMmM2YmQwNDEwNTBiM2M2ZmJkZTQxNjc2MWE0MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDNiMWQzZTgwMWE4ZjM2ZjA4MDJlOTU1YWVmOTNmMmE4YmI1OTc1Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzZiM2VlMzViMDI0NzdkYzVhZjRjNzg5OGJkNDEyNjhmYTU2ZjAzNmFjOWUx
|
10
|
+
NTk3ODRhNmMyOTc4NDM5ZWExNjEzOTM5NGMxOGI0NTBhY2I0NDFmNGMwODM5
|
11
|
+
ZTE0ZWM1YzZhMTIyOWY2M2M4NDhjYTczNDVjZjVmZWNjOTI5NTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2FiNzIxOTAxMTIyNGYwOGU5ZTcwMWVkMDI3ODhkYzUwNjYxMWI1ZDYyMzEw
|
14
|
+
Y2YxZWI2Nzc1NTBmZDViMThhNzdjNDJjMjc1MGU0M2I3ZDEwMTgxM2M4MzZl
|
15
|
+
NDFkYTk2ZWMwNTFiOWY5MDMzMTM0Nzk4MjU5NjcwMmFlNjMxMWE=
|
data/Gemfile.lock
CHANGED
data/lib/blsm-mp-wx/version.rb
CHANGED
data/lib/blsm-mp-wx.rb
CHANGED
@@ -7,6 +7,7 @@ require 'active_support'
|
|
7
7
|
require 'blsm-mp-wx/version'
|
8
8
|
require 'blsm-mp-wx/model/active_record'
|
9
9
|
require 'blsm-mp-wx/model/vd_mp_wx'
|
10
|
+
require 'blsm-mp-wx/model/vd_mp_msg'
|
10
11
|
require 'json'
|
11
12
|
require 'faraday'
|
12
13
|
|
@@ -206,6 +207,30 @@ module BlsmMpWx
|
|
206
207
|
json_obj['short_url']
|
207
208
|
end
|
208
209
|
|
210
|
+
#创建消息,存储到消息队列中
|
211
|
+
#====Parameters
|
212
|
+
# * +app_id+ - 公众号的唯一标识
|
213
|
+
# * +openid+ - 发送给用户的openid
|
214
|
+
# * +content+ - 消息内容
|
215
|
+
# * +msg_name+ - 消息种类:new_order(新订单通知)、balance(结算通知)、score_change(积分变动通知)、custom(普通消息)
|
216
|
+
# new_order => content: {touser:'openid',order_id:''} 系统自动优先使用模板消息发送通知
|
217
|
+
# balance => content: {touser:'openid',clearing_id} 系统自动优先使用模板消息发送通知
|
218
|
+
# score_change => content: {touser:'',change:5,total:25,content:'邀请他人。。。。'}
|
219
|
+
def create_msg(app_id=nil, openid, content, msg_name)
|
220
|
+
app_id ||= self.APP_ID
|
221
|
+
return nil unless openid
|
222
|
+
return nil unless content[:touser]==openid
|
223
|
+
return nil unless %w(new_order balance score_change custom).include?(msg_name)
|
224
|
+
VdMpMsg.create({
|
225
|
+
app_id: app_id,
|
226
|
+
openid: openid,
|
227
|
+
content: content,
|
228
|
+
msg_name: msg_name,
|
229
|
+
template: %w(new_order balance score_change).include?(msg_name),
|
230
|
+
status: 'none'
|
231
|
+
})
|
232
|
+
end
|
233
|
+
|
209
234
|
private
|
210
235
|
#解析json类型的数据,并将最后的数据转为hash或array
|
211
236
|
# +json_data_str+ 要转换的json数据
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- blsm-mp-wx.gemspec
|
156
156
|
- lib/blsm-mp-wx.rb
|
157
157
|
- lib/blsm-mp-wx/model/active_record.rb
|
158
|
+
- lib/blsm-mp-wx/model/vd_mp_msg.rb
|
158
159
|
- lib/blsm-mp-wx/model/vd_mp_wx.rb
|
159
160
|
- lib/blsm-mp-wx/version.rb
|
160
161
|
homepage: https://bitbucket.org/liuxi/blsm-mp-wx/
|