blsm-vd-core 0.6.9 → 0.7.0
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/model/rc_user.rb +6 -0
- data/lib/blsm-vd-core/model/user.rb +1 -0
- data/lib/blsm-vd-core/model/vd_rc_msg_notify.rb +112 -0
- data/lib/blsm-vd-core/version.rb +1 -1
- data/lib/blsm-vd-core.rb +19 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240d6c8e38c044bf1aad23991ab7ee642677db58
|
4
|
+
data.tar.gz: 6b7436ba1dbcbc3c4de9f5c551bd02c350cebe94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e5bae2d12dfe7802bdb64f7df36cbff480c39e8215196a95ce3375dee7cb413b3a9b6f8e958fa8a3462d2b752c10e7544aefbeb4f2400119c3780d7f8a3ac3
|
7
|
+
data.tar.gz: 9e508ece749fe38479b92ce3331d1711e55248524b76cd2945c8f45d15c52a2b3c1d243a3b2ef76e5a7c58aa315e845a1b6888bbd7bccce41299843df2a4dc92
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,7 @@ module BlsmVdCore
|
|
6
6
|
has_many :applications, class_name: "::BlsmVdCore::Application"
|
7
7
|
has_many :clearings, class_name: "::BlsmVdCore::Clearing"
|
8
8
|
has_one :vd_user_info, class_name: "::BlsmVdCore::VdUserInfo"
|
9
|
+
belongs_to :rc_user, class_name: "::BlsmVdCore::RcUser"
|
9
10
|
|
10
11
|
def create_vd_user_info
|
11
12
|
unless self.vd_user_info
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module BlsmVdCore
|
3
|
+
class VdRcMsgNotify < BlsmVdCore::BaseRecord
|
4
|
+
self.table_name = 'vd_rc_msg_notifies'
|
5
|
+
|
6
|
+
TO_TYPES = {
|
7
|
+
'single' => '指定首趣昵称',
|
8
|
+
'vd_team' => '指定黑带团队'
|
9
|
+
}
|
10
|
+
|
11
|
+
MSG_TYPES = {
|
12
|
+
'RC:TxtMsg' => '文本消息',
|
13
|
+
'CU:ImgTextMsg' => '图文消息',
|
14
|
+
'CU:MoreImgTextMsg' => '多图文消息',
|
15
|
+
'CU:TemplateMsg' => '模板消息'
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
# 店主:新订单通知
|
20
|
+
def self.create_new_order_notify(user_id, order_id)
|
21
|
+
user = BlsmVdCore::User.where(id: user_id).first
|
22
|
+
order = Order.where(id: order_id).first
|
23
|
+
return nil unless order && user && user.rc_user
|
24
|
+
|
25
|
+
BlsmVdCore::VdRcMsgNotify.create({
|
26
|
+
user_id: 3,
|
27
|
+
to_ids: user.username,
|
28
|
+
to_type: 'single',
|
29
|
+
msg_type: 'CU:TemplateMsg',
|
30
|
+
title: '新订单通知',
|
31
|
+
content: {
|
32
|
+
title: '新订单通知',
|
33
|
+
content: {
|
34
|
+
body: "您好,客户#{order.ubox_order? ? '' : order.name}在您店里下了一个订单,请及时处理。"
|
35
|
+
},
|
36
|
+
items: [
|
37
|
+
"下单时间:#{order.created_at.to_s[0, 16]}",
|
38
|
+
"支付方式:#{order.pay_type.to_i==0 ? '在线支付' : '货到付款'}",
|
39
|
+
"客户信息:#{order.ubox_order? ? "售货机#{order.ubox_vmid}扫码用户" : "#{order.shipping_province} #{order.name} #{order.phone}"}",
|
40
|
+
"买家留言:#{order.comment}"
|
41
|
+
],
|
42
|
+
url: "http://wunion.4007060700.com/mobile/jms_orders/#{order.to_param}"
|
43
|
+
}.to_json
|
44
|
+
})
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
#创建结算通知
|
50
|
+
# msg_content['content'] 标题内容
|
51
|
+
# msg_content['change'] 结算金额
|
52
|
+
# msg_content['account_type'] 账户类型
|
53
|
+
# msg_content['total'] 账户总余额
|
54
|
+
def self.create_account_change_notify(user_id, msg_content)
|
55
|
+
user = BlsmVdCore::User.where(id: user_id).first
|
56
|
+
return nil unless user && user.rc_user
|
57
|
+
|
58
|
+
msg_content = msg_content.symbolize_keys
|
59
|
+
BlsmVdCore::VdRcMsgNotify.create({
|
60
|
+
user_id: 3,
|
61
|
+
to_ids: user.username,
|
62
|
+
to_type: 'single',
|
63
|
+
msg_type: 'CU:TemplateMsg',
|
64
|
+
title: '结算通知',
|
65
|
+
content: {
|
66
|
+
title: '结算通知',
|
67
|
+
content: {
|
68
|
+
body: msg_content[:content]
|
69
|
+
},
|
70
|
+
items: [
|
71
|
+
"结算账户:#{user.phone}",
|
72
|
+
"结算时间:#{Time.now.strftime('%F')}",
|
73
|
+
"结算金额:#{msg_content[:change]}",
|
74
|
+
"#{msg_content[:account_type]}余额:#{msg_content[:total]}",
|
75
|
+
"备注:感谢您对首趣一如既往的支持,商城客户热线4007060700!"
|
76
|
+
],
|
77
|
+
url: 'http://wunion.4007060700.com/mobile/jms_orders'
|
78
|
+
}.to_json
|
79
|
+
})
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
#创建订单拒签通知
|
85
|
+
def self.create_order_sign_fail_notify(user_id, score_change, order_number, content)
|
86
|
+
user = BlsmVdCore::User.where(id: user_id).first
|
87
|
+
return nil unless user && user.rc_user
|
88
|
+
|
89
|
+
|
90
|
+
BlsmVdCore::VdRcMsgNotify.create({
|
91
|
+
user_id: 3,
|
92
|
+
to_ids: user.username,
|
93
|
+
to_type: 'single',
|
94
|
+
msg_type: 'CU:TemplateMsg',
|
95
|
+
title: '订单拒签、取消通知',
|
96
|
+
content: {
|
97
|
+
title: '订单拒签、签收通知',
|
98
|
+
content: {
|
99
|
+
body: content
|
100
|
+
},
|
101
|
+
items: [
|
102
|
+
"订单编号:#{order_number}",
|
103
|
+
"积分变动:#{score_change}",
|
104
|
+
"积分余额:#{user.create_vd_user_info.score}"
|
105
|
+
],
|
106
|
+
url: 'http://wunion.4007060700.com/mobile/jms_orders'
|
107
|
+
}.to_json
|
108
|
+
})
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
data/lib/blsm-vd-core/version.rb
CHANGED
data/lib/blsm-vd-core.rb
CHANGED
@@ -18,6 +18,8 @@ require 'blsm-vd-core/model/vd_user_info'
|
|
18
18
|
require 'blsm-vd-core/model/vd_user_score'
|
19
19
|
require 'blsm-vd-core/model/vd_info_sec'
|
20
20
|
require 'blsm-vd-core/model/vd_wx_pay'
|
21
|
+
require 'blsm-vd-core/model/vd_rc_msg_notify'
|
22
|
+
require 'blsm-vd-core/model/rc_user'
|
21
23
|
require 'blsm-vd-core/model/user'
|
22
24
|
require 'blsm-vd-core/model/application'
|
23
25
|
require 'faraday'
|
@@ -386,15 +388,20 @@ module BlsmVdCore
|
|
386
388
|
# seller_info = seller.create_vd_user_info
|
387
389
|
# leader_info = leader && leader.is_vd_black? ? leader.create_vd_user_info : nil
|
388
390
|
|
389
|
-
content = "您的订单(编号#{order.number})
|
391
|
+
content = "您的订单(编号#{order.number})客户先签收后又取消。"
|
390
392
|
VdUserScore.where(score_type: score_type_str).each do |score|
|
391
393
|
score_change = -score.score
|
392
394
|
if score.user && !order.ubox_order? && score_change!=0
|
393
395
|
score.user.create_vd_user_info.change_score(score_change)
|
394
396
|
|
395
|
-
content = "您的队员#{seller.username}的订单(订单编号#{order.number})
|
397
|
+
content = "您的队员#{seller.username}的订单(订单编号#{order.number})客户先签收后又取消。" if seller.id != score.user.id
|
396
398
|
notify = {touser: score.user.openid, change: score_change, total: score.user.create_vd_user_info.score, content: "变动原因:#{content}"}
|
399
|
+
|
400
|
+
#变动通知
|
397
401
|
BlsmMpWx.create_msg(nil, score.user.openid, notify, 'score_change')
|
402
|
+
VdRcMsgNotify.create_order_sign_fail_notify(score.user_id, score_change, order.number, content)
|
403
|
+
|
404
|
+
#积分历史
|
398
405
|
VdUserScore.create({
|
399
406
|
user_id: score.user_id,
|
400
407
|
score: score_change,
|
@@ -433,16 +440,24 @@ module BlsmVdCore
|
|
433
440
|
vd_transaction = "order_sale_out_#{seller_id}_#{order_id}_then_sign_fail"
|
434
441
|
return ERROR_CODES[200] if VdInfoSec.dangerous?(vd_transaction)
|
435
442
|
|
443
|
+
content = "您的订单(编号#{order.number})客户先签收后又拒签。"
|
436
444
|
VdUserScore.where(score_type: score_type_str).each do |score|
|
437
445
|
score_change = -score.score
|
438
446
|
if score.user && !order.ubox_order?
|
439
447
|
score.user.create_vd_user_info.change_score(score_change)
|
440
|
-
|
448
|
+
|
449
|
+
content = "您的队员#{seller.username}的订单(订单编号#{order.number})客户先签收后又拒签。" if seller.id != score.user.id
|
450
|
+
notify = {touser: score.user.openid, change: score_change, total: score.user.create_vd_user_info.score, content: content}
|
451
|
+
|
452
|
+
#变动通知
|
441
453
|
BlsmMpWx.create_msg(nil, score.user.openid, notify, 'score_change')
|
454
|
+
VdRcMsgNotify.create_order_sign_fail_notify(score.user_id, score_change, order.number, content)
|
455
|
+
|
456
|
+
#积分历史
|
442
457
|
VdUserScore.create({
|
443
458
|
user_id: score.user_id,
|
444
459
|
score: score_change,
|
445
|
-
notes:
|
460
|
+
notes: content,
|
446
461
|
score_type: vd_transaction
|
447
462
|
})
|
448
463
|
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.
|
4
|
+
version: 0.7.0
|
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-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -192,9 +192,11 @@ 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/rc_user.rb
|
195
196
|
- lib/blsm-vd-core/model/ubox_vm.rb
|
196
197
|
- lib/blsm-vd-core/model/user.rb
|
197
198
|
- lib/blsm-vd-core/model/vd_info_sec.rb
|
199
|
+
- lib/blsm-vd-core/model/vd_rc_msg_notify.rb
|
198
200
|
- lib/blsm-vd-core/model/vd_user_info.rb
|
199
201
|
- lib/blsm-vd-core/model/vd_user_score.rb
|
200
202
|
- lib/blsm-vd-core/model/vd_wx_pay.rb
|