コード例 #1
0
ファイル: WechatMedia.php プロジェクト: unionbt/hanpaimall
 /**
  * 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();
 }