<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Res\Web\Controller; use ModStart\App\Web\Layout\WebPage; use ModStart\Core\Input\Request; use ModStart\Field\AbstractField; use ModStart\Grid\Displayer\ItemOperate; use ModStart\Grid\Grid; use ModStart\Repository\Filter\RepositoryFilter; use ModStart\Widget\Box; use ModStart\Widget\TextDialogRequest; use ModStart\Widget\TextLink; use Module\Member\Auth\MemberUser; use Module\Member\Support\MemberLoginCheck; use Module\Member\Web\Controller\MemberFrameController; use Module\Res\Model\ResAssetAccess; use Module\Res\Util\UrlUtil; class MemberResDownloadController extends MemberFrameController implements MemberLoginCheck { public function index(WebPage $JcqUq) { goto pO4WY; oK9Qr: if (Request::isPost()) { return $gwmIt->request(); } goto EDXvi; EDXvi: return $JcqUq->view($this->viewMemberFrame)->pageTitle('下载的资源')->body(new Box($gwmIt, '下载的资源')); goto fFz1S; lZY8I: $gwmIt->title('下载的资源'); goto oK9Qr; eww1v: $gwmIt->hookItemOperateRendering(function (ItemOperate $zCZzC) { $jIWZA = $zCZzC->item(); $zCZzC->prepend(TextLink::primary('下载', modstart_web_url('res/' . $jIWZA->asset->hash . '/download'), 'target="_blank"')); }); goto lZY8I; kGPMZ: $gwmIt->datetime('created_at', '时间'); goto Rl0uz; qQLXW: $gwmIt->image('asset.cover', '封面'); goto ZCK63; Rl0uz: $gwmIt->repositoryFilter(function (RepositoryFilter $bu01d) { $bu01d->where('memberUserId', MemberUser::id()); }); goto eww1v; ZCK63: $gwmIt->text('asset.title', '标题')->hookRendering(function (AbstractField $pZ_lR, $jIWZA, $aaYHa) { return TextLink::primary(htmlspecialchars($jIWZA->asset->title), UrlUtil::show($jIWZA->asset->hash), 'target="_blank"'); }); goto kGPMZ; pO4WY: $gwmIt = Grid::make(ResAssetAccess::with('asset')); goto qQLXW; fFz1S: } }