diff --git a/Lib/Alidayu/helper.php b/Lib/Alidayu/Helper.php similarity index 97% rename from Lib/Alidayu/helper.php rename to Lib/Alidayu/Helper.php index cbe7ca3..3f28393 100644 --- a/Lib/Alidayu/helper.php +++ b/Lib/Alidayu/Helper.php @@ -2,7 +2,7 @@ namespace Sms\Lib\Alidayu; -class helper{ +class Helper{ public function send($conf,$to, $param){ $c = new TopClient; diff --git a/Lib/Ucpaas/helper.php b/Lib/Ucpaas/Helper.php similarity index 97% rename from Lib/Ucpaas/helper.php rename to Lib/Ucpaas/Helper.php index 624cf85..2c5c750 100644 --- a/Lib/Ucpaas/helper.php +++ b/Lib/Ucpaas/Helper.php @@ -2,7 +2,7 @@ namespace Sms\Lib\Ucpaas; -class helper{ +class Helper{ protected $conf; diff --git a/Service/SmsService.class.php b/Service/SmsService.class.php index 5242191..1d95c8f 100644 --- a/Service/SmsService.class.php +++ b/Service/SmsService.class.php @@ -28,31 +28,31 @@ class SmsService { public static function sendSms($template, $to, $param = NULL, $operator = NULL) { - //如果没有传入短信平台,则使用 default 短信平台发送 - if (null == $operator){ - $operator = M('smsOperator')->where("enable='1'")->find()['tablename']; - } + //如果没有传入短信平台,则使用后台配置的开启的短信平台发送 + if (null == $operator){ + $operator = M('smsOperator')->where("enable='1'")->find()['tablename']; + } - // if param is not a json string, make it to json + // 如果传入数据不是 json 字符串,将其转化为 json 字符串 if (is_array($param)) { - // make sure every param is a instance of string - foreach($param as $k => $v){ - $param[$k] = $v . ""; - } + // 保证所有的参数都是字符串类型 + foreach($param as $k => $v){ + $param[$k] = $v . ""; + } $param = json_encode($param); } - //get sms operator configure + // 获取短信模板配置 $model = M('sms_' . $operator); $conf = $model->find($template); //检查是否存在指定的文件 - $file = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "Lib" . DIRECTORY_SEPARATOR . ucfirst($operator) . DIRECTORY_SEPARATOR."helper.php"; + $file = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "Lib" . DIRECTORY_SEPARATOR . ucfirst($operator) . DIRECTORY_SEPARATOR."Helper.php"; if (file_exists($file)) { //导入当前模块下Lib目录下的指定文件 - require_once(PROJECT_PATH . "Application/Sms/Lib/" . ucfirst($operator) . "/helper.php"); - $className = "\\Sms\\Lib\\" . ucfirst($operator) . "\\helper"; + require_once(PROJECT_PATH . "Application/Sms/Lib/" . ucfirst($operator) . "/Helper.php"); + $className = "\\Sms\\Lib\\" . ucfirst($operator) . "\\Helper"; $helper = new $className(); $result = json_encode($helper->send($conf, $to, $param));