Skip to content

Commit

Permalink
#1 更改 helper 类名为大写 Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
jaren-gu committed Mar 8, 2017
1 parent 52a0616 commit 6d84ac1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Lib/Alidayu/helper.php → Lib/Alidayu/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Sms\Lib\Alidayu;

class helper{
class Helper{

public function send($conf,$to, $param){
$c = new TopClient;
Expand Down
2 changes: 1 addition & 1 deletion Lib/Ucpaas/helper.php → Lib/Ucpaas/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Sms\Lib\Ucpaas;

class helper{
class Helper{

protected $conf;

Expand Down
26 changes: 13 additions & 13 deletions Service/SmsService.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 6d84ac1

Please sign in to comment.