blsm-vd-core 0.7.2 → 0.7.3

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: 637e1d6b0eccffe21fa182edc0250f9a829f454e
4
- data.tar.gz: b1f87de8ca89da90f189f4299c353c6c26bbeddd
3
+ metadata.gz: d900f262f49e3f750e6e1282ba46eae80e3a2e8c
4
+ data.tar.gz: 457b226937b09497e4700586b591f779ebaf8adf
5
5
  SHA512:
6
- metadata.gz: 054204a8cdee4b1fd961298b33cf6477e4dbe160a687d064817bdff1b402690e5c2527b9cf41fb17eeefaf0e8931a8247df0d8a08725cc19947caa8ad62be159
7
- data.tar.gz: cd933a9502beb99bd85565b61aea20e439bce982dc0b66987e5e1b066e2d1a9a26b53236ef73c342b4f267672c544f54f386934828af94f434451178b2e1f7fc
6
+ metadata.gz: a8eeca634abbb9c5745888b419ce0fa1f0a1c32914626c46e31e49ebf7dae37f0a54662911e81b23ca3d333afdec03aa9ad197bfcb32bfc3ae441b861f8097d4
7
+ data.tar.gz: eb42d8cf00896b68a771f955c450773513dccf549f66cef609d2e0a0123df8384c7c67d98cd6e68fca13d3b3e7078c238750324ec657d3afa96008b2d7e4a956
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blsm-vd-core (0.7.1)
4
+ blsm-vd-core (0.7.3)
5
5
 
6
6
  GEM
7
7
  remote: https://ruby.taobao.org/
@@ -22,6 +22,9 @@ require 'blsm-vd-core/model/vd_rc_msg_notify'
22
22
  require 'blsm-vd-core/model/rc_user'
23
23
  require 'blsm-vd-core/model/user'
24
24
  require 'blsm-vd-core/model/application'
25
+ require 'blsm-vd-core/model/setting'
26
+ require 'blsm-vd-core/model/recharge_spread'
27
+ require 'blsm-vd-core/model/user_spread'
25
28
  require 'faraday'
26
29
  require 'blsm-mp-wx'
27
30
 
@@ -332,7 +335,9 @@ module BlsmVdCore
332
335
 
333
336
  #融云推送
334
337
  if leader.rc_user
335
- VdRcMsgNotify.create_score_change_notify(leader.id, "首趣黑带#{leader.username},你好,你的队员【#{seller.username}】订单#{order.number}已成功签收,分销#{franchise_sum}元", leader_change, '积分', leader_info.score)
338
+ VdRcMsgNotify.create_score_change_notify(leader.id,
339
+ "首趣黑带#{leader.username},你好,你的队员【#{seller.username}】订单#{order.number}已成功签收,分销#{franchise_sum}元",
340
+ leader_change, '积分', leader_info.score)
336
341
  end
337
342
 
338
343
  #微信通知
@@ -391,6 +396,28 @@ module BlsmVdCore
391
396
  end
392
397
  end
393
398
 
399
+ #订单签收,加粉充值自动增加10元
400
+ fans_rewards = Setting.vd_order_sign_fans_rewards
401
+ if fans_rewards && fans_rewards[:order_money]>0 && fans_rewards[:reward_money]>0 && (order.shipping_charge+order.item_total)>= fans_rewards[:order_money]
402
+
403
+ user_spread = UserSpread.where(user_id: seller.id).first
404
+ if user_spread
405
+ UserSpread.update_counters(user_spread.id, :amount => fans_rewards[:reward_money])
406
+ RechargeSpread.create({amount: fans_rewards[:reward_money], user_spread_id: user_spread.id, r_type: 1, admin_id: 3, notes: "订单#{order.id}签收奖励"})
407
+
408
+ puts "seller:#{seller},rc_user:#{seller.rc_user}"
409
+
410
+ #融云推送
411
+ if seller.rc_user
412
+ VdRcMsgNotify.create_order_sign_fans_notify(seller.id,
413
+ fans_rewards[:reward_money],
414
+ order.number,
415
+ "尊敬的店主#{seller.username},您好,您的订单#{order.number}已成功签收,首趣奖励您粉丝推广费#{fans_rewards[:reward_money]}元")
416
+ end
417
+ end
418
+
419
+ end
420
+
394
421
  #安全库录入信息
395
422
  VdInfoSec.committed(vd_transaction)
396
423
 
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+ module BlsmVdCore
3
+ class RechargeSpread < BlsmVdCore::BaseRecord
4
+ self.table_name = 'recharge_spreads'
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ # coding: utf-8
2
+ module BlsmVdCore
3
+ class Setting < BlsmVdCore::BaseRecord
4
+ self.table_name='settings'
5
+
6
+
7
+ #订单签收,奖励加粉金额
8
+ def self.vd_order_sign_fans_rewards
9
+ setting = Setting.where(name: 'vd_order_sign_fans_reward').pluck(:value)[0]
10
+ return nil unless setting
11
+ array = setting.split('|')
12
+ {order_money: array[0].to_i, reward_money: array[1].to_i}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+ module BlsmVdCore
3
+ class UserSpread < BlsmVdCore::BaseRecord
4
+ self.table_name='user_spreads'
5
+
6
+ end
7
+ end
@@ -39,7 +39,7 @@ module BlsmVdCore
39
39
  "客户信息:#{order.ubox_order? ? "售货机#{order.ubox_vmid}扫码用户" : "#{order.shipping_province} #{order.name} #{order.phone}"}",
40
40
  "买家留言:#{order.comment}"
41
41
  ],
42
- url: "http://wunion.4007060700.com/mobile/jms_orders/#{order.to_param}"
42
+ url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}"
43
43
  }.to_json
44
44
  })
45
45
 
@@ -70,7 +70,7 @@ module BlsmVdCore
70
70
  "客户信息:#{order.ubox_order? ? "售货机#{order.ubox_vmid}扫码用户" : "#{order.shipping_province} #{order.name} #{order.phone}"}",
71
71
  "买家留言:#{order.comment}"
72
72
  ],
73
- url: "http://wunion.4007060700.com/mobile/jms_orders/#{order.to_param}"
73
+ url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}"
74
74
  }.to_json
75
75
  })
76
76
 
@@ -101,7 +101,7 @@ module BlsmVdCore
101
101
  "预收积分:#{score}",
102
102
  "备注:订单签收后您会获取相应积分"
103
103
  ],
104
- url: "http://wunion.4007060700.com/mobile/jms_orders/#{order.to_param}/only_show"
104
+ url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}/only_show"
105
105
  }.to_json
106
106
  })
107
107
 
@@ -132,7 +132,7 @@ module BlsmVdCore
132
132
  "订单金额:#{order.total_fee}",
133
133
  "预计收入:#{order.jm_profit}元"
134
134
  ],
135
- url: "http://wunion.4007060700.com/mobile/jms_orders/#{order.to_param}/only_show?change=√"
135
+ url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}/only_show?change=√"
136
136
  }.to_json
137
137
  })
138
138
 
@@ -144,7 +144,7 @@ module BlsmVdCore
144
144
  # msg_content['change'] 结算金额
145
145
  # msg_content['account_type'] 账户类型
146
146
  # msg_content['total'] 账户总余额
147
- def self.create_account_change_notify(user_id, body, money, account_type, total, url='http://wunion.4007060700.com/mobile/my_clearings')
147
+ def self.create_account_change_notify(user_id, body, money, account_type, total, url='http://m.shouqu360.com/mobile/my_clearings')
148
148
  user = BlsmVdCore::User.where(id: user_id).first
149
149
  return nil unless user && user.rc_user
150
150
 
@@ -177,7 +177,7 @@ module BlsmVdCore
177
177
  # msg_content['change'] 结算金额
178
178
  # msg_content['account_type'] 账户类型
179
179
  # msg_content['total'] 账户总余额
180
- def self.create_score_change_notify(user_id, body, change, account_type, total, url='http://wunion.4007060700.com/mobile/my_scores')
180
+ def self.create_score_change_notify(user_id, body, change, account_type, total, url='http://m.shouqu360.com/mobile/my_scores')
181
181
  user = BlsmVdCore::User.where(id: user_id).first
182
182
  return nil unless user && user.rc_user
183
183
 
@@ -226,7 +226,34 @@ module BlsmVdCore
226
226
  "积分变动:#{score_change}",
227
227
  "积分余额:#{user.create_vd_user_info.score}"
228
228
  ],
229
- url: 'http://wunion.4007060700.com/mobile/jms_orders'
229
+ url: 'http://m.shouqu360.com/mobile/jms_orders'
230
+ }.to_json
231
+ })
232
+
233
+ end
234
+
235
+
236
+ #创建订单签收、积分加粉充值
237
+ def self.create_order_sign_fans_notify(user_id, reward_money, order_number, body)
238
+ user = BlsmVdCore::User.where(id: user_id).first
239
+ return nil unless user && user.rc_user
240
+
241
+ BlsmVdCore::VdRcMsgNotify.create({
242
+ user_id: 3,
243
+ to_ids: user.username,
244
+ to_type: 'single',
245
+ msg_type: 'CU:TemplateMsg',
246
+ title: '订单签收-粉丝推广奖励',
247
+ content: {
248
+ title: '订单签收-粉丝推广奖励',
249
+ content: {
250
+ body: body
251
+ },
252
+ items: [
253
+ "订单编号:#{order_number}",
254
+ "奖励金额:#{reward_money}"
255
+ ],
256
+ url: 'http://m.shouqu360.com/mobile/user_spreads'
230
257
  }.to_json
231
258
  })
232
259
 
@@ -1,3 +1,3 @@
1
1
  module BlsmVdCore
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  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.7.2
4
+ version: 0.7.3
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-09-07 00:00:00.000000000 Z
12
+ date: 2016-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -193,8 +193,11 @@ files:
193
193
  - lib/blsm-vd-core/model/product.rb
194
194
  - lib/blsm-vd-core/model/product_prop.rb
195
195
  - lib/blsm-vd-core/model/rc_user.rb
196
+ - lib/blsm-vd-core/model/recharge_spread.rb
197
+ - lib/blsm-vd-core/model/setting.rb
196
198
  - lib/blsm-vd-core/model/ubox_vm.rb
197
199
  - lib/blsm-vd-core/model/user.rb
200
+ - lib/blsm-vd-core/model/user_spread.rb
198
201
  - lib/blsm-vd-core/model/vd_info_sec.rb
199
202
  - lib/blsm-vd-core/model/vd_rc_msg_notify.rb
200
203
  - lib/blsm-vd-core/model/vd_user_info.rb