blsm-vd-core 0.8.8 → 0.8.9
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-vd-core/version.rb +1 -1
- data/lib/blsm-vd-core.rb +74 -78
- 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: 12af7f64e7c2ec0eb2faa8c5ed65a266fb822cb7
|
4
|
+
data.tar.gz: 85c1bfc5988d6749a7384cde62d90907dd7babc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504339041e2349bd75cc635d84f8c5d72b78df7a51db869ee062c6e5feec7d7aae2f21e473e454c8e015300aab7fc94e5e35936f08445b45bfdec18a71f6e179
|
7
|
+
data.tar.gz: efc894e2330a92eebbeb667d9e865b58b23d620d7fb15177142fc84627fb2cce922848b5b445d46b809e813378604b7293bbed5dfb610bf3df3425c1d7e369e3
|
data/Gemfile.lock
CHANGED
data/lib/blsm-vd-core/version.rb
CHANGED
data/lib/blsm-vd-core.rb
CHANGED
@@ -96,84 +96,7 @@ module BlsmVdCore
|
|
96
96
|
if order.state.to_s.include?('客户签收,订单完成')
|
97
97
|
create_clearing_item(order_id) if order.ubox_order?
|
98
98
|
clearing_item = ClearingItem.where(order_id: order.id).first if order.ubox_order?
|
99
|
-
if order.application
|
100
|
-
on_order_sale_out(order.application.user_id, order_id)
|
101
|
-
#订单完成, 发送融云消息, 给邀请人奖励
|
102
|
-
user = order.application.user
|
103
|
-
if !user.blank?
|
104
|
-
#订单完成, 发送融云消息
|
105
|
-
if !user.rc_user.blank?
|
106
|
-
VdRcMsgNotify.create_order_finish_notify(user.username)
|
107
|
-
end
|
108
|
-
# 包邮券返款
|
109
|
-
if order.vd_free_post
|
110
|
-
ClearingItem.create({
|
111
|
-
state: 'CASH_BACK',
|
112
|
-
pay_type: "ZXZF",
|
113
|
-
user_id: user.id,
|
114
|
-
order_id: -14,
|
115
|
-
rate_of_profit: 1,
|
116
|
-
earn_amount: order.shipping_charge
|
117
|
-
})
|
118
|
-
end
|
119
|
-
|
120
|
-
# 进货费返还
|
121
|
-
user_info = user.create_vd_user_info
|
122
|
-
if !order.line_items.blank? && user_info.purchase_fee > 0
|
123
|
-
franchise_price = order.line_items.inject(0) { |result, item| result+item.franchise_price*item.quantity }
|
124
|
-
earn_amount = franchise_price < user_info.purchase_fee ? franchise_price : user_info.purchase_fee
|
125
|
-
#创建结算项
|
126
|
-
ClearingItem.create({
|
127
|
-
state: 'CASH_BACK',
|
128
|
-
pay_type: "ZXZF",
|
129
|
-
user_id: user.id,
|
130
|
-
order_id: -13,
|
131
|
-
rate_of_profit: 1,
|
132
|
-
earn_amount: earn_amount
|
133
|
-
})
|
134
|
-
user_info.update_attributes(:purchase_fee => (user_info.purchase_fee - earn_amount))
|
135
|
-
end
|
136
|
-
# 给邀请人奖励
|
137
|
-
inviter = User.where(:invication_code => user.invicated_from).first if user.invicated_from
|
138
|
-
vd_transaction = "inviter_#{order.id}_reward"
|
139
|
-
#被邀请人,金牌店主以下,渠道邀请,邀请人不为空,一个订单只能有一个结算项
|
140
|
-
if user.vd_user_info.distribute_sum < 1500 && user.create_vd_user_info.channel == "market_invite" && !inviter.blank? && !BlsmVdCore::VdInfoSec.dangerous?(vd_transaction)
|
141
|
-
|
142
|
-
#发送给邀请人微信提醒
|
143
|
-
content = "您邀请的店主 #{user.username}(注册电话号为#{user.phone})与#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}成功成交一笔订单,订单金额为#{order.total_fee.to_f}元, 您将同步获取邀请奖励#{(order.total_fee.to_f * 0.1).round(2)}元,特此通知"
|
144
|
-
|
145
|
-
#为邀请人创建,结算项
|
146
|
-
ClearingItem.create({
|
147
|
-
state: 'CASH_BACK',
|
148
|
-
pay_type: "ZXZF",
|
149
|
-
user_id: inviter.id,
|
150
|
-
order_id: -11,
|
151
|
-
rate_of_profit: 1,
|
152
|
-
earn_amount: (order.total_fee.to_f * 0.1).round(2)
|
153
|
-
})
|
154
|
-
VdMpMsg.create!({
|
155
|
-
app_id: BlsmMpWx.APP_ID,
|
156
|
-
openid: inviter.openid,
|
157
|
-
content: content,
|
158
|
-
msg_name: "custom",
|
159
|
-
template_msg: false,
|
160
|
-
status: 'none'
|
161
|
-
})
|
162
|
-
#发送给邀请人融云提醒
|
163
|
-
if !inviter.rc_user.blank?
|
164
|
-
VdRcMsgNotify.create({
|
165
|
-
user_id: 3,
|
166
|
-
to_ids: inviter.username,
|
167
|
-
title: "提醒",
|
168
|
-
to_type: 'single',
|
169
|
-
msg_type: 'RC:TxtMsg',
|
170
|
-
content: content
|
171
|
-
})
|
172
|
-
end
|
173
|
-
BlsmVdCore::VdInfoSec.committed(vd_transaction) #防止重复创建
|
174
|
-
end
|
175
|
-
end
|
176
|
-
end
|
99
|
+
on_order_sale_out(order.application.user_id, order_id) if order.application
|
177
100
|
clearing_item.update_attributes({earn_amount: order.jm_profit, state: 'CASH_BACK'}) if clearing_item && order.pay_on_line?
|
178
101
|
return ERROR_CODES[200]
|
179
102
|
end
|
@@ -549,6 +472,79 @@ module BlsmVdCore
|
|
549
472
|
|
550
473
|
end
|
551
474
|
|
475
|
+
|
476
|
+
#防拒签通知
|
477
|
+
if seller.rc_user
|
478
|
+
VdRcMsgNotify.create_order_finish_notify(seller.username)
|
479
|
+
end
|
480
|
+
|
481
|
+
# 包邮券返款
|
482
|
+
if order.vd_free_post
|
483
|
+
ClearingItem.create({
|
484
|
+
state: 'CASH_BACK',
|
485
|
+
pay_type: "ZXZF",
|
486
|
+
user_id: seller.id,
|
487
|
+
order_id: -14,
|
488
|
+
rate_of_profit: 1,
|
489
|
+
earn_amount: order.shipping_charge
|
490
|
+
})
|
491
|
+
end
|
492
|
+
|
493
|
+
#供货全返还
|
494
|
+
if order.line_items && seller_info.purchase_fee > 0
|
495
|
+
franchise_price = order.line_items.inject(0) { |result, item| result+item.franchise_price*item.quantity }
|
496
|
+
earn_amount = franchise_price < seller_info.purchase_fee ? franchise_price : seller_info.purchase_fee
|
497
|
+
#创建结算项
|
498
|
+
ClearingItem.create({
|
499
|
+
state: 'CASH_BACK',
|
500
|
+
pay_type: "ZXZF",
|
501
|
+
user_id: seller.id,
|
502
|
+
order_id: -13,
|
503
|
+
rate_of_profit: 1,
|
504
|
+
earn_amount: earn_amount
|
505
|
+
})
|
506
|
+
seller_info.update_attributes(:purchase_fee => (seller_info.purchase_fee - earn_amount))
|
507
|
+
end
|
508
|
+
|
509
|
+
# 给邀请人奖励
|
510
|
+
inviter = User.where(:invication_code => seller.invicated_from).first if seller.invicated_from
|
511
|
+
#被邀请人,金牌店主以下,渠道邀请,邀请人不为空,一个订单只能有一个结算项
|
512
|
+
if inviter && seller_info.distribute_sum < 1500 && seller_info.channel == "market_invite"
|
513
|
+
|
514
|
+
#发送给邀请人微信提醒
|
515
|
+
content = "您邀请的店主 #{seller.username}(注册电话号为#{seller.phone})与#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}成功成交一笔订单,订单金额为#{order.total_fee.to_f}元, 您将同步获取邀请奖励#{(order.total_fee.to_f * 0.1).round(2)}元,特此通知"
|
516
|
+
|
517
|
+
#为邀请人创建,结算项
|
518
|
+
ClearingItem.create({
|
519
|
+
state: 'CASH_BACK',
|
520
|
+
pay_type: "ZXZF",
|
521
|
+
user_id: inviter.id,
|
522
|
+
order_id: -11,
|
523
|
+
rate_of_profit: 1,
|
524
|
+
earn_amount: (order.total_fee.to_f * 0.1).round(2)
|
525
|
+
})
|
526
|
+
VdMpMsg.create!({
|
527
|
+
app_id: BlsmMpWx.APP_ID,
|
528
|
+
openid: inviter.openid,
|
529
|
+
content: content,
|
530
|
+
msg_name: "custom",
|
531
|
+
template_msg: false,
|
532
|
+
status: 'none'
|
533
|
+
})
|
534
|
+
#发送给邀请人融云提醒
|
535
|
+
if inviter.rc_user
|
536
|
+
VdRcMsgNotify.create({
|
537
|
+
user_id: 3,
|
538
|
+
to_ids: inviter.username,
|
539
|
+
title: "提醒",
|
540
|
+
to_type: 'single',
|
541
|
+
msg_type: 'RC:TxtMsg',
|
542
|
+
content: content
|
543
|
+
})
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
547
|
+
|
552
548
|
#安全库录入信息
|
553
549
|
VdInfoSec.committed(vd_transaction)
|
554
550
|
|
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.
|
4
|
+
version: 0.8.9
|
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-
|
12
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|