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