blsm-vd-core 0.8.9 → 0.9.0

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: 12af7f64e7c2ec0eb2faa8c5ed65a266fb822cb7
4
- data.tar.gz: 85c1bfc5988d6749a7384cde62d90907dd7babc4
3
+ metadata.gz: a115c91cf7c5e6a5ba4c64b73b167fe21b0cfdd0
4
+ data.tar.gz: 9b28f4df1fd5c1fe19eee72902f07c5aba3a562b
5
5
  SHA512:
6
- metadata.gz: 504339041e2349bd75cc635d84f8c5d72b78df7a51db869ee062c6e5feec7d7aae2f21e473e454c8e015300aab7fc94e5e35936f08445b45bfdec18a71f6e179
7
- data.tar.gz: efc894e2330a92eebbeb667d9e865b58b23d620d7fb15177142fc84627fb2cce922848b5b445d46b809e813378604b7293bbed5dfb610bf3df3425c1d7e369e3
6
+ metadata.gz: ebd2c12cb6cb54af370ef8049807bc0ecec7bef5f10c37fa3c911478691f12bcaf9c19b94b1ac8d4af8b932d3239ef70bc7e9a10131105b75b6142ca0d7c2aa9
7
+ data.tar.gz: 205d34055b0690dc7a0925526a8533e5ed39369a12ea22123dfdce76e31005a1dde4343215c223cec0c38fb15c5b5940bff7c6e91564904048f58f596ad57059
@@ -1,3 +1,3 @@
1
1
  module BlsmVdCore
2
- VERSION = "0.8.9"
2
+ VERSION = "0.9.0"
3
3
  end
data/lib/blsm-vd-core.rb CHANGED
@@ -142,14 +142,18 @@ module BlsmVdCore
142
142
  product_ids = settings.value.to_s.split('|').map(&:to_i)
143
143
 
144
144
  return ERROR_CODES[4048] if product_ids.size==0
145
- return ERROR_CODES[4047] unless order.line_items.detect { |item| product_ids.include?(item.product_id) }
145
+
146
+ product_count = order.line_items.inject(0) { |s, item| s+= product_ids.include?(item.product_id) ? 1*item.quantity : 0; s }
147
+ return ERROR_CODES[4047] unless product_count >0
146
148
 
147
149
  #安全校验
148
150
  vd_transaction = "order_export_to_erp_handle_#{order_id}"
149
151
  danger = VdInfoSec.dangerous?(vd_transaction)
150
152
  return danger if danger
151
- VdFreePost.create({user_id: seller.id})
152
- content = '您获取到一张顺丰免费券,点击查看 http://w.url.cn/s/AQsuRun'
153
+ product_count.times do
154
+ VdFreePost.create({user_id: seller.id})
155
+ end
156
+ content = "您获取到#{product_count}张顺丰免费券,点击查看 http://w.url.cn/s/AQsuRun"
153
157
  VdMpMsg.create!({
154
158
  app_id: BlsmMpWx.APP_ID,
155
159
  openid: seller.openid,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blsm-vd-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.9
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-01-05 00:00:00.000000000 Z
12
+ date: 2017-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec