blsm-vd-core 0.3.5 → 0.3.7

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: b57b906e7e5353bf1462b2ef2837017a0646b34f
4
- data.tar.gz: b615efb55cc6ef16946ad27a18e29993019504fc
3
+ metadata.gz: 6f5feb33241ef874a85488ea7ec2d67c8a7e2704
4
+ data.tar.gz: 6b0d5e344b2e65a9c9a4d8f89f8e6b2fbb72d58c
5
5
  SHA512:
6
- metadata.gz: c1110f0ac05fe5a53d7c00d860583d282f7ab046cb04d374b2ef21f631cafc1e326e8ac2b13633eccbe55ee4d99ae60a1c536d6f2776b0da94a678552bf80272
7
- data.tar.gz: 8cbb151b80a35bda57af73e6891d1269ecc1a691714d8afbf601690df7a5f006d8318004a896227c98d3a2eac3437b7355c75d0aba1c921b9ae380d90f079e14
6
+ metadata.gz: 257d2c9a42a40df19505c60bda1468b2b4204d5b904ce08fc6018312bb01fe7cad73c30070e61d922cb1362d3556885d81221616f8c99ea2885201b55940d868
7
+ data.tar.gz: 3c50df573079b090d043d03200ea23584593fad6967cd51aa3b8bf9cada94f8a482008c436b114b9e2008a3ef6a67e3aaaf1cb58c77060b5f2d3ebec1de1008f
@@ -19,7 +19,7 @@ module BlsmVdCore
19
19
  rate = VdUserScore::SCORES[:SALE_OUT_INDIRECT] if rate.nil? && "black" == role
20
20
  fee += ((item.quantity * item.franchise_price.to_f) * rate)
21
21
  end
22
- fee
22
+ sprintf('%0.2f', fee.to_f).to_f
23
23
  end
24
24
  def pay_off_line?
25
25
  self.pay_type == 1
@@ -1,3 +1,3 @@
1
1
  module BlsmVdCore
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.7"
3
3
  end
data/lib/blsm-vd-core.rb CHANGED
@@ -173,11 +173,11 @@ module BlsmVdCore
173
173
  leader_info = leader.create_vd_user_info if leader
174
174
 
175
175
  #订单确认提醒(黑带)
176
- leader_change = order.franchise_sum.to_f*VdUserScore::SCORES[:SALE_OUT_INDIRECT]
176
+ leader_change = order.get_vd_score(leader_info.vd_role)
177
177
  distribute_leader_notify = {touser: leader.openid,
178
178
  order_id: Order.encrypt(Order.encrypted_id_key, order.id.to_s),
179
179
  score_change: leader_change,
180
- money_change: leader_change*VdUserScore::SCORES[:SCORE_TO_MONEY],
180
+ money_change: (leader_change*VdUserScore::SCORES[:SCORE_TO_MONEY]).round(2),
181
181
  content: "首趣黑带#{leader.username},你好:成员【#{user.username}】确认订单成功。"
182
182
  } if leader && leader_info
183
183
  BlsmMpWx.create_msg(nil, leader.openid, distribute_leader_notify, 'distribute') if distribute_leader_notify
@@ -300,7 +300,8 @@ module BlsmVdCore
300
300
  }
301
301
 
302
302
  #安全校验(是否曾经被售出过)
303
- sold_out = VdInfoSec.dangerous?("order_sale_out_#{seller_id}_#{order_id}")
303
+ score_type_str = "order_sale_out_#{seller_id}_#{order_id}"
304
+ sold_out = VdInfoSec.dangerous?(score_type_str)
304
305
  return ERROR_CODES[200] unless sold_out
305
306
 
306
307
  #安全校验(是否曾经此订单被取消,并且扣取积分)
@@ -313,8 +314,8 @@ module BlsmVdCore
313
314
 
314
315
  #供货价总和、应该扣取的积分总额
315
316
  franchise_sum = order.franchise_sum
316
- leader_order_score = VdUserScore.where(user_id: leader.id).where(score_type: sold_out) if leader && leader_info
317
- seller_change = -VdUserScore.where(user_id: seller.id).where(score_type: sold_out).first.score
317
+ leader_order_score = VdUserScore.where(user_id: leader.id).where(score_type: score_type_str).first if leader && leader_info
318
+ seller_change = -VdUserScore.where(user_id: seller.id).where(score_type: score_type_str).first.score
318
319
  leader_change = -leader_order_score.score if leader_order_score
319
320
 
320
321
  #扣取积分
@@ -361,7 +362,8 @@ module BlsmVdCore
361
362
  return ERROR_CODES[401] if !order || !order.application || !(order.application.user_id==seller_id)
362
363
 
363
364
  #安全校验(是否曾经被售出过)
364
- sold_out = VdInfoSec.dangerous?("order_sale_out_#{seller_id}_#{order_id}")
365
+ score_type_str = "order_sale_out_#{seller_id}_#{order_id}"
366
+ sold_out = VdInfoSec.dangerous?(score_type_str)
365
367
  return ERROR_CODES[200] unless sold_out
366
368
 
367
369
  #安全校验(是否曾经此订单被取消,并且扣取积分)
@@ -374,8 +376,8 @@ module BlsmVdCore
374
376
 
375
377
  #供货价总和、应该扣取的积分总额
376
378
  franchise_sum = order.franchise_sum
377
- leader_order_score = VdUserScore.where(user_id: leader.id).where(score_type: sold_out) if leader && leader_info
378
- seller_change = -VdUserScore.where(user_id: seller.id).where(score_type: sold_out).first.score
379
+ leader_order_score = VdUserScore.where(user_id: leader.id).where(score_type: score_type_str).first if leader && leader_info
380
+ seller_change = -VdUserScore.where(user_id: seller.id).where(score_type: score_type_str).first.score
379
381
  leader_change = -leader_order_score.score if leader_order_score
380
382
 
381
383
  #扣取积分
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.3.5
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer