126 lines
4.4 KiB
PHP
Executable File
126 lines
4.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Forms\SendPrizeDltForm;
|
|
use App\Admin\Forms\SendPrizePlsForm;
|
|
use App\Admin\Forms\SendPrizePlwForm;
|
|
use App\Admin\Forms\SendPrizeQxcForm;
|
|
use App\Enums\BoolEnum;
|
|
use App\Model\Pls;
|
|
use App\Model\Plw;
|
|
use App\Model\Qxc;
|
|
use App\Model\Seller\Shop;
|
|
use App\Model\Seller\ShopPayChannel;
|
|
use App\Model\Zq\BjdcResult;
|
|
use App\Utils\Helps;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
use Illuminate\Support\Arr;
|
|
|
|
|
|
class QxcController extends AdminController
|
|
{
|
|
protected $title = '七星彩';
|
|
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(Qxc::class, function (Grid $grid) {
|
|
$grid->model()->orderBy('issue_num', 'desc');
|
|
$grid->column('id', 'id');
|
|
$grid->column('issue_num', '期号');
|
|
$grid->column('state', '是否开奖')->display(function () {
|
|
if ($this->state == BoolEnum::YES) {
|
|
return '是';
|
|
}
|
|
if ($this->state == BoolEnum::NO) {
|
|
return '否';
|
|
}
|
|
return '-';
|
|
});
|
|
$grid->column('enable', '销售中')->display(function () {
|
|
if ($this->enable == BoolEnum::YES) {
|
|
return '是';
|
|
}
|
|
if ($this->enable == BoolEnum::NO) {
|
|
return '否';
|
|
}
|
|
return '-';
|
|
});
|
|
$grid->column('close_time', '停售时间');
|
|
$grid->column('prize_time', '开奖时间');
|
|
$grid->column('result', '结果')->display(function () {
|
|
return $this->result ? implode(',', $this->result) : '';
|
|
});
|
|
$grid->column('prize', '奖池');
|
|
$grid->column('base1_prize', '一等奖');
|
|
$grid->column('base2_prize', '二等奖');
|
|
$grid->column('base3_prize', '三等奖');
|
|
$grid->column('__','派奖')
|
|
->modal(function (Grid\Displayers\Modal $modal){
|
|
|
|
// 标题
|
|
$modal->title('大乐透派奖');
|
|
// 自定义图标
|
|
$modal->icon('feather icon-navigation');
|
|
// 传递当前行字段值
|
|
return SendPrizeQxcForm::make()->payload(['id' => $this->id]);
|
|
})->help('派奖谨慎操作');
|
|
$grid->fixColumns(2);
|
|
$grid->filter(function ($filter) {
|
|
$filter->equal('issue_num', '期号');
|
|
});
|
|
$grid->disableViewButton();
|
|
$grid->disableDeleteButton();
|
|
$grid->scrollbarX();//数据展开
|
|
$grid->disableRowSelector();
|
|
});
|
|
}
|
|
|
|
|
|
protected function form()
|
|
{
|
|
return Form::make(new Qxc(), function (Form $form) {
|
|
|
|
$form->text('issue_num', '期号')->required();
|
|
$form->select('state', '是否开奖')->options(BoolEnum::asSelectArray())->required();
|
|
$form->select('enable', '销售中')->options(BoolEnum::asSelectArray())->required();
|
|
$form->datetime('close_time', '停售时间');
|
|
$form->datetime('prize_time', '开奖时间');
|
|
if ($form->model()->result && is_string($form->model()->result)) {
|
|
$form->model()->result = json_decode($form->model()->result, true);
|
|
}
|
|
$form->model()->result = is_array($form->model()->result) ? implode(',', $form->model()->result) : $form->model()->result;
|
|
$form->text('result', '结果')->help('以,分割,顺序一定要对');
|
|
$form->text('prize', '奖池')->default('');
|
|
$form->decimal('base1_prize', '一等奖')->default(0);
|
|
$form->decimal('base2_prize', '二等奖')->default(0);
|
|
$form->decimal('base3_prize', '三等奖')->default(0);
|
|
$form->divider();
|
|
$form->saving(function ($form) {
|
|
if ($form->result) {
|
|
$form->result = explode(',', $form->result);
|
|
} else {
|
|
$form->result = '';
|
|
}
|
|
});
|
|
$form->footer(function ($footer) {
|
|
// 去掉`查看`checkbox
|
|
$footer->disableViewCheck();
|
|
// 去掉`继续编辑`checkbox
|
|
$footer->disableEditingCheck();
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
}
|