| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | * @param null $tempId | 
| 58 | 58 | * @return $this | 
| 59 | 59 | */ | 
| 60 | -    public function template($agentName=$config('sms.default'), $tempId = null) | |
| 60 | +    public function template($agentName = $config('sms.default'), $tempId = null) | |
| 61 | 61 |      { | 
| 62 | 62 |          if (is_array($agentName)) { | 
| 63 | 63 |              foreach ($agentName as $k => $v) { | 
| @@ -89,10 +89,10 @@ discard block | ||
| 89 | 89 | */ | 
| 90 | 90 | public function send() | 
| 91 | 91 |      { | 
| 92 | -        if($this->config=='YunTongXun'){ | |
| 93 | -            $rest=new Rest(config('sms.agents.'.$this->config)); | |
| 94 | - return $rest->sendTemplateSMS($this->smsData['to'],$this->smsData['templateData'],$this->smsData['templates']['YunTongXun']); | |
| 95 | -        }else{ | |
| 92 | +        if ($this->config == 'YunTongXun') { | |
| 93 | +            $rest = new Rest(config('sms.agents.' . $this->config)); | |
| 94 | + return $rest->sendTemplateSMS($this->smsData['to'], $this->smsData['templateData'], $this->smsData['templates']['YunTongXun']); | |
| 95 | +        } else { | |
| 96 | 96 |              throw new \Exception('make sure you have choose a right agent'); | 
| 97 | 97 | } | 
| 98 | 98 | } | 
| @@ -92,7 +92,7 @@ | ||
| 92 | 92 |          if($this->config=='YunTongXun'){ | 
| 93 | 93 |              $rest=new Rest(config('sms.agents.'.$this->config)); | 
| 94 | 94 | return $rest->sendTemplateSMS($this->smsData['to'],$this->smsData['templateData'],$this->smsData['templates']['YunTongXun']); | 
| 95 | -        }else{ | |
| 95 | +        } else{ | |
| 96 | 96 |              throw new \Exception('make sure you have choose a right agent'); | 
| 97 | 97 | } | 
| 98 | 98 | } | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | public function boot() | 
| 21 | 21 |      { | 
| 22 | 22 | $this->publishes([ | 
| 23 | -            __DIR__.'/../config/sms.php' => config_path('sms.php'), | |
| 23 | +            __DIR__ . '/../config/sms.php' => config_path('sms.php'), | |
| 24 | 24 | ]); | 
| 25 | 25 | } | 
| 26 | 26 | |
| @@ -32,11 +32,11 @@ discard block | ||
| 32 | 32 | public function register() | 
| 33 | 33 |      { | 
| 34 | 34 | $this->mergeConfigFrom( | 
| 35 | - __DIR__.'/../config/sms.php', 'sms' | |
| 35 | + __DIR__ . '/../config/sms.php', 'sms' | |
| 36 | 36 | ); | 
| 37 | 37 | |
| 38 | -        $this->app->singleton('Sms',function($app){ | |
| 39 | -            $app=new Sms(config('sms.default')); | |
| 38 | +        $this->app->singleton('Sms', function($app) { | |
| 39 | +            $app = new Sms(config('sms.default')); | |
| 40 | 40 | return $app; | 
| 41 | 41 | }); | 
| 42 | 42 | } | 
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | */ | 
| 16 | 16 | trait CurlTrait | 
| 17 | 17 |  { | 
| 18 | - public $BodyType='json'; | |
| 18 | + public $BodyType = 'json'; | |
| 19 | 19 | /** | 
| 20 | 20 | * create url post | 
| 21 | 21 | * @param $url | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 | private $ServerIP; | 
| 21 | 21 | private $ServerPort; | 
| 22 | 22 | private $SoftVersion; | 
| 23 | - private $Batch; //时间戳 | |
| 23 | + private $Batch; //时间戳 | |
| 24 | 24 | private $BodyType = 'json'; //包体格式,可填值:json 、xml | 
| 25 | 25 | |
| 26 | 26 | public function __construct(array $config, $BodyType = 'json') | 
| @@ -29,9 +29,9 @@ discard block | ||
| 29 | 29 | $this->ServerIP = $config['serverIP']; | 
| 30 | 30 | $this->ServerPort = $config['serverPort']; | 
| 31 | 31 | $this->SoftVersion = $config['softVersion']; | 
| 32 | - $this->AppId=$config['appId']; | |
| 33 | - $this->AccountSid=$config['accountSid']; | |
| 34 | - $this->AccountToken=$config['accountToken']; | |
| 32 | + $this->AppId = $config['appId']; | |
| 33 | + $this->AccountSid = $config['accountSid']; | |
| 34 | + $this->AccountToken = $config['accountToken']; | |
| 35 | 35 |          if (in_array($BodyType, ['xml', 'json'])) { | 
| 36 | 36 | $this->BodyType = $BodyType; | 
| 37 | 37 | } | 
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | * Time: 21:25 | 
| 7 | 7 | */ | 
| 8 | 8 | return [ | 
| 9 | -    'default' => env('SMS_AGENT','YunTongXun'), | |
| 9 | +    'default' => env('SMS_AGENT', 'YunTongXun'), | |
| 10 | 10 | |
| 11 | 11 | 'agents' => [ | 
| 12 | 12 | /* |