| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Jobs\Manager\Process;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldBeUnique;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- use App\Facades\Servers\Logs\Log;
- use App\Servers\Sms\VerifyCode as SmsVerifyCode;
- use App\Models\Manager\Process\SubNoticeLog as SubNoticeLogModel;
- /**
- * 阿里云短信通知队列
- * @author 唐远望
- * @version 1.0
- * @date 2026-04-16
- */
- class SendAliyunSmsJobs implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- protected $message_data;
- protected $company_id;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(array $message_data)
- {
- $this->message_data = $message_data;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- try {
- $SmsVerifyCode = new SmsVerifyCode();
- $SubNoticeLogModel = new SubNoticeLogModel();
- $notice_data_info = $this->message_data['notice_data_info'];
-
- $mobile = $notice_data_info['mobile'];
- $sms_content = json_decode($notice_data_info['mobile_content'], true);
- $totle_number = $sms_content['totle_number'];
- $number1 = $sms_content['number1'];
- $number2 = $sms_content['number2'];
- $number3 = $sms_content['number3'];
- $sms_tpl_id = $sms_content['sms_tpl_id'];
- $res_msg = $SmsVerifyCode->sendContent($mobile, ['totle_number' => $totle_number, 'number1' => $number1, 'number2' => $number2, 'number3' => $number3], $sms_tpl_id);
- Log::info('job_send_sms', '订阅短信通知推送队列记录', ['email' => $mobile, 'sms_tpl_id' => $sms_tpl_id, 'msg' => $res_msg]);
- //更新发送状态
- $SubNoticeLogModel->where(['id' => $notice_data_info['id']])->update(['sms_status' => 0]);
- } catch (\Exception $e) {
- Log::info('job_send_sms', '阿里云短信通知队列失败', ['data' => $this->message_data, 'error' => $e->getMessage()]);
- }
- }
- public function failed(\Throwable $exception)
- {
- Log::info('job_send_sms', '阿里云短信通知队列完全失败', ['data' => $this->message_data, 'error' => $exception]);
- }
- }
|