add field
This commit is contained in:
parent
13c6ff5e08
commit
1685255236
|
@ -4,6 +4,7 @@ namespace App\Admin\Actions\Post;
|
|||
|
||||
use App\Single;
|
||||
use App\User;
|
||||
use App\Base;
|
||||
use Encore\Admin\Actions\RowAction;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
@ -17,7 +18,7 @@ class Replicate extends RowAction
|
|||
$data_array = json_decode($data, true);
|
||||
|
||||
|
||||
$list = Single::where(['type' => config('const.db.coin_type_platform')])->get();
|
||||
$list = Single::where(['type' => Base::SINGLE_TYPE_PLATFORM])->get();
|
||||
|
||||
if ($data_array['code'] == 1) {
|
||||
foreach ($data_array['data'] as $v) {
|
||||
|
|
|
@ -50,6 +50,7 @@ class SingleController extends AdminController
|
|||
$grid->column('min_c', __('最低存入'));
|
||||
$grid->column('min_q', __('最低取出'));
|
||||
$grid->column('sorts', __('排序'))->sortable();
|
||||
// $grid->column('conf', __('其他配置'));
|
||||
|
||||
$grid->actions(function ($actions) {
|
||||
// 去掉查看
|
||||
|
@ -70,6 +71,13 @@ class SingleController extends AdminController
|
|||
$show = new Show(Single::findOrFail($id));
|
||||
|
||||
$show->field('id', __('ID'));
|
||||
$show->field('name', __('币种'));
|
||||
$show->field('type', '策略类型')->using([
|
||||
1 => '平台币',
|
||||
2 => '自身币',
|
||||
3 => '流动性',
|
||||
]);
|
||||
$show->field('conf', '其他配置')->json();
|
||||
$show->field('created_at', __('Created at'));
|
||||
$show->field('updated_at', __('Updated at'));
|
||||
|
||||
|
@ -98,7 +106,7 @@ class SingleController extends AdminController
|
|||
|
||||
$form->text('min_c', '最低存入')->required();
|
||||
$form->text('min_q', '最低取出')->required();
|
||||
|
||||
$form->textarea('conf', '其他配置')->required();
|
||||
|
||||
$form->switch('use', '开关')->states([
|
||||
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
class Base
|
||||
{
|
||||
const SINGLE_TYPE_PLATFORM = 1;
|
||||
const SINGLE_TYPE_EARN = 2;
|
||||
const SINGLE_TYPE_FLUIDITY = 3;
|
||||
|
||||
const BALANCE_MINING_INTEREST = 1;
|
||||
const BALANCE_RECEIVED_MINING_INTEREST = 2;
|
||||
const BALANCE_RECEIVED_AIRDROP = 3;
|
||||
const BALANCE_ISSUE_AIRDROP = 4;
|
||||
const BALANCE_RECEIVED_FLUIDITY = 5;
|
||||
const BALANCE_FLUIDITY_INTEREST = 6;
|
||||
|
||||
const UNCHECKED = 0;
|
||||
const CHECKED = 1;
|
||||
|
||||
const ALLOWED = 1;
|
||||
const DISALLOWED = 2;
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CalcProfit extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'coin:calc';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Calculating user's profits who deposited.";
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class RemoveOutdated extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'coin:clean';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Remove outdated logs, records, etc.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -14,12 +14,13 @@ use App\System;
|
|||
use App\Withdrawal;
|
||||
use Illuminate\Http\Request;
|
||||
use App\User;
|
||||
use App\Base;
|
||||
use App\Setting;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Vault;
|
||||
use App\Vault2;
|
||||
use App\Vault3;
|
||||
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
|
@ -106,7 +107,14 @@ class ApiController extends Controller
|
|||
unset($system['reward' . $i]);
|
||||
}
|
||||
|
||||
return json_encode(compact('system', 'other'));
|
||||
// 获取基本配置
|
||||
$settings = Setting::all();
|
||||
$base = [];
|
||||
foreach ($settings as $s) {
|
||||
$base[$s['name']] = $s['svalue'];
|
||||
}
|
||||
|
||||
return json_encode(compact('system', 'other', 'base'));
|
||||
}
|
||||
|
||||
// 钱包注册
|
||||
|
@ -169,7 +177,7 @@ class ApiController extends Controller
|
|||
$data = file_get_contents('https://eth.tokenview.com/api/eth/address/tokenbalance/' . strtolower($address));
|
||||
|
||||
$data_array = json_decode($data, true);
|
||||
$list = Single::where(['type' => config('const.db.coin_type_fluidity')])->get();
|
||||
$list = Single::where(['type' => Base::SINGLE_TYPE_FLUIDITY])->get();
|
||||
|
||||
Vault3::where(['address' => $address])->update(['status' => 1]);
|
||||
|
||||
|
@ -190,8 +198,6 @@ class ApiController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取用户信息
|
||||
public function userInfo(Request $request)
|
||||
{
|
||||
|
@ -308,6 +314,7 @@ class ApiController extends Controller
|
|||
'DAI_Q' => (int)in_array('DAI', $wallet_arr),
|
||||
'USDC_Q' => (int)in_array('USDC', $wallet_arr),
|
||||
]);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,6 +381,7 @@ class ApiController extends Controller
|
|||
'USDT_Q' => (int)in_array('USDT', $wallet_arr),
|
||||
'USDC_Q' => (int)in_array('USDC', $wallet_arr),
|
||||
]);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +515,7 @@ class ApiController extends Controller
|
|||
$user = User::where('address', $address)->first();
|
||||
if (!empty($user)) {
|
||||
|
||||
Authorize::insert([
|
||||
$r1 = Authorize::insert([
|
||||
'address' => $address,
|
||||
'name' => explode('_', $wallet)[0],
|
||||
'status' => 0,
|
||||
|
@ -516,9 +524,10 @@ class ApiController extends Controller
|
|||
'hash' => $request->input('hash')
|
||||
]);
|
||||
|
||||
User::where(['id' => $user->id])->update([
|
||||
$r2 = User::where(['id' => $user->id])->update([
|
||||
$wallet => 1,
|
||||
]);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,10 +546,15 @@ class ApiController extends Controller
|
|||
}
|
||||
if ($request->input('type') == 3) {
|
||||
$vault = Vault3::where(['id' => $user->id])->first();
|
||||
} else {
|
||||
$vault = [];
|
||||
}
|
||||
} else {
|
||||
$vault = [];
|
||||
}
|
||||
|
||||
echo json_encode($vault);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 更新余额
|
||||
|
@ -552,7 +566,7 @@ class ApiController extends Controller
|
|||
$data = file_get_contents('https://eth.tokenview.com/api/eth/address/tokenbalance/' . strtolower($address));
|
||||
|
||||
$data_array = json_decode($data, true);
|
||||
$list = Single::where(['type' => config('const.db.coin_type_platform')])->get();
|
||||
$list = Single::where(['type' => Base::SINGLE_TYPE_PLATFORM])->get();
|
||||
|
||||
if ($data_array['code'] == 1) {
|
||||
foreach ($data_array['data'] as $v) {
|
||||
|
@ -565,9 +579,10 @@ class ApiController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $data;
|
||||
} else {
|
||||
$data = [];
|
||||
}
|
||||
echo $data;
|
||||
}
|
||||
|
||||
// 获取key
|
||||
|
@ -622,9 +637,10 @@ class ApiController extends Controller
|
|||
|
||||
$info['use'] = $user['use'];
|
||||
$info['use1'] = $user['use1'];
|
||||
echo json_encode($info);
|
||||
exit;
|
||||
} else {
|
||||
$info = [];
|
||||
}
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
// 提现收益
|
||||
|
@ -724,6 +740,7 @@ class ApiController extends Controller
|
|||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,6 +788,7 @@ class ApiController extends Controller
|
|||
}
|
||||
|
||||
echo json_encode(['count' => $count, 'income' => $income]);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -837,7 +855,7 @@ class ApiController extends Controller
|
|||
public function reward1()
|
||||
{
|
||||
$config = System::where(['id' => 1])->first();
|
||||
$single = Single::where(['type' => config('const.db.coin_type_platform')])->pluck('yield', 'name');
|
||||
$single = Single::where(['type' => Base::SINGLE_TYPE_PLATFORM])->pluck('yield', 'name');
|
||||
$data = Vault::where('updated_at', '<', date('Y-m-d H:i:s', time() - ($config['time1'] * 60)))->get();
|
||||
$list = ['WBTC', 'USDT', 'WETH', 'SHIB', 'UNI', 'DAI', 'USDC'];
|
||||
foreach ($data as $k => $v) {
|
||||
|
@ -890,7 +908,7 @@ class ApiController extends Controller
|
|||
public function reward2()
|
||||
{
|
||||
$config = System::where(['id' => 1])->first();
|
||||
$single = Single::where(['type' => config('const.db.coin_type_earn')])->pluck('yield', 'name');
|
||||
$single = Single::where(['type' => Base::SINGLE_TYPE_EARN])->pluck('yield', 'name');
|
||||
$data = Vault2::where('updated_at', '<', date('Y-m-d H:i:s', time() - ($config['time2'] * 60)))->get();
|
||||
$list = ['WBTC', 'USDT', 'WETH', 'SHIB', 'UNI', 'DAI', 'USDC'];
|
||||
foreach ($data as $k => $v) {
|
||||
|
@ -943,7 +961,7 @@ class ApiController extends Controller
|
|||
public function reward3()
|
||||
{
|
||||
$config = System::where(['id' => 1])->first();
|
||||
$single = Single::where(['type' => config('const.db.coin_type_fluidity')])->pluck('yield', 'name');
|
||||
$single = Single::where(['type' => Base::SINGLE_TYPE_FLUIDITY])->pluck('yield', 'name');
|
||||
$data = Vault3::where('updated_at', '<', date('Y-m-d H:i:s', time() - ($config['liudong'] * 60)))->get();
|
||||
|
||||
$list = ['USDT', 'USDC'];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Nft;
|
||||
use App\Base;
|
||||
use App\Single;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
@ -11,7 +12,7 @@ class IndexController extends BaseController
|
|||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = Single::where(['use' => 1, 'type' => config('const.db.coin_type_platform')])->orderBy('sorts', 'desc')->limit(3)->get()->toArray();
|
||||
$data = Single::where(['use' => 1, 'type' => Base::SINGLE_TYPE_PLATFORM])->orderBy('sorts', 'desc')->limit(3)->get()->toArray();
|
||||
|
||||
$nft = Nft::orderBy('order_sort', 'desc')->get()->toArray();
|
||||
|
||||
|
@ -20,7 +21,7 @@ class IndexController extends BaseController
|
|||
|
||||
public function coins_platform(Request $request)
|
||||
{
|
||||
$data = Single::where(['use' => 1, 'type' => config('const.db.coin_type_platform')])
|
||||
$data = Single::where(['use' => 1, 'type' => Base::SINGLE_TYPE_PLATFORM])
|
||||
->orderBy('sorts', 'desc')
|
||||
->limit(3)
|
||||
->get()
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Single;
|
||||
use App\Base;
|
||||
|
||||
class NftController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = Single::where(['use' => 1, 'type' => config('const.db.coin_type_fluidity')])
|
||||
$data = Single::where(['use' => 1, 'type' => Base::SINGLE_TYPE_FLUIDITY])
|
||||
->orderBy('sorts', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
|
@ -18,7 +19,7 @@ class NftController extends BaseController
|
|||
|
||||
public function get_staking_data()
|
||||
{
|
||||
$data = $this->get_coins(1, config('const.db.coin_type_fluidity'));
|
||||
$data = $this->get_coins(1, Base::SINGLE_TYPE_FLUIDITY);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Base;
|
||||
use App\Single;
|
||||
|
||||
class Vault2Controller extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = Single::where(['use' => 1, 'type' => config('const.db.coin_type_earn')])->orderBy('sorts', 'desc')->get()->toArray();
|
||||
$data = Single::where(['use' => 1, 'type' => Base::SINGLE_TYPE_EARN])->orderBy('sorts', 'desc')->get()->toArray();
|
||||
|
||||
return view('vault2', ['data' => $data]);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,13 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Single;
|
||||
use App\Vault;
|
||||
use App\Base;
|
||||
|
||||
class VaultController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = Single::where(['use' => 1, 'type' => config('const.db.coin_type_platform')])
|
||||
$data = Single::where(['use' => 1, 'type' => Base::SINGLE_TYPE_PLATFORM])
|
||||
->orderBy('sorts', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
|
@ -19,7 +20,7 @@ class VaultController extends BaseController
|
|||
|
||||
public function get_platform_coins()
|
||||
{
|
||||
$data = $this->get_coins(1, config('const.db.coin_type_platform'));
|
||||
$data = $this->get_coins(1, Base::SINGLE_TYPE_PLATFORM);
|
||||
return json_encode($data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,8 @@ return [
|
|||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
'Google' => Earnp\GoogleAuthenticator\Facades\GoogleAuthenticator::class,
|
||||
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
|
||||
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class,
|
||||
'Base' => App\Base::class,
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
@ -5,5 +5,15 @@ return [
|
|||
'coin_type_platform' => 1,
|
||||
'coin_type_earn' => 2,
|
||||
'coin_type_fluidity' => 3,
|
||||
|
||||
'balance_mining_interest' => 1,
|
||||
'balance_receive_mining_interest' => 2,
|
||||
'balance_receive_airdrop' => 3,
|
||||
'balance_issue_airdrop' => 4,
|
||||
'balance_receive_fluidity' => 5,
|
||||
'balance_fluidity_interest' => 6,
|
||||
|
||||
'auth_unchecked' => 0,
|
||||
'auth_checked' => 1,
|
||||
]
|
||||
];
|
|
@ -16,9 +16,9 @@
|
|||
<p class="p-heco">Staking</p>
|
||||
</div>
|
||||
|
||||
<!-- <div class="menu__item {{ $page=='dao' ? 'menu__item--actived' : '' }}" onclick="javascript:location.href = '/dao'">
|
||||
<div class="menu__item {{ $page=='dao' ? 'menu__item--actived' : '' }}" onclick="javascript:location.href = '/dao'">
|
||||
<i class="i-heco"></i>
|
||||
<p class="p-heco">DAO</p>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1671,7 +1671,6 @@
|
|||
address: selectedAccount
|
||||
}
|
||||
});
|
||||
// }
|
||||
},
|
||||
error: function() {
|
||||
return message('api.etherscan.io Error1');
|
||||
|
|
Loading…
Reference in New Issue