提交代码
This commit is contained in:
144
app/Admin/Controllers/UpgradeController.php
Normal file
144
app/Admin/Controllers/UpgradeController.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Models\UpgradePayment;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
use Encore\Admin\Grid;
|
||||
use Encore\Admin\Layout\Content;
|
||||
use RuLong\Identity\Models\IdentityLog;
|
||||
|
||||
class UpgradeController extends AdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* Index interface.
|
||||
*
|
||||
* @param Content $content
|
||||
* @return Content
|
||||
*/
|
||||
public function index(Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('升级订单')
|
||||
->description('description')
|
||||
->body($this->grid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a grid builder.
|
||||
*
|
||||
* @return Grid
|
||||
*/
|
||||
protected function grid()
|
||||
{
|
||||
$grid = new Grid(new UpgradePayment);
|
||||
$grid->model()->orderBy('id', 'desc');
|
||||
$grid->disableCreateButton();
|
||||
$grid->disableActions();
|
||||
|
||||
$grid->filter(function ($filter) {
|
||||
|
||||
$filter->column(1 / 3, function ($filter) {
|
||||
$filter->like('id', '序号');
|
||||
|
||||
$filter->equal('type', '类型')->select([
|
||||
'vip' => '升级会员',
|
||||
'agent' => '升级代理商',
|
||||
]);
|
||||
});
|
||||
|
||||
$filter->column(1 / 3, function ($filter) {
|
||||
$filter->where(function ($query) {
|
||||
$query->whereHas('user', function ($query) {
|
||||
$query->whereHas('info', function ($query) {
|
||||
$query->where('nickname', 'like', "%{$this->input}%");
|
||||
});
|
||||
});
|
||||
}, '用户名称');
|
||||
});
|
||||
|
||||
$filter->disableIdFilter();
|
||||
|
||||
});
|
||||
|
||||
$grid->column('id', '序号');
|
||||
$grid->column('手机号')->display(function () {
|
||||
return $this->user->username;
|
||||
});
|
||||
$grid->column('用户名称')->display(function () {
|
||||
return $this->user->info->nickname;
|
||||
});
|
||||
$grid->column('trade_no', '流水号');
|
||||
$grid->column('amount', '金额');
|
||||
$grid->column('total', '实付');
|
||||
$grid->column('type', '类型')->display(function () {
|
||||
return $this->type_text;
|
||||
});
|
||||
$grid->column('pay_type', '支付方式')->display(function () {
|
||||
return $this->pay_type_text;
|
||||
});
|
||||
$grid->column('状态')->display(function () {
|
||||
return $this->state_text;
|
||||
});
|
||||
$grid->column('created_at', '创建时间');
|
||||
$grid->column('paid_at', '支付时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index interface.
|
||||
*
|
||||
* @param Content $content
|
||||
* @return Content
|
||||
*/
|
||||
public function logs(Content $content)
|
||||
{
|
||||
return $content
|
||||
->header('升降记录')
|
||||
->description('description')
|
||||
->body($this->logsgrid());
|
||||
}
|
||||
|
||||
public function logsgrid()
|
||||
{
|
||||
$grid = new Grid(new IdentityLog);
|
||||
$grid->model()->orderBy('id', 'desc');
|
||||
$grid->disableCreateButton();
|
||||
$grid->disableActions();
|
||||
|
||||
$grid->filter(function ($filter) {
|
||||
|
||||
$filter->column(1 / 3, function ($filter) {
|
||||
$filter->like('id', '序号');
|
||||
|
||||
$filter->equal('channel', '渠道')->select([
|
||||
'AutoUp' => '自动升级',
|
||||
'EmptyUp' => '后台升级',
|
||||
]);
|
||||
});
|
||||
|
||||
$filter->disableIdFilter();
|
||||
});
|
||||
|
||||
$grid->column('id', '序号');
|
||||
$grid->column('用户')->display(function () {
|
||||
return $this->user->info->nickname;
|
||||
});
|
||||
$grid->column('升级前')->display(function () {
|
||||
return $this->before_identity_title;
|
||||
});
|
||||
$grid->column('升级后')->display(function () {
|
||||
return $this->identity_title ?: '普通用户';
|
||||
});
|
||||
|
||||
$grid->column('渠道')->display(function () {
|
||||
return $this->channel_text;
|
||||
});
|
||||
$grid->created_at('升级时间');
|
||||
|
||||
return $grid;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user