|
@@ -10,18 +10,9 @@ defined('InShopNC') or exit('Access Invalid!');
|
|
|
|
|
|
class Sms
|
|
|
{
|
|
|
- const register_code = 1;
|
|
|
- const resetpass_code = 2;
|
|
|
- const getbonus_code = 3;
|
|
|
- const getbind_code = 4;
|
|
|
- const newcomer_code = 5;
|
|
|
- const newcomer_bonus_code = 6;
|
|
|
- const order_sended = 7;
|
|
|
- const order_received = 8;
|
|
|
- const getfcode_code = 9;
|
|
|
- const after_comment = 10;
|
|
|
-
|
|
|
- const tpl_reg_user_bonus = '219562'; //亲爱的用户,您已获得{1}元新人首单红包,请登陆APP查收!退订回复N
|
|
|
+ const register_code = 1; //todo 只有h5_hb.php文件,调用了此
|
|
|
+
|
|
|
+ const tpl_reg_user_bonus = '756830'; //亲爱的用户,您已获得{1}元新人首单红包,请登陆APP查收!退订回复N
|
|
|
const tpl_reg_inviter = '219559'; //亲爱的会员,{1}成为您的{2}度粉丝,您获得{3}元全抵红包。退订回复N
|
|
|
const tpl_reg_invitee = '219558'; //亲爱的会员,您的好友{1}成为{2}的{3}度粉丝,您获得{4}元雨露均沾红包。退订回复N
|
|
|
const tpl_order_complete_all = '219557'; //亲爱的会员,{1}下单成功,引发红包风暴,{2}元全抵红包砸中了你。快去查看红包余额!退订回复N
|
|
@@ -37,16 +28,18 @@ class Sms
|
|
|
*/
|
|
|
public function send($mobile, $content)
|
|
|
{
|
|
|
- $mobile_host_type = C('mobile_host_type');
|
|
|
- if ($mobile_host_type == 1) {
|
|
|
- return $this->mysend_smsbao($mobile, $content);
|
|
|
- } elseif ($mobile_host_type == 2) {
|
|
|
- return $this->mysend_yunpian($mobile, $content);
|
|
|
- } elseif ($mobile_host_type == 3) {
|
|
|
- return $this->mysend_yuntx($mobile, $content);
|
|
|
- } elseif ($mobile_host_type == 4) {
|
|
|
- return $this->send_yunpian($mobile, $content);
|
|
|
- }
|
|
|
+ return $this->mysend_yuntx($mobile, $content);
|
|
|
+
|
|
|
+// $mobile_host_type = C('mobile_host_type');
|
|
|
+// if ($mobile_host_type == 1) {
|
|
|
+// return $this->mysend_smsbao($mobile, $content);
|
|
|
+// } elseif ($mobile_host_type == 2) {
|
|
|
+// return $this->mysend_yunpian($mobile, $content);
|
|
|
+// } elseif ($mobile_host_type == 3) {
|
|
|
+// return $this->mysend_yuntx($mobile, $content);
|
|
|
+// } elseif ($mobile_host_type == 4) {
|
|
|
+// return $this->send_yunpian($mobile, $content);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private function send_msg($mobile, $datas, $type)
|
|
@@ -59,7 +52,7 @@ class Sms
|
|
|
require_once(PLUGIN_ROOT . DS . $plugin . DS . 'CCPRestSDK.php');
|
|
|
require_once(PLUGIN_ROOT . DS . $plugin . DS . 'SendSMS.php');
|
|
|
|
|
|
- $datas_param = array();
|
|
|
+ $datas_param = [];
|
|
|
foreach($datas as $key=>$val)
|
|
|
{
|
|
|
$datas_param[] = $val;
|
|
@@ -86,27 +79,34 @@ class Sms
|
|
|
*/
|
|
|
private function mysend_yuntx($mobile, $content)
|
|
|
{
|
|
|
- $type = intval($content['type']);
|
|
|
-
|
|
|
- static $templates = [
|
|
|
- self::register_code => '59006',
|
|
|
- self::resetpass_code => '63477',
|
|
|
- self::getbonus_code => '63479',
|
|
|
- self::getbind_code => '59006',
|
|
|
- self::newcomer_code => '92893',
|
|
|
- self::newcomer_bonus_code => '146196',
|
|
|
- self::order_sended => '355420', //【熊猫美妆】尊敬的会员,您的订单已发货,{1}运单号为{2},详细订单信息请登陆APP查看。
|
|
|
- self::order_received => '355421', //【熊猫美妆】您已确认收货,订单奖励红包已到账。评价商品还能领更多红包噢~
|
|
|
- self::getfcode_code => '166281',
|
|
|
- self::after_comment => '355423', //【熊猫美妆】感谢您对商品的评价,{1}元红包已到账!您的意见对我们至关重要~
|
|
|
- ];
|
|
|
-
|
|
|
- if (!array_key_exists($type, $templates)) {
|
|
|
- Log::record("mysend_yuntx type error}",Log::ERR);
|
|
|
+ $type = $this->getYuntxTpl(intval($content['type']));
|
|
|
+ if(empty($type)) {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- return $this->send_msg($mobile, $content['datas'], $templates[$type]);
|
|
|
+ return $this->send_msg($mobile, $content['datas'], $type);
|
|
|
+ }
|
|
|
+
|
|
|
+ private function getYuntxTpl($type)
|
|
|
+ {
|
|
|
+ static $sms_tpls = [
|
|
|
+ 'register' => '756830',
|
|
|
+ 'resetpass' => '63477'
|
|
|
+// self::getbonus_code => '63479',
|
|
|
+// self::getbind_code => '59006',
|
|
|
+// self::newcomer_code => '92893',
|
|
|
+// self::newcomer_bonus_code => '146196',
|
|
|
+// self::order_sended => '355420', //【熊猫美妆】尊敬的会员,您的订单已发货,{1}运单号为{2},详细订单信息请登陆APP查看。
|
|
|
+// self::order_received => '355421', //【熊猫美妆】您已确认收货,订单奖励红包已到账。评价商品还能领更多红包噢~
|
|
|
+// self::getfcode_code => '166281',
|
|
|
+// self::after_comment => '355423', //【熊猫美妆】感谢您对商品的评价,{1}元红包已到账!您的意见对我们至关重要~
|
|
|
+ ];
|
|
|
+ if($type == sms_helper::register) {
|
|
|
+ return $sms_tpls['register'];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function send_oper($mobile,$type,$params = null)
|
|
@@ -130,26 +130,26 @@ class Sms
|
|
|
51:手机号码不正确
|
|
|
http://api.smsbao.com/sms?u=USERNAME&p=PASSWORD&m=PHONE&c=CONTENT
|
|
|
*/
|
|
|
- private function mysend_smsbao($mobile, $content)
|
|
|
- {
|
|
|
- $user_id = urlencode(C('mobile_username')); // 这里填写用户名
|
|
|
- $pass = urlencode(C('mobile_pwd')); // 这里填登陆密码
|
|
|
- if (!$mobile || !$content || !$user_id || !$pass) return false;
|
|
|
- if (is_array($mobile)) $mobile = implode(",", $mobile);
|
|
|
- $mobile = urlencode($mobile);
|
|
|
- //$content=$content."【我的网站】";
|
|
|
- $content = urlencode($content);
|
|
|
- $pass = md5($pass);//MD5加密
|
|
|
- $url = "http://api.smsbao.com/sms?u=" . $user_id . "&p=" . $pass . "&m=" . $mobile . "&c=" . $content . "";
|
|
|
- $res = file_get_contents($url);
|
|
|
- //return $res;
|
|
|
- $ok = $res == "0";
|
|
|
- if ($ok) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
-
|
|
|
- }
|
|
|
+// private function mysend_smsbao($mobile, $content)
|
|
|
+// {
|
|
|
+// $user_id = urlencode(C('mobile_username')); // 这里填写用户名
|
|
|
+// $pass = urlencode(C('mobile_pwd')); // 这里填登陆密码
|
|
|
+// if (!$mobile || !$content || !$user_id || !$pass) return false;
|
|
|
+// if (is_array($mobile)) $mobile = implode(",", $mobile);
|
|
|
+// $mobile = urlencode($mobile);
|
|
|
+// //$content=$content."【我的网站】";
|
|
|
+// $content = urlencode($content);
|
|
|
+// $pass = md5($pass);//MD5加密
|
|
|
+// $url = "http://api.smsbao.com/sms?u=" . $user_id . "&p=" . $pass . "&m=" . $mobile . "&c=" . $content . "";
|
|
|
+// $res = file_get_contents($url);
|
|
|
+// //return $res;
|
|
|
+// $ok = $res == "0";
|
|
|
+// if ($ok) {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+// return false;
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* http://www.yunpian.com/
|
|
@@ -188,46 +188,46 @@ class Sms
|
|
|
* -57 用户开通过固定签名功能,但签名未设置 联系客服或技术支持设置固定签名 技术支持
|
|
|
* @return bool|string
|
|
|
*/
|
|
|
- private function mysend_yunpian($mobile, $content)
|
|
|
- {
|
|
|
- $yunpian = 'yunpian';
|
|
|
- $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
|
|
|
- if (!empty($plugin)) {
|
|
|
- define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
|
|
|
- require_once(PLUGIN_ROOT . DS . $plugin . DS . 'Send.php');
|
|
|
- return send_sms($content, $mobile);
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- protected function send_yunpian($mobile, $content)
|
|
|
- {
|
|
|
- $code = $content['code'];
|
|
|
- //$time = $content['time'];
|
|
|
- $type = intval($content['type']);
|
|
|
-
|
|
|
- static $templates = array(self::register_code => '1382929', self::resetpass_code => '1386969', self::getbonus_code => '1386979', self::getbind_code => '1382929');
|
|
|
- if (!array_key_exists($type, $templates)) return -1;
|
|
|
-
|
|
|
- return $this->tpl_send_sms($mobile, $code, $templates[$type]);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- protected function tpl_send_sms($mobile, $tpl_value, $tpl_id)
|
|
|
- {
|
|
|
- $yunpian = 'yunpian';
|
|
|
- $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
|
|
|
- Log::record("SMS yunpian send:{$mobile} {$tpl_value} {$tpl_id}", Log::DEBUG);
|
|
|
-
|
|
|
- if (!empty($plugin)) {
|
|
|
- $plugin_root = BASE_DATA_PATH . DS . 'api/smsapi';
|
|
|
- require_once($plugin_root . DS . $plugin . DS . 'Send.php');
|
|
|
-
|
|
|
- return tpl_send_sms($tpl_id, $tpl_value, $mobile);
|
|
|
- } else {
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+// private function mysend_yunpian($mobile, $content)
|
|
|
+// {
|
|
|
+// $yunpian = 'yunpian';
|
|
|
+// $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
|
|
|
+// if (!empty($plugin)) {
|
|
|
+// define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
|
|
|
+// require_once(PLUGIN_ROOT . DS . $plugin . DS . 'Send.php');
|
|
|
+// return send_sms($content, $mobile);
|
|
|
+// } else {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// private function send_yunpian($mobile, $content)
|
|
|
+// {
|
|
|
+// $code = $content['code'];
|
|
|
+// //$time = $content['time'];
|
|
|
+// $type = intval($content['type']);
|
|
|
+//
|
|
|
+// static $templates = array(self::register_code => '1382929', self::resetpass_code => '1386969', self::getbonus_code => '1386979', self::getbind_code => '1382929');
|
|
|
+// if (!array_key_exists($type, $templates)) return -1;
|
|
|
+//
|
|
|
+// return $this->tpl_send_sms($mobile, $code, $templates[$type]);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// private function tpl_send_sms($mobile, $tpl_value, $tpl_id)
|
|
|
+// {
|
|
|
+// $yunpian = 'yunpian';
|
|
|
+// $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
|
|
|
+// Log::record("SMS yunpian send:{$mobile} {$tpl_value} {$tpl_id}", Log::DEBUG);
|
|
|
+//
|
|
|
+// if (!empty($plugin)) {
|
|
|
+// $plugin_root = BASE_DATA_PATH . DS . 'api/smsapi';
|
|
|
+// require_once($plugin_root . DS . $plugin . DS . 'Send.php');
|
|
|
+//
|
|
|
+// return tpl_send_sms($tpl_id, $tpl_value, $mobile);
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|