本文整理汇总了PHP中SMS::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP SMS::getCode方法的具体用法?PHP SMS::getCode怎么用?PHP SMS::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMS
的用法示例。
在下文中一共展示了SMS::getCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendcouponAction
function sendcouponAction()
{
$this->_helper->layout->setLayout("layout_coupon");
$currentTime = date("Y-m-d H:i:s");
$endTime = date("Y年m月d日", strtotime("+7 day"));
$couponId = (int) $this->_request->getParam('uid');
//$message = $this->getCouponById($couponId);
//var_dump($_SERVER['HTTP_REFERER']);die;
$lou = 0;
if (isset($_SERVER['HTTP_REFERER']) && preg_match('/19lou/', $_SERVER['HTTP_REFERER'])) {
$lou = 1;
$_SESSION['19lou'] = 1;
}
if (isset($_SESSION['19lou'])) {
$lou = 1;
}
//var_dump($_SESSION);die;
$this->view->message = array();
$this->view->coupon = $couponId;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if (trim($formData['username']) == '') {
$this->view->message['username'] = '姓名不能为空。';
}
if (trim($formData['telephone']) == '') {
$this->view->message['telephone'] = '手机号码不能为空。';
}
if (trim($couponId) == '') {
$this->view->message['coupon'] = '没有对应的优惠券。';
}
$this->view->postData = $formData;
if (trim($formData['telephone']) != '' && $this->validateSend($formData['telephone'], $couponId, $lou)) {
$this->view->message['got'] = '已经领取优惠券或同一天固定IP只能领取一份。';
}
//print_r($formData);die;
if (!count($this->view->message)) {
$newclient = new SMS();
if ($newclient->ConfNull == "1") {
$mobile = $formData['telephone'];
$message = $this->getCouponById($couponId);
$time = $currentTime;
//echo str_replace('{date}',$endTime,$message['content']);die;
$apitype = 3;
// $apitype 通道选择 0:默认通道; 2:通道2; 3:即时通道;
$msg = iconv("UTF-8", "GB2312", str_replace('{date}', $endTime, $message['content']));
// Zend_Debug::dump($msg);
$respxml = $newclient->sendSMS($mobile, $msg, $time, $apitype);
//print_r($newclient->sendXML);die();
$smsSpace = new Zend_Session_Namespace('SMS');
$smsSpace->xml = $newclient->sendXML;
$smsSpace->respxml = $respxml;
$this->view->code = $newclient->getCode();
if ($this->view->code == 2000) {
$this->view->message['susess'] = "成功领取优惠券.";
//add the coupon history
$db = Zend_Registry::get('db');
$insetSql = $db->prepare("insert into coupon_history(telephone,ip,crdate,cuid) values ('{$formData['telephone']}','{$_SERVER['REMOTE_ADDR']}','{$currentTime}',{$couponId})");
$insetSql->execute();
} else {
$this->view->message['telephone'] = '手机号码可能不正确。';
}
} else {
$this->view->message['fail'] = "失败";
$this->view->message['noconfig'] = "你还没有配置文件";
}
}
}
}