class BlsmVdCore::VdRcMsgNotify

Constants

MSG_TYPES
TO_TYPES

Public Class Methods

create_account_change_notify(user_id, body, money, account_type, total, url='http://m.shouqu360.com/mobile/my_clearings') click to toggle source

创建结算通知

msg_content['content'] 标题内容
msg_content['change'] 结算金额
msg_content['account_type'] 账户类型
msg_content['total']  账户总余额
# File lib/blsm-vd-core/model/vd_rc_msg_notify.rb, line 147
def self.create_account_change_notify(user_id, body, money, account_type, 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}",
                                               "#{account_type}余额:#{total}",
                                               "备注:感谢您对首趣一如既往的支持,商城客户热线4007060700!"
                                           ],
                                           url: url
                                       }.to_json
                                   })

end
create_cashback_notify(user_id, order_id) click to toggle source

店主: 物流返款通知

# 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) click to toggle source

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

# 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) click to toggle source

店主:新订单通知

# 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) click to toggle source

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

# 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) click to toggle source

创建订单拒签通知

# 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.create_vd_user_info.score}"
                                           ],
                                           url: 'http://m.shouqu360.com/mobile/jms_orders'
                                       }.to_json
                                   })

end
create_order_sign_fans_notify(user_id, reward_money, order_number, body) click to toggle source

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

# 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') click to toggle source

创建积分变动通知

msg_content['content'] 标题内容
msg_content['change'] 结算金额
msg_content['account_type'] 账户类型
msg_content['total']  账户总余额
# File lib/blsm-vd-core/model/vd_rc_msg_notify.rb, line 180
def self.create_score_change_notify(user_id, body, change, account_type, 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}",
                                                   "#{account_type}余额:#{total}",
                                                   "备注:感谢您对首趣一如既往的支持,商城客户热线4007060700!"
                                           ],
                                           url: url
                                       }.to_json
                                   })

end
create_split_order_notify(user_id, order_id) click to toggle source

店主:拆分订单通知

# 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