Skip to content

Commit

Permalink
Merge pull request #66 from toplan/dev
Browse files Browse the repository at this point in the history
优化代码;使用phpsms v1.3.1解决queue为sync是的bug
  • Loading branch information
toplan committed Apr 15, 2016
2 parents 1278f2b + 76cbc0b commit 581bba7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ phpsms为laravel-sms提供了全套的短信发送机制,而且phpsms也有自
在项目根目录下运行如下composer命令:
```php
//安装2.3版本(推荐)
composer require 'toplan/laravel-sms:~2.3.0',
composer require 'toplan/laravel-sms:~2.3.1',

//安装开发中版本
composer require 'toplan/laravel-sms:dev-master'
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "toplan/laravel-sms",
"description": "sms send package for laravel",
"license": "MIT",
"version": "2.3.0",
"version": "2.3.1",
"keywords": ["sms", "laravel sms", "laravel-sms"],
"authors": [
{
Expand All @@ -12,7 +12,7 @@
],
"require": {
"php": ">=5.4.0",
"toplan/phpsms": "~1.3.0"
"toplan/phpsms": "~1.3.1"
},
"autoload": {
"classmap": [
Expand Down
14 changes: 6 additions & 8 deletions src/Toplan/LaravelSms/SendReminderSms.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?php

namespace App\Jobs;
namespace Toplan\Sms;

use App\Jobs\Job;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Toplan\PhpSms\Sms;

class SendReminderSms extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue, SerializesModels;
use InteractsWithQueue;

protected $sms;

/**
* Create a new job instance.
*
* @return void
* @param Sms $sms
*/
public function __construct($sms)
public function __construct(Sms $sms)
{
$this->sms = $sms;
}
Expand All @@ -31,8 +31,6 @@ public function __construct($sms)
*/
public function handle()
{
if ($this->sms instanceof Sms) {
$this->sms->send();
}
$this->sms->send();
}
}
4 changes: 2 additions & 2 deletions src/Toplan/LaravelSms/SmsManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected function initPhpSms()
}

// define how to use queue
$queueJob = config('laravel-sms.queueJob', 'App\Jobs\SendReminderSms');
PS::queue(false, function ($sms, $data) use ($queueJob) {
$queueJob = config('laravel-sms.queueJob', 'Toplan\Sms\SendReminderSms');
PS::queue(false, function ($sms) use ($queueJob) {
if (!class_exists($queueJob)) {
throw new LaravelSmsException("Class [$queueJob] does not exists.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/laravel-sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@
* queue job
* -----------------------------------
*/
'queueJob' => 'App\Jobs\SendReminderSms',
'queueJob' => 'Toplan\Sms\SendReminderSms',
];

0 comments on commit 581bba7

Please sign in to comment.