1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Jobs;
- use App\Services\NoticeService\Channels\QQMiniTemplateChannel;
- use Illuminate\Bus\Queueable;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- class PushQQminiprogramNoticeJob implements ShouldQueue
- {
- use Dispatchable;
- use InteractsWithQueue;
- use Queueable;
- use SerializesModels;
- private $data;
- private $uids;
- /**
- * Create a new job instance.
- *
- * @param array $uids
- * @param array $data
- */
- public function __construct(array $uids, array $data)
- {
- $this->uids = $uids;
- $this->data = $data;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- foreach ($this->uids as $uid) {
- $app = new QQMiniTemplateChannel();
- $app->setAppId(config('qqprogram.app_id'))
- ->toUser($uid)
- ->setPage($this->data['page'])
- ->setTitle($this->data['title'])
- ->setTemplateId($this->data['template_id'])
- ->setParameters($this->data['parameters'])
- ->send();
- }
- }
- }
|