You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.2 KiB
150 lines
5.2 KiB
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Actions\User\CheckAuth;
|
|
use App\Admin\Actions\User\PassUserAuth;
|
|
use App\Admin\Actions\User\RejectUserAuth;
|
|
use App\Handlers\ContractTool;
|
|
use App\Models\Agent;
|
|
use App\Models\AgentGrade;
|
|
use App\Models\UserAuth;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class UserAuthController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(UserAuth::with(['user']), function (Grid $grid) {
|
|
$grid->model()->orderByRaw("FIELD(status," . implode(",", [1, 0, 3, 2]) . ")")->orderByDesc('created_at');
|
|
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
|
// $actions->disableDelete();
|
|
$actions->disableQuickEdit();
|
|
$actions->disableEdit();
|
|
//$actions->disableView();
|
|
|
|
if ($actions->row->status == UserAuth::STATUS_WAIT) {
|
|
$actions->append(new CheckAuth());
|
|
}
|
|
});
|
|
|
|
$grid->disableCreateButton();
|
|
// $grid->disableDeleteButton();
|
|
$grid->disableEditButton();
|
|
|
|
$grid->tools([
|
|
new PassUserAuth(),
|
|
new RejectUserAuth(),
|
|
]);
|
|
|
|
$grid->toolsWithOutline(false);
|
|
|
|
//$grid->id->sortable();
|
|
|
|
$grid->user_id;
|
|
$grid->column('usermail', '邮箱')->display(function () {
|
|
//$realtime_price = Cache::store('redis')->get('swap:' . 'trade_detail_' . $this->symbol)['price'] ?? null;
|
|
//dd(ContractTool::getUserMail($this->user_id));
|
|
return ContractTool::getUserMail($this->user_id);
|
|
});
|
|
$grid->column('agname','代理邮箱')->display(function (){
|
|
$var = ContractTool::GetProxyEmail($this->user_id);
|
|
//dd($var['username']);
|
|
return $var['username'];
|
|
});
|
|
$grid->realname;
|
|
$grid->type->using([1 => '身份证', 2 => '驾驶证',3=>'护照']);
|
|
$grid->country_code;
|
|
$grid->id_card;
|
|
$grid->front_img->image('', 50, 50);
|
|
$grid->back_img->image('', 50, 50);
|
|
$grid->hand_img->image('', 50, 50);
|
|
$grid->check_time;
|
|
$grid->primary_status->using(UserAuth::$primaryStatusMap)->dot([0 => 'default', 1 => 'success']);
|
|
$grid->status->using(UserAuth::$statusMap)->dot([0 => 'default', 1 => 'danger', 2 => 'success', 3 => 'primary'])->filter(
|
|
Grid\Column\Filter\In::make(UserAuth::$statusMap)
|
|
);
|
|
$grid->created_at->sortable();
|
|
//$grid->updated_at->sortable();
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('user_id', '会员ID')->width(3);
|
|
$filter->where('username', function ($q) {
|
|
$username = $this->input;
|
|
$q->whereHas('user', function ($q) use ($username) {
|
|
$q->where('username', $username)->orWhere('phone', $username)->orWhere('email', $username);
|
|
});
|
|
}, "用户名/手机/邮箱")->width(3);
|
|
$filter->equal('status', '高级认证')->select(UserAuth::$statusMap)->width(3);
|
|
$filter->where('acc', function ($q) {
|
|
$username = $this->input;
|
|
$aa = $q->whereHas('user', function ($q) use ($username) {
|
|
$q->where('whethertopromote', $username);
|
|
});
|
|
}, "是否营销")->select(UserAuth::$typeMap)->width(2);
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new UserAuth(), function (Show $show) {
|
|
$show->id;
|
|
$show->user_id;
|
|
$show->realname;
|
|
$show->country_code;
|
|
$show->id_card;
|
|
$show->front_img->image();
|
|
$show->back_img->image();
|
|
$show->address('居住地址');
|
|
$show->city('城市');
|
|
$show->extra('额外信息');
|
|
$show->phone('电话号码');
|
|
$show->hand_img;
|
|
$show->check_time;
|
|
$show->status;
|
|
$show->created_at;
|
|
$show->updated_at;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new UserAuth(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('user_id');
|
|
$form->text('realname');
|
|
$form->text('country_code');
|
|
$form->text('id_card');
|
|
$form->text('front_img');
|
|
$form->text('back_img');
|
|
$form->text('hand_img');
|
|
$form->text('check_time');
|
|
$form->text('status');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
}
|
|
|