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.
95 lines
3.0 KiB
95 lines
3.0 KiB
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Actions\User\AddContractControl;
|
|
use App\Admin\Actions\User\AddPromotionUser;
|
|
use App\Admin\Actions\User\AddSystemUser;
|
|
use App\Admin\Actions\User\AddUser;
|
|
use App\Admin\Renderable\Parents;
|
|
use App\Admin\Renderable\UserTradeStatistics;
|
|
use App\Admin\Renderable\UserWalletExpand;
|
|
use App\Handlers\ContractTool;
|
|
use App\Models\AgentGrade;
|
|
use App\Models\ContractPair;
|
|
use App\Models\ContractPosition;
|
|
use App\Models\PlatformContractControl;
|
|
use App\Models\SustainableAccount;
|
|
use App\Models\User;
|
|
use App\Models\UserAuth;
|
|
use App\Models\UserGrade;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Layout\Content;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Controllers\AdminController;
|
|
use Dcat\Admin\Widgets\Card;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Dcat\Admin\Admin;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ContractRisknewController extends AdminController
|
|
{
|
|
// public function index(Content $content)
|
|
// {
|
|
// return $content
|
|
// ->title('新合约风控')
|
|
// ->body(new Card(new \App\Admin\Forms\ContractRisknew()));
|
|
// }
|
|
|
|
protected function grid()
|
|
{
|
|
$pcc = PlatformContractControl::query()->orderByDesc('id');
|
|
return Grid::make($pcc, function (Grid $grid) {
|
|
// $aa = DB::select('select * from contract_position');
|
|
|
|
if (Admin::user()->can('addSystemUser')) {
|
|
$grid->tools([new AddContractControl()]);
|
|
}
|
|
|
|
$grades = AgentGrade::getCachedGradeOption();
|
|
|
|
$grid->id;
|
|
|
|
|
|
$grid->column('symbol','币种名称');
|
|
$grid->column('now_price','操作价格');
|
|
$grid->column('blacktime','回调时间');
|
|
$grid->column('time','操作时间')->display(function ($v) {
|
|
return date('Y-m-d H:i:s', $v);
|
|
});;
|
|
|
|
|
|
$grid->disableViewButton();
|
|
$grid->disableCreateButton();
|
|
//$grid->disableEditButton();
|
|
$grid->disableDeleteButton();
|
|
$grid->disableBatchDelete();
|
|
|
|
$grid->filter(function (Grid\Filter $filter) use ($grades) {
|
|
$filter->between('created_at', "时间")->date()->width(4);
|
|
$filter->equal('whethertopromote', '币种名称')->select(function (){
|
|
$symbols = config('coin.exchange_symbols');
|
|
$PlatformCurrency = [];
|
|
foreach ($symbols as $key=>$val){
|
|
$PlatformCurrency[]= $key;
|
|
// var_dump($key);
|
|
}
|
|
return $PlatformCurrency;
|
|
|
|
})->width(2);
|
|
});
|
|
})
|
|
->title('新合约风控');
|
|
}
|
|
|
|
public function symbolDetal(Request $request){
|
|
$cd = Cache::store('redis')->get('swap:' . $request['symbol'] . '_detail');
|
|
if($cd){
|
|
$cd['highest'] = $cd['price'] * 1.1;
|
|
$cd['minimum'] = $cd['price'] * 0.9;
|
|
}
|
|
|
|
return $cd;
|
|
}
|
|
}
|
|
|