/** * Execute the job. * * @return void */ public function handle() { $qr = WechatQrcodeModel::find($this->qrcodeID); if (empty($qr)) { return false; } if (empty($qr->aid)) { $account = $qr->account; $attachment = new Attachment($account->toArray(), $account->getKey()); $a = $attachment->downloadByTicket($qr->ticket); !empty($a) && $qr->update(['aid' => $a['id']]); } }
/** * Execute the job. * * @return void */ public function handle() { $media = WechatMessageMedia::find($this->mediaID); if (empty($media)) { return false; } $message = $media->message; $account = $message->account; $attachment = new Attachment($account->toArray(), $account->getKey()); if (empty($media->aid)) { $a = $attachment->downloadByMediaID($media->media_id, $media->format, $message->type == API::MSGTYPE_VIDEO); !empty($a) && ($media->aid = $a['id']); } if (empty($media->thumb_aid) && !empty($media->thumb_media_id)) { $a = $attachment->downloadByMediaID($media->thumb_media_id, 'jpg'); !empty($a) && ($media->thumb_aid = $a['id']); } $media->save(); }