<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminConfigBuilder; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Core\Dao\ModelUtil; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Module\ModuleManager; use ModStart\Support\Concern\HasFields; use Module\Member\Biz\Vip\MemberVipBiz; use Module\Member\Util\MemberVipUtil; class MemberVipSetController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $P2vse) { $P2vse->init('member_vip_set')->field(function ($P2vse) { $P2vse->layoutPanel('基础信息', function ($P2vse) { $P2vse->id('id', 'ID')->addable(true)->editable(true)->ruleUnique('member_vip_set')->required()->defaultValue(ModelUtil::sortNext('member_vip_set', array(), 'id')); $P2vse->text('title', '名称')->required()->ruleUnique('member_vip_set'); $P2vse->text('flag', '英文标识')->required()->ruleUnique('member_vip_set'); $P2vse->switch('visible', '可见')->gridEditable(true)->tip('开启后前台用户VIP开通页面可见'); $P2vse->switch('isDefault', '默认')->optionsYesNo()->help('会员是否默认为该等级')->required(); $P2vse->image('icon', '图标'); $P2vse->currency('price', '价格')->required(); $P2vse->number('vipDays', '时间')->required()->help('单位为天，365表示1年'); $P2vse->text('desc', '简要说明')->required(); $P2vse->richHtml('content', '详细说明')->required(); if (ModuleManager::getModuleConfig('Member', 'creditEnable', false)) { $P2vse->switch('creditPresentEnable', '赠送积分')->when('=', true, function ($NX6uw) { $NX6uw->number('creditPresentValue', '赠送积分数量'); })->optionsYesNo()->listable(false); } }); foreach (MemberVipBiz::all() as $g16tm) { $P2vse->layoutPanel($g16tm->title(), function ($P2vse) use($g16tm) { $g16tm->vipField($P2vse); }); } $P2vse->display('created_at', L('Created At'))->listable(false); $P2vse->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $mHisM) { $mHisM->like('title', '名称'); })->gridOperateAppend('
<a href="javascript:;" class="btn btn-primary" data-dialog-width="90%" data-dialog-height="90%" data-dialog-request="' . modstart_admin_url('member_vip_set/config') . '">
    <i class="iconfont icon-cog"></i>
    功能设置
</a>
<a href="javascript:;" class="btn btn-primary" data-dialog-width="90%" data-dialog-height="90%" data-dialog-request="' . modstart_admin_url('member_vip_right') . '">
    <i class="iconfont icon-cube"></i>
    权益设置
</a>
')->operateFixed('right')->enablePagination(false)->defaultOrder(array('sort', 'asc'))->canSort(true)->canShow(false)->title('用户VIP等级')->addDialogSize(array('600px', '95%'))->editDialogSize(array('600px', '95%'))->hookSaved(function (Form $NX6uw) { MemberVipUtil::clearCache(); }); } public function config(AdminConfigBuilder $P2vse) { goto RTExG; RTExG: $P2vse->useDialog(); goto oOfZe; VK6nB: $P2vse->formClass('wide'); goto lKoUa; lKoUa: return $P2vse->perform(); goto pTo4p; T3url: $P2vse->richHtml('Member_VipContent', 'VIP开通说明')->help('默认为 VIP开通说明'); goto VK6nB; oOfZe: $P2vse->pageTitle('功能设置'); goto T3url; pTo4p: } }