<?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 $lZifj) { $lZifj->init('member_vip_set')->field(function ($lZifj) { $lZifj->layoutPanel('基础信息', function ($lZifj) { $lZifj->id('id', 'ID')->addable(true)->editable(true)->ruleUnique('member_vip_set')->required()->defaultValue(ModelUtil::sortNext('member_vip_set', array(), 'id')); $lZifj->text('title', '名称')->required()->ruleUnique('member_vip_set'); $lZifj->text('flag', '英文标识')->required()->ruleUnique('member_vip_set'); $lZifj->switch('visible', '可见')->gridEditable(true)->tip('开启后前台用户可见'); $lZifj->switch('isDefault', '默认')->optionsYesNo()->help('会员是否默认为该等级')->required(); $lZifj->image('icon', '图标'); $lZifj->currency('price', '价格')->required(); $lZifj->number('vipDays', '时间')->required()->help('单位为天，365表示1年'); $lZifj->text('desc', '简要说明')->required(); $lZifj->richHtml('content', '详细说明')->required(); if (ModuleManager::getModuleConfig('Member', 'creditEnable', false)) { $lZifj->switch('creditPresentEnable', '赠送积分')->when('=', true, function ($yZTO2) { $yZTO2->number('creditPresentValue', '赠送积分数量'); })->optionsYesNo()->listable(false); } }); foreach (MemberVipBiz::all() as $qhsmj) { $lZifj->layoutPanel($qhsmj->title(), function ($lZifj) use($qhsmj) { $qhsmj->vipField($lZifj); }); } $lZifj->display('created_at', L('Created At'))->listable(false); $lZifj->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $bu01d) { $bu01d->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 $yZTO2) { MemberVipUtil::clearCache(); }); } public function config(AdminConfigBuilder $lZifj) { goto OfpKI; s8SZU: $lZifj->formClass('wide'); goto pfqFK; jHeBd: $lZifj->richHtml('Member_VipContent', 'VIP开通说明')->help('默认为 VIP开通说明'); goto s8SZU; syh1t: $lZifj->pageTitle('功能设置'); goto jHeBd; OfpKI: $lZifj->useDialog(); goto syh1t; pfqFK: return $lZifj->perform(); goto VuNCO; VuNCO: } }