blsm-vd-core 0.7.6 → 0.7.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: b7d234ba7e348a81c7e4f336d483f94c2e31c440
4
- data.tar.gz: 4b8aab14b2c2326c108d79e2ff2f7f5f95f38603
3
+ metadata.gz: 5cfbe74a9b2aae00ab57d96ad09e061fbd97b5b7
4
+ data.tar.gz: f12f5e6d61cbb865c8770740870e2d61af15c47d
5
5
  SHA512:
6
- metadata.gz: fdb277c73ca1603237fa815e838946d04459c9b351fee9848807b111a488eadbee446028f48180b7956f06ee7759e18bf4926caad579bde44bd4f27a6dc2140e
7
- data.tar.gz: b6ab4c4c29fb6d84ee72f42d8295e8ccc9e644a899d4db7a0732eb89b004fa7889bee81189a47e3addf317a297d013e503229b6cc2015b71334484527774dfac
6
+ metadata.gz: a38942e555d4a3570a076a70b75fa20c7153285d3c0587c3d2f15b231aa3574c0a4dc6bd97da69c30f614040d5bd778f989bda3c9395037e9e34d90c1dd27a05
7
+ data.tar.gz: f98d6419af754ff7c6a4ea759d511955b1e826724e929951965b6695f8f9a120abb041eec43baa6c2464c7be1cca83934a9d30b93faba6f46bd710beea337860
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blsm-vd-core (0.7.5)
4
+ blsm-vd-core (0.7.7)
5
5
 
6
6
  GEM
7
7
  remote: https://ruby.taobao.org/
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  rspec (~> 3.2)
128
128
 
129
129
  BUNDLED WITH
130
- 1.12.5
130
+ 1.13.6
data/lib/blsm-vd-core.rb CHANGED
@@ -80,9 +80,49 @@ module BlsmVdCore
80
80
  clearing_item = ClearingItem.where(order_id: order.id).first if order.ubox_order?
81
81
  if order.application
82
82
  on_order_sale_out(order.application.user_id, order_id)
83
- #订单完成, 发送融云消息
84
- if order.application.user
85
- VdRcMsgNotify.create_order_finish_notify(order.application.user.username)
83
+ #订单完成, 发送融云消息, 给邀请人奖励
84
+ user = order.application.user
85
+ if !user.blank?
86
+ #订单完成, 发送融云消息
87
+ if !user.rc_user.blank?
88
+ VdRcMsgNotify.create_order_finish_notify(user.username)
89
+ end
90
+ # 给邀请人
91
+ inviter = User.where(:invication_code=>user.invicated_from).first
92
+ vd_transaction = "inviter_#{order.id}_reward"
93
+ if user.create_vd_user_info.channel == "market_invite" && !inviter.blank? && !BlsmVdCore::VdInfoSec.dangerous?(vd_transaction)
94
+ #为邀请人创建,结算项
95
+ ClearingItem.create({
96
+ state: 'CASH_BACK',
97
+ pay_type: "ZXZF",
98
+ user_id: inviter.id,
99
+ order_id: -11,
100
+ rate_of_profit: 1,
101
+ earn_amount: (order.total_fee.to_f * 0.1).round(2)
102
+ })
103
+ #发送给邀请人微信提醒
104
+ 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)}元,特此通知"
105
+ VdMpMsg.create!({
106
+ app_id: BlsmMpWx.APP_ID,
107
+ openid: inviter.openid,
108
+ content: content,
109
+ msg_name: "custom",
110
+ template_msg: false,
111
+ status: 'none'
112
+ })
113
+ #发送给邀请人融云提醒
114
+ if !inviter.rc_user.blank?
115
+ VdRcMsgNotify.create({
116
+ user_id: 3,
117
+ to_ids: inviter.username,
118
+ title: "提醒",
119
+ to_type: 'single',
120
+ msg_type: 'RC:TxtMsg',
121
+ content: content
122
+ })
123
+ end
124
+ BlsmVdCore::VdInfoSec.committed(vd_transaction) #防止重复创建
125
+ end
86
126
  end
87
127
  end
88
128
  clearing_item.update_attributes({earn_amount: order.jm_profit, state: 'CASH_BACK'}) if clearing_item && order.pay_on_line?
@@ -1,3 +1,3 @@
1
1
  module BlsmVdCore
2
- VERSION = "0.7.6"
3
- end
2
+ VERSION = "0.7.7"
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.6
4
+ version: 0.7.7
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-11-11 00:00:00.000000000 Z
12
+ date: 2016-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec