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 +4 -4
- data/lib/blsm-vd-core/model/order.rb +1 -1
- data/lib/blsm-vd-core/version.rb +1 -1
- data/lib/blsm-vd-core.rb +10 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f5feb33241ef874a85488ea7ec2d67c8a7e2704
|
4
|
+
data.tar.gz: 6b0d5e344b2e65a9c9a4d8f89f8e6b2fbb72d58c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/blsm-vd-core/version.rb
CHANGED
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.
|
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
|
-
|
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:
|
317
|
-
seller_change = -VdUserScore.where(user_id: seller.id).where(score_type:
|
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
|
-
|
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:
|
378
|
-
seller_change = -VdUserScore.where(user_id: seller.id).where(score_type:
|
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
|
#扣取积分
|