'dingdanhao', 'name' => '订 单 号', 'value' => '{订单号}','br'=>''),
array('id' => 'kaipiaoshijian', 'name' => '开票时间', 'value' => '{开票时间}','br'=>'
'),
array('id' => 'fapiaohaoma', 'name' => '发票号码', 'value' => '{发票号码}','br'=>''),
array('id' => 'kaipiaofangmingcheng', 'name' => '开票方名称', 'value' => '{开票方名称}','br'=>'
'),
array('id'=>'msgsign','name'=>'短信签名','value'=>'{短信签名}','br'=>''),
array('id' => 'recovery', 'name' => '恢复默认', 'value' => $this->_tmplContent,'br'=>'
','img'=>kernel::base_url(1).'/app/desktop/statics/bundle/afresh.gif'),
);
}
/**
* 检查Params
* @param mixed $params 参数
* @param mixed $error_msg error_msg
* @return mixed 返回验证结果
*/
public function checkParams(&$params, &$error_msg){
if(!$params["order_bn"] || !$params["billing_time"] || !$params["invoice_no"] || !$params["payee_name"]){
$error_msg = '订单号/开票时间/发票号码/开票方名称不能为空';
return false;
}
return true;
}
/**
* formatContent
* @param mixed $params 参数
* @param mixed $sendParams 参数
* @param mixed $error_msg error_msg
* @return mixed 返回值
*/
public function formatContent($params, &$sendParams, &$error_msg){
//获取短信模板内容
$rule_sample_mdl = app::get('taoexlib')->model('sms_bind');
if(!$content){
$contentinfo = $rule_sample_mdl->getOtherSmsContent('einvoice');
if (!$contentinfo['content']) {
$error_msg = '短信模板未设置或未审核通过';
return false;
}else{
$content = $contentinfo['content'];
$sendParams["tplid"] = $contentinfo['tplid'];
}
}
//临时变量
$order_bn = $params['order_bn'];
$billing_time = $params['billing_time'];
$invoice_no = $params['invoice_no'];
$payee_name = $params['payee_name'];
$store_name = $params['store_name'];
$helper = kernel::single('base_view_helper');
$sendParams['phones'] = $params["telephone"];
$sendParams['order_bn'] = $order_bn;
$sendParams['replace'] = array(
'orderstr' => $helper->str_mosaic($order_bn, '*', true, 2, 4),
'billing_time' => $billing_time,
'invoice_no' => $invoice_no,
'payee_name' => $payee_name,
'msgsign' => "【".$store_name."】",
);
//替换签名 获取完整短信日志content
$find = array('{订单号}','{开票时间}','{发票号码}','{开票方名称}','{短信签名}');
$replace = array($helper->str_mosaic($order_bn, '*', true, 2, 4),$billing_time,$invoice_no,$payee_name,$sendParams['replace']['msgsign']);
//获取短信日志content
$sendParams['content'] = str_replace($find,$replace,$content);
return true;
}
}