Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

队列发送始终失败(redis/database都尝试过) #182

Open
liuqingliu opened this issue Sep 19, 2018 · 5 comments
Open

队列发送始终失败(redis/database都尝试过) #182

liuqingliu opened this issue Sep 19, 2018 · 5 comments

Comments

@liuqingliu
Copy link

请教一下诸位大神,我已经尝试过几天使用队列异步发送短信,但是未能成功,多次查询资料未果(百度和google均没找到解决办法),特此求教!!!

@liuqingliu
Copy link
Author

我说的发送失败,指的利用phpsms::queue()去发送,使用send方法使用队列发送失败

@zengzhaosong
Copy link

插件使用队列的时候是把整个sms对象序列化了,而很多配置信息是初始化在类的静态变量$task中,序列化的时候这些信息丢失了。可以在队列里面执行$this->sms-send()之前执行$this->sms->bootTask()把配置信息重新写到$task中

@ssitcloud
Copy link

正好我也遇到这个问题, @zengzhaosong ,用你的方法解决了,多谢

@zengzhaosong
Copy link

这种方式在一个线程中发送多条短信的时候还是会有问题,要在job中执行
\PhpSms::beforeSend(function ($task) {}, true);
\PhpSms::afterSend(function ($task, $result) {}, true);
$this->sms->bootTask();
$this->sms->send();
@ssitcloud

@ssitcloud
Copy link

@zengzhaosong 多谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants