Onex ecstore发站内信/邮件/短信-列队

/ 0评 / 1

####Onex ecstore发站内信/邮件/短信-列队实现方法如下:

###################发站内信-列队#########################

function send_yuyuefukuan_notice($sdf_order){
$data = array(
'order_id'=>$sdf_order['order_id'],
'to_pay'=>$sdf_order['presell_price']
);
$tmpl_name = 'messenger:b2c_messenger_msgbox/order-yuyuefukuan';
$this->_systmpl = &$this->app->model('member_systmpl');
$content = $this->_systmpl->fetch($tmpl_name,$data);
$params = array(
'member_id' => $sdf_order['member_id'],
'data' => array(
'title'=>'预售后台尾款支付通知',
'content'=>$content,
),
);
$msql = "insert into sdb_system_queue_mysql (queue_name,worker,params,create_time,owner_thread_id) values(
'quick',
'b2c_tasks_sendmsg',
'".serialize($params)."',
'".mktime()."',
'-1'
)";
$db = kernel::database();
$db->exec($msql);
$db->commit();
}

#########################发邮件-列队#########################

function send_yuyuefukuan_email($sdf_order){
$data = array(
'order_id'=>$sdf_order['order_id'],
'to_pay'=>$sdf_order['presell_price']
);
$tmpl_name = 'messenger:b2c_messenger_email/order-yuyuefukuan';
$this->_systmpl = &$this->app->model('member_systmpl');
$content = $this->_systmpl->fetch($tmpl_name,$data);
$sql = "select * from sdb_pam_members where member_id = '".$sdf_order['member_id'] ."' and login_type='email'";
$tmp = $this->_systmpl->db->selectrow($sql);
if(!$tmp){
return false;
}
$params = array(
'acceptor' => $tmp['login_account'],
'body'=>$content,
'title'=>'预售后台尾款支付通知',
);
$msql = "insert into sdb_system_queue_mysql (queue_name,worker,params,create_time,owner_thread_id) values(
'quick',
'b2c_tasks_sendemail',
'".serialize($params)."',
'".mktime()."',
'-1'
)";
$db = kernel::database();
$db->exec($msql);
$db->commit();
}

#########################发短信-列队#########################

function send_yuyuefukuan_sms($sdf_order){
//要替换模板里的数据
$data = array(
'order_id'=>$sdf_order['order_id'],
'to_pay'=>$sdf_order['presell_price']
);

//模板内容替换
$tmpl_name = 'messenger:b2c_messenger_sms/order-yuyuefukuan';
$this->_systmpl = &$this->app->model('member_systmpl');
$content = $this->_systmpl->fetch($tmpl_name,$data);
$mobile = $sdf_order['consignee']['mobile'];
//短信发送数组
$params = array(
'mobile_number' => $mobile,
'data' => array(
'sendType'=>'fan-out',
'content'=>$content,
'use_reply'=>false
),
);
//加入列队数据库
$msql = "insert into sdb_system_queue_mysql (queue_name,worker,params,create_time,owner_thread_id) values(
'quick',
'b2c_tasks_sendsms',
'".serialize($params)."',
'".mktime()."',
'-1'
)";
$db = kernel::database();
$db->exec($msql);
$db->commit();

}

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注