Onex ecstore直接发站内信方法

/ 0评 / 2

Onex ecstore直接发站内信方法实现如下:

by-阿彪

@经纪人:  875358601@qq.com @DateTime:  2016-12-04 10:54:20


$sender ='b2c_messenger_msgbox';
$tmpl='prepare-reminded';
$tmpl_name ='messenger:'.$sender .'/'.$tmpl;
$target = $member_id;//要发送给的会员ID
$sendType='notice';//对应的编辑框窗口。notice 模板不可编辑 fan-out 可编辑
$data =array(
'goodsname'=>$value['goodsname'],
'goodsurl'=>$value['goodsurl'],
'begin_time_final'=>date('Y-m-d H:i',time()),
);
$objMessage=app::get('b2c')->model('member_messenger');
$objClass= $objMessage->_load($sender);
$objMessage->_ready($objClass);
if(!$objMessage->_systmpl){
$objMessage->_systmpl =app::get('b2c')->model('member_systmpl');
}
//内容替换
$content = $objMessage->_systmpl->fetch($tmpl_name,$data);

$tile = $objMessage->loadTitle($tmpl,$sender ,'',$data);
$service = kernel::service("b2c.messenger.fireEvent_content");
if(is_object($service))
{
if(method_exists($service,'get_content'))
$content = $service->get_content($content);
$tile = $service->get_content($tile);
}
if($tile=='')
{
$tile = app::get('site')->getConf('site.name');
}
$objClass->config['shopname'] = app::get('site')->getConf('site.name');
$objClass->config['sendType'] = $sendtype;
$objClass->config['specialChannel'] = false;

$objClass->send($target,$tile,$content,$objClass->config);

#######################简单的写法###################################


$sdf=array(
'sendMethod'=>'b2c_messenger_msgbox',
'tmpl_name'=>'messenger:b2c_messenger_msgbox/prepare-reminded',
'type'=>'prepare-reminded',
'sendType'=>'notice',
);
$sdf['target'] = $this->app->member_id;
$sdf['data'] = array(
'goodsname'=>'yinduo',
'goodsurl'=>'www.baidu.com',
'begin_time_final'=>date('Y-m-d H:i',mktime()),
'shopname'=>app::get('site')->getConf('site.name'),
);
app::get('b2c')->model('member_messenger')->queue_send($sdf);

发表评论

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