blsm-vd-core 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/Gemfile.lock +2 -2
- data/lib/blsm-vd-core/model/order.rb +3 -1
- data/lib/blsm-vd-core/model/ubox_vm.rb +13 -0
- data/lib/blsm-vd-core/version.rb +1 -1
- data/lib/blsm-vd-core.rb +8 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bbba240c6e96672ee38bfa3da3c664de0a80444
|
4
|
+
data.tar.gz: 18526f60cba5e3b0c77d2e043a9d433c33aa87f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a227abd61ff46e3a8266350e5dcefb30162313f5b881fce2a8681d7448df08db6770082a82966e573899f3596d326d5a6fd49015ac64e66f9467a6d0a1ce2555
|
7
|
+
data.tar.gz: 4b671fb1bc598d98f2a84032d496762d0e3df35b8e118e41da6ba8f58c78baf0d23984312916dccb34a8e336df663654b2d6eb9bc62e9426a8d79c6b0dcb1410
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,6 +6,8 @@ module BlsmVdCore
|
|
6
6
|
has_many :clearing_items, class_name: "::BlsmVdCore::ClearingItem"
|
7
7
|
has_many :line_items, class_name: "::BlsmVdCore::LineItem"
|
8
8
|
belongs_to :application, class_name: "::BlsmVdCore::Application", foreign_key: "application_id"
|
9
|
+
belongs_to :ubox_vm, class_name: "::BlsmVdCore::UboxVm", foreign_key: 'ubox_vmid', primary_key: 'ubox_vmid'
|
10
|
+
|
9
11
|
encrypted_id key: 'bYqILlFMZn3xd8Cy'
|
10
12
|
|
11
13
|
public
|
@@ -24,7 +26,7 @@ module BlsmVdCore
|
|
24
26
|
|
25
27
|
#是否是自动售货机的订单
|
26
28
|
def ubox_order?
|
27
|
-
|
29
|
+
self.ubox_vm
|
28
30
|
end
|
29
31
|
|
30
32
|
def pay_off_line?
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module BlsmVdCore
|
3
|
+
class UboxVm < BlsmVdCore::BaseRecord
|
4
|
+
self.table_name='ubox_vms'
|
5
|
+
belongs_to :application, class_name: "::BlsmVdCore::Application"
|
6
|
+
|
7
|
+
#settlement 结算方式 0:默认(售价25%), 1:加盟商(售价100%)
|
8
|
+
def settlement_rate
|
9
|
+
return 1.0 if self.settlement==1
|
10
|
+
0.25
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/blsm-vd-core/version.rb
CHANGED
data/lib/blsm-vd-core.rb
CHANGED
@@ -7,6 +7,7 @@ require 'active_support'
|
|
7
7
|
require 'blsm-vd-core/version'
|
8
8
|
require 'blsm-vd-core/model/active_record'
|
9
9
|
require 'blsm-vd-core/model/encrypted_id'
|
10
|
+
require 'blsm-vd-core/model/ubox_vm'
|
10
11
|
require 'blsm-vd-core/model/order'
|
11
12
|
require 'blsm-vd-core/model/clearing_item'
|
12
13
|
require 'blsm-vd-core/model/line_item'
|
@@ -214,7 +215,7 @@ module BlsmVdCore
|
|
214
215
|
data[:order_id] = order.id
|
215
216
|
data[:order_amount] = order.total_fee
|
216
217
|
data[:earn_amount] = order.jm_profit
|
217
|
-
data[:rate_of_profit] = order.ubox_order? ?
|
218
|
+
data[:rate_of_profit] = order.ubox_order? ? order.ubox_vm.settlement_rate : user_info.profit_rate
|
218
219
|
if order.pay_off_line?
|
219
220
|
data[:pay_type] = 'CODPAY'
|
220
221
|
else
|
@@ -240,10 +241,11 @@ module BlsmVdCore
|
|
240
241
|
# * +order_id+ - 订单id
|
241
242
|
def on_order_sale_out(seller_id, order_id)
|
242
243
|
seller = User.where(id: seller_id).first
|
244
|
+
return ERROR_CODES[4045] unless seller
|
245
|
+
|
243
246
|
leader = User.where("id in(select supervisor_id from vd_user_infos where user_id=#{seller_id})").first
|
244
247
|
order = Order.where(id: order_id).first
|
245
248
|
|
246
|
-
return ERROR_CODES[4045] unless seller
|
247
249
|
return ERROR_CODES[401] if !order || !order.application || !(order.application.user_id==seller_id)
|
248
250
|
|
249
251
|
#安全校验
|
@@ -329,7 +331,10 @@ module BlsmVdCore
|
|
329
331
|
|
330
332
|
#分销额增加,更新未发出货物的(state=CREATE)分成比率
|
331
333
|
seller.clearing_items.where(:state => "WAIT_TO_SURE").each do |item|
|
332
|
-
|
334
|
+
if item.order.ubox_order?
|
335
|
+
item.update_attributes({:rate_of_profit => order.ubox_vm.settlement_rate,
|
336
|
+
:earn_amount => item.order.jm_profit})
|
337
|
+
else
|
333
338
|
item.update_attributes({:rate_of_profit => seller_info.profit_rate,
|
334
339
|
:earn_amount => item.order.jm_profit})
|
335
340
|
end
|
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.6.
|
4
|
+
version: 0.6.8
|
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: 2016-
|
12
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/blsm-vd-core/model/order.rb
|
193
193
|
- lib/blsm-vd-core/model/product.rb
|
194
194
|
- lib/blsm-vd-core/model/product_prop.rb
|
195
|
+
- lib/blsm-vd-core/model/ubox_vm.rb
|
195
196
|
- lib/blsm-vd-core/model/user.rb
|
196
197
|
- lib/blsm-vd-core/model/vd_info_sec.rb
|
197
198
|
- lib/blsm-vd-core/model/vd_user_info.rb
|
@@ -219,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
220
|
version: '0'
|
220
221
|
requirements: []
|
221
222
|
rubyforge_project:
|
222
|
-
rubygems_version: 2.4.
|
223
|
+
rubygems_version: 2.4.8
|
223
224
|
signing_key:
|
224
225
|
specification_version: 4
|
225
226
|
summary: "首趣微店核心模块"
|