<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Edm\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use Module\Edm\Type\EdmTaskItemStatus; use Module\Edm\Type\EdmTaskItemSubscribeStatus; use Module\Edm\Type\EdmTaskItemVisitStatus; class TaskItemController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $JeXgT) { $JeXgT->init('edm_task_item')->field(function ($JeXgT) { $JeXgT->id('id', 'ID'); $JeXgT->display('taskId', '任务ID'); $JeXgT->text('email', '邮箱'); $JeXgT->type('status', '状态')->type(EdmTaskItemStatus::class, array(EdmTaskItemStatus::SUCCESS => 'success', EdmTaskItemStatus::FAIL => 'danger', EdmTaskItemStatus::QUEUE => 'warning', EdmTaskItemStatus::SENDING => 'danger', EdmTaskItemStatus::CREATED => 'muted')); $JeXgT->display('subject', '邮件主题'); $JeXgT->code('content', '邮件内容')->listable(false); $JeXgT->type('visitStatus', '访问')->type(EdmTaskItemVisitStatus::class, array(EdmTaskItemVisitStatus::NOT_VISIT => 'muted', EdmTaskItemVisitStatus::VISITED => 'success')); $JeXgT->type('subscribeStatus', '订阅')->type(EdmTaskItemSubscribeStatus::class, array(EdmTaskItemSubscribeStatus::UNKNOWN => 'muted', EdmTaskItemSubscribeStatus::UNSUBSCRIBED => 'danger')); $JeXgT->display('statusRemark', '状态说明'); $JeXgT->display('startTime', '发送时间'); })->gridFilter(function (GridFilter $FdfN8) { $FdfN8->eq('id', L('ID')); $FdfN8->eq('taskId', '任务ID'); $FdfN8->like('subject', '邮件主题'); $FdfN8->eq('status', '状态')->select(EdmTaskItemStatus::class); $FdfN8->eq('visitStatus', '访问')->select(EdmTaskItemVisitStatus::class); $FdfN8->eq('subscribeStatus', '订阅')->select(EdmTaskItemSubscribeStatus::class); })->canAdd(false)->canEdit(false)->canBatchDelete(true)->title('发送队列'); } }