删除永久素材
@param $mediaId
@return bool
@throws \yii\web\HttpException
483481
public function deleteMaterial($mediaId)
    {
        $result = $this->httpRaw(self::WECHAT_MATERIAL_DELETE_PREFIX, [
            'media_id' => $mediaId
        ], [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
1130409
public function deleteAction($mediaId)
    {
        $media = $this->get('open_orchestra_media.repository.media')->find($mediaId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::DELETE, $media);

        if ($media instanceof MediaInterface) {
            if (!$this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $media)) {
                throw new MediaNotDeletableException();
            }
            $documentManager = $this->get('object_manager');
            $documentManager->remove($media);
            $documentManager->flush();
            $this->dispatchEvent(MediaEvents::MEDIA_DELETE, new MediaEvent($media));
        }

        return array();
    }
778645
public function getMenu($agentId)
    {
        $result = $this->httpGet(self::WECHAT_MENU_GET_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'agentid' => $agentId
        ]);
        return isset($result['menu']['button']) ? $result['menu']['button'] : false;
    }
155041
public function delMaterial($media_id)
    {
        $url = "https://api.weixin.qq.com/cgi-bin/material/del_material?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['media_id' => $media_id]);
    }
389131
public function getProduct($productId)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PRODUCT_GET_PREFIX, [
            'product_id' => $productId
        ], [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['product_info'] : false;
    }
1290017
public function deleteProduct($productId)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PRODUCT_DELETE_PREFIX, [
            'product_id' => $productId
        ], [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success';
    }
931332
public function download($mediaId)
    {
        $response = $this->curl->post(self::DOWNLOAD.$this->access_token, json_encode([
                    'media_id' => $mediaId,
                ]
            )
        );
        $is_json = json_decode($response);
        if ($is_json) {
            return Response::json($is_json);
        } else {
            return $response;
        }
    }
359201
public function download($mediaId, $directory, $filename = '')
    {
        if (!is_dir($directory) || !is_writable($directory)) {
            throw new InvalidArgumentException("Directory does not exist or is not writable: '$directory'.");
        }
        $filename = $filename ?: $mediaId;
        $stream = $this->getStream($mediaId);
        $finfo = new finfo(FILEINFO_MIME);
        $mime = strstr($finfo->buffer($stream), ';', true);
        $extensions = FileHelper::getExtensionsByMimeType($mime);
        $filename .= '.' . array_pop($extensions);
        $filePath = $directory . '/' . $filename;
        file_put_contents($filePath, $stream);
        return $filePath;
    }
747497
public function hasResource($resourceId)
    {
        if (array_key_exists($resourceId, $this->resources)) {
            return true;
        }

        if (!$this->resourceName->isSitesResourceId($resourceId)) {
            return false;
        }

        // @todo this can be made more efficient
        $resource = $this->getResource($resourceId);

        return ($resource !== null);
    }
1354561
public function mediaGet($media_id){
        $param = array(
            'access_token' => $this->accessToken,
            'media_id'     => $media_id
        );

        $url = "{$this->mediaURL}/media/get?";
        return $url . http_build_query($param);
    }
989849
public function postDelete($mediaId)
    {
        $media = Media::findOrFail($mediaId);
        $media->delete();

        return redirect($this->admin->currentUrl())->with('notifications_below_header', [['type' => 'success', 'icon' => 'check-circle', 'title' => 'Success!', 'message' => 'The Media was successfully deleted.', 'dismissable' => false]]);
    }
582110
public function add($id, $mediaId)
    {
        return $this->getFactory()->createResult(
            $this->getApi()->addMediaToList($id, $mediaId)
        );
    }
1325071
public function fetchPermanentNews ($mediaID)
    {
        $stream = $this->doPermanentFetchToStream($mediaID, null);
        $json = json_decode(stream_get_contents($stream));

        return $this->expandNews($json->news_item, new Downloaded\News($mediaID, $json->update_time));
    }
1333296
public function deleteProduct($productId)
    {
        $result = $this->httpRaw(self::WECHAT_SHOP_PRODUCT_DELETE_URL . 'access_token=' . $this->getAccessToken(), [
            'product_id' => $productId
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success';
    }
777151
public function uploadvideo($media_id, $title, $description)
    {
        if (empty($media_id)) {
            $this->setError('参数缺失');

            return false;
        }

        $queryStr                = [];
        $queryStr['media_id']    = $media_id;
        $queryStr['title']       = $title;
        $queryStr['description'] = $description;

        $res = $this->_post('uploadvideo', $queryStr);

        return $res;
    }
241915
public function delete($mediaId)
    {
        return $this->http->get(self::API_FOREVER_DELETE, array('media_id' => $mediaId, 'agentid' => $this->agentId));
    }
1047923
public function renderMedia($mediaId, array $options = array())
    {
        $media = $this->getMedia($mediaId);

        if ($media) {
            return $this->displayMediaManager->renderMedia($media, $options);
        }

        return '';
    }