Class: BlsmVdCore::VdRcMsgNotify

Inherits:
BaseRecord
  • Object
show all
Defined in:
lib/blsm-vd-core/model/vd_rc_msg_notify.rb

Constant Summary collapse

TO_TYPES =
{
    'single' => '指定首趣昵称',
    'vd_team' => '指定黑带团队'
}
MSG_TYPES =
{
    'RC:TxtMsg' => '文本消息',
    'CU:ImgTextMsg' => '图文消息',
    'CU:MoreImgTextMsg' => '多图文消息',
    'CU:TemplateMsg' => '模板消息'
}

Class Method Summary collapse

Class Method Details

.create_account_change_notify(user_id, body, money, account_type, total, url = 'http://m.shouqu360.com/mobile/my_clearings') ⇒ Object

创建结算通知

msg_content['content'] 标题内容
msg_content['change'] 结算金额
msg_content['account_type'] 账户类型
msg_content['total']  账户总余额


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 147

def self.(user_id, body, money, , total, url='http://m.shouqu360.com/mobile/my_clearings')
  user = BlsmVdCore::User.where(id: user_id).first
  return nil unless user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '账户资金变动通知',
                                       content: {
                                           title: '账户资金变动通知',
                                           content: {
                                               body: body
                                           },
                                           items: [
                                               "变动时间:#{Time.now.strftime('%F')}",
                                               "变动金额:#{money}",
                                               "#{}余额:#{total}",
                                               "备注:感谢您对首趣一如既往的支持,商城客户热线4007060700!"
                                           ],
                                           url: url
                                       }.to_json
                                   })

end

.create_cashback_notify(user_id, order_id) ⇒ Object

店主: 物流返款通知



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 112

def self.create_cashback_notify(user_id, order_id)
  user = BlsmVdCore::User.where(id: user_id).first
  order = Order.where(id: order_id).first
  return nil unless order && user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '物流返款通知',
                                       content: {
                                           title: '物流返款通知',
                                           content: {
                                               title: '返款金额',
                                               body: "#{order.pay_type.to_i==0 ? order.total_fee : order.actual_total}"
                                           },
                                           items: [
                                               "订单编号:#{order.number}",
                                               "下单时间:#{order.created_at.to_s[0, 16]}",
                                               "订单金额:#{order.total_fee}",
                                               "预计收入:#{order.jm_profit}"
                                           ],
                                           url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}/only_show?change=√"
                                       }.to_json
                                   })

end

.create_distribute_notify(user_id, order_id, title, score) ⇒ Object

黑带: 店主确认新订单通知



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 81

def self.create_distribute_notify(user_id, order_id, title, score)
  user = BlsmVdCore::User.where(id: user_id).first
  order = Order.where(id: order_id).first
  return nil unless order && user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '店主确认订单通知',
                                       content: {
                                           title: '店主确认订单通知',
                                           content: {
                                               body: title
                                           },
                                           items: [
                                               "订单编号:#{order.number}",
                                               "下单时间:#{order.created_at.to_s[0, 16]}",
                                               "订单金额:#{order.total_fee}",
                                               "预收积分:#{score}",
                                               "备注:订单签收后您会获取相应积分"
                                           ],
                                           url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}/only_show"
                                       }.to_json
                                   })

end

.create_new_order_notify(user_id, order_id) ⇒ Object

店主:新订单通知



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 19

def self.create_new_order_notify(user_id, order_id)
  user = BlsmVdCore::User.where(id: user_id).first
  order = Order.where(id: order_id).first
  return nil unless order && user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '新订单通知',
                                       content: {
                                           title: '新订单通知',
                                           content: {
                                               body: "您好,客户#{order.ubox_order? ? '' : order.name}在您店里下了一个订单,请及时处理。"
                                           },
                                           items: [
                                               "订单编号:#{order.number}",
                                               "下单时间:#{order.created_at.to_s[0, 16]}",
                                               "支付方式:#{order.pay_type.to_i==0 ? '在线支付' : '货到付款'}",
                                               "客户信息:#{order.ubox_order? ? "售货机#{order.ubox_vmid}扫码用户" : "#{order.shipping_province} #{order.name} #{order.phone}"}",
                                               "买家留言:#{order.comment}"
                                           ],
                                           url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}"
                                       }.to_json
                                   })

end

.create_order_finish_notify(username) ⇒ Object

客户签收后,该怎么维护老客户?



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 263

def self.create_order_finish_notify(username)
  vd_rc_msg = VdRcMsgNotify.where(:to_ids=>username,:title=>"维护客户提醒").where("left(created_at,10)='#{Time.now.strftime("%F")}'").first
  if vd_rc_msg.blank?   #每天最多发送一条
    VdRcMsgNotify.create({user_id: 3,
                          to_ids: username,
                          title: "维护客户提醒",
                          to_type: 'single',
                          msg_type: 'CU:ImgTextMsg',
                          content: {
                              title: "维护客户提醒",
                              content: "客户签收后,该怎么维护老客户?",
                              imageUri: "http://image.yepcolor.com/images/20161110/11.png",
                              url: "http://shouqu360.cn/articles/f9e914902209c7f39595da5facbe75ce?ak=70cc889e",
                              extra: "维护客户提醒"
                          }.to_json})
  end
end

.create_order_sign_fail_notify(user_id, score_change, order_number, body) ⇒ Object

创建订单拒签通知



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 208

def self.create_order_sign_fail_notify(user_id, score_change, order_number, body)
  user = BlsmVdCore::User.where(id: user_id).first
  return nil unless user && user.rc_user


  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '订单拒签、取消通知',
                                       content: {
                                           title: '订单拒签、签收通知',
                                           content: {
                                               body: body
                                           },
                                           items: [
                                               "订单编号:#{order_number}",
                                               "积分变动:#{score_change}",
                                               "积分余额:#{user..score}"
                                           ],
                                           url: 'http://m.shouqu360.com/mobile/jms_orders'
                                       }.to_json
                                   })

end

.create_order_sign_fans_notify(user_id, reward_money, order_number, body) ⇒ Object

创建订单签收、积分加粉充值



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 237

def self.create_order_sign_fans_notify(user_id, reward_money, order_number, body)
  user = BlsmVdCore::User.where(id: user_id).first
  return nil unless user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '订单签收-粉丝推广奖励',
                                       content: {
                                           title: '订单签收-粉丝推广奖励',
                                           content: {
                                               body: body
                                           },
                                           items: [
                                               "订单编号:#{order_number}",
                                               "奖励金额:#{reward_money}"
                                           ],
                                           url: 'http://m.shouqu360.com/mobile/user_spreads'
                                       }.to_json
                                   })

end

.create_score_change_notify(user_id, body, change, account_type, total, url = 'http://m.shouqu360.com/mobile/my_scores') ⇒ Object

创建积分变动通知

msg_content['content'] 标题内容
msg_content['change'] 结算金额
msg_content['account_type'] 账户类型
msg_content['total']  账户总余额


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 180

def self.create_score_change_notify(user_id, body, change, , total, url='http://m.shouqu360.com/mobile/my_scores')
  user = BlsmVdCore::User.where(id: user_id).first
  return nil unless user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '积分变动通知',
                                       content: {
                                           title: '积分变动通知',
                                           content: {
                                               body: body
                                           },
                                           items: ["账户名称:#{user.phone}",
                                                   "增加积分:#{change}",
                                                   "#{}余额:#{total}",
                                                   "备注:感谢您对首趣一如既往的支持,商城客户热线4007060700!"
                                           ],
                                           url: url
                                       }.to_json
                                   })

end

.create_split_order_notify(user_id, order_id) ⇒ Object

店主:拆分订单通知



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/blsm-vd-core/model/vd_rc_msg_notify.rb', line 50

def self.create_split_order_notify(user_id, order_id)
  user = BlsmVdCore::User.where(id: user_id).first
  order = Order.where(id: order_id).first
  return nil unless order && user && user.rc_user

  BlsmVdCore::VdRcMsgNotify.create({
                                       user_id: 3,
                                       to_ids: user.username,
                                       to_type: 'single',
                                       msg_type: 'CU:TemplateMsg',
                                       title: '拆分订单通知',
                                       content: {
                                           title: '拆分订单通知',
                                           content: {
                                               body: "您好,订单#{order.number}根据发货地不同拆分为多个订单,请及时处理。"
                                           },
                                           items: [
                                               "订单编号:#{order.number}",
                                               "下单时间:#{order.created_at.to_s[0, 16]}",
                                               "支付方式:#{order.pay_type.to_i==0 ? '在线支付' : '货到付款'}",
                                               "客户信息:#{order.ubox_order? ? "售货机#{order.ubox_vmid}扫码用户" : "#{order.shipping_province} #{order.name} #{order.phone}"}",
                                               "买家留言:#{order.comment}"
                                           ],
                                           url: "http://m.shouqu360.com/mobile/jms_orders/#{order.to_param}"
                                       }.to_json
                                   })

end