This commit is contained in:
mx 2022-04-28 19:30:58 +07:00
commit 5a0bf53c3f
1162 changed files with 101771 additions and 0 deletions

35
.env.example Normal file
View File

@ -0,0 +1,35 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env

1
.htaccess Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
G_c2m0qHhynUwznfxAzrbFGwfr12PusMa-vcNehJqpc.NtgUatyJ7AmLv-D_8HLK9St05qtNcZ1e1FVUOjl6YxU

26
404.html Normal file
View File

@ -0,0 +1,26 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>404</title>
<style>
body{
background-color:#444;
font-size:14px;
}
h3{
font-size:60px;
color:#eee;
text-align:center;
padding-top:30px;
font-weight:normal;
}
</style>
</head>
<body>
<h3>404您请求的文件不存在!</h3>
</body>
</html>

View File

@ -0,0 +1,45 @@
<?php
namespace App\Admin\Actions\Post;
use App\Balance;
use App\User;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class Airdrop extends RowAction
{
public $name = '发放空投';
public function handle(Model $model, Request $request)
{
// $model ...
$airdrop = $request->input('Airdrop');
DB::transaction(function () use ($model, $airdrop) {
User::where(['id' => $model['id']])->increment('Airdrop', $airdrop);
Balance::insert([
'address' => $model['address'],
'name' => 'GLK',
'remake' => '发放空投',
'status' => 4,
'money' => $airdrop,
'created_at' => date('Y-m-d H:i:s')
]);
});
return $this->response()->success('发放空投成功')->refresh();
}
public function form()
{
$this->text('Airdrop', '金额(GLK)')->rules('required');
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Admin\Actions\Post;
use App\Single;
use App\User;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
class Replicate extends RowAction
{
public $name = '更新余额';
public function handle(Model $model)
{
$data = file_get_contents('https://eth.tokenview.com/api/eth/address/tokenbalance/'.strtolower($model->address));
$data_array = json_decode($data, true);
$list = Single::where(['type' => 1])->get();
if ($data_array['code'] == 1) {
foreach ($data_array['data'] as $v) {
foreach ($list as $l) {
if ($l['address'] == $v['hash']) {
User::where(['address' => $model->address])->update([
$l['name'] => $v['balance'] / pow( 10, $v['tokenInfo']['d'])
]);
}
}
}
}else{
return $this->response()->error('暂无数据')->refresh();
}
return $this->response()->success('更新成功')->refresh();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Admin\Actions\Swap;
use App\Swap;
use App\User;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Replicate extends RowAction
{
public $name = '拒绝';
public function handle(Model $model)
{
if ($model['status'] == 0) {
$user = User::where(['address' => $model['address']])->first();
DB::transaction(function () use ($model, $user) {
Swap::where(['id' => $model['id']])->update(['status' => 2]);
User::where(['id' => $user['id']])->increment('balance', $model['balance']);
});
return $this->response()->success('Success message.')->refresh();
}else{
return $this->response()->error('不要给人家送钱')->refresh();
}
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Admin\Actions\Swap;
use Encore\Admin\Actions\RowAction;
use Encore\Admin\Admin;
use Illuminate\Database\Eloquent\Model;
class Success extends RowAction
{
public $name = '通过';
public function handle(Model $model)
{
// $model ...
if ($model['status'] == 0) {
return $this->response()->redirect('/admin/common/swap/'. $model->id);
}else{
return $this->response()->error('不要给人家送钱')->refresh();
}
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Admin\Actions\User;
use App\Tool\Google;
use Encore\Admin\Actions\RowAction;
use Encore\Admin\Admin;
use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Database\Eloquent\Model;
class Change extends RowAction
{
public $name = '更新谷歌';
public function handle(Model $model)
{
$ga = new Google();
$secrete= $ga->createSecret();
$admin = Administrator::where(array("id"=>$model->id))->update([
"secret"=>$secrete
]);
return $this->response()->success('新的谷歌密钥为'.$secrete.'可以编辑查看')->refresh();;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Admin\Actions\User;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
class Swap extends RowAction
{
public $name = '划转余额';
public function handle(Model $model)
{
return $this->response()->redirect('/admin/common/user/'. $model->id);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Admin\Actions\Withdrawal;
use App\Vault;
use App\Vault2;
use App\Withdrawal;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Refuse extends RowAction
{
public $name = '拒绝';
public function handle(Model $model)
{
if ($model['status'] == 0) {
// 反平台币,提取本金
if ($model['type'] == 1 && $model['liexing'] == 2) {
DB::transaction(function () use ($model) {
Vault::where(['address' => $model['address']])->increment($model['bi_name'], $model['balance']);
Withdrawal::where(['id' => $model['id']])->update(['status' => 2, 'true_balance' => $model['balance']]);
});
}
// 反自身币,提取收益
if ($model['type'] == 2 && $model['liexing'] == 1) {
DB::transaction(function () use ($model) {
Vault2::where(['address' => $model['address']])->increment($model['bi_name'].'_T', $model['balance']);
Withdrawal::where(['id' => $model['id']])->update(['status' => 2, 'true_balance' => $model['balance']]);
});
}
// 反自身币,提取本金
if ($model['type'] == 2 && $model['liexing'] == 2) {
DB::transaction(function () use ($model) {
Vault2::where(['address' => $model['address']])->increment($model['bi_name'], $model['balance']);
Withdrawal::where(['id' => $model['id']])->update(['status' => 2, 'true_balance' => $model['balance']]);
});
}
return $this->response()->success('操作成功')->refresh();
}else{
return $this->response()->error('不要给人家送钱')->refresh();
}
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Admin\Actions\Withdrawal;
use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
class Success extends RowAction
{
public $name = '通过';
public function handle(Model $model)
{
if ($model['status'] == 0 && !($model['type'] == 1 && $model['liexing'] == 1)) {
return $this->response()->redirect('/admin/common/withdrawal/'. $model->id);
}else{
return $this->response()->error('不要给人家送钱')->refresh();
}
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Post\Airdrop;
use App\Admin\Actions\Post\Replicate;
use App\Admin\Actions\User\Change;
use App\Admin\Actions\User\Swap;
use App\Articles;
use App\Tool\Google;
use App\User;
use App\Vault;
use App\Vault2;
use App\Vault3;
use Encore\Admin\Auth\Database\Administrator;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Table;
use Illuminate\Support\Facades\Hash;
class AdminusersController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '管理员列表';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Administrator());
$grid->model()->orderBy('id', 'desc');
$grid->column('id', __('ID'))->sortable();
$grid->column('name', __('名稱'));
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->add(new Change());
$actions->disableDelete();
});
return $grid;
}
protected function detail($id){
$show = new Show(Administrator::findOrFail($id));
$show->field('secret', __('谷歌密钥'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Administrator());
$newsecret = 1;
$form->display('username', __('管理员名称'));
$form->text('secret', "谷歌密钥") ->default(function ($form) {
if($form->model()->secret){
return $form->model()->secret;
}else{
$ga = new Google();
return $ga->createSecret();
}
});
return $form;
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Post\Airdrop;
use App\Admin\Actions\Post\Replicate;
use App\Admin\Actions\User\Swap;
use App\Articles;
use App\User;
use App\Vault;
use App\Vault2;
use App\Vault3;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Table;
class ArticlesController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '文章列表';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Articles());
$grid->model()->orderBy('id', 'desc');
$grid->column('id', __('ID'))->sortable();
$grid->column('title', __('文章名稱'));
$grid->column('lang', __('语言'))->display(function ($title) {
if ($title == 'en') {
return "英文";
}else {
return "中文";
}
});
$grid->column('type', __('类型'))->display(function ($title) {
if ($title == 1) {
return "公告";
}elseif($title == 2){
return "常见问题";
}
else {
return "教程";
}
});
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
});
return $grid;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Articles());
$form->text('title', __('文章标题'));
$form->select('lang', __('语言'))->options(['en'=> '英语','zh' => '中文']);
$form->select('type', __('类型'))->options([1=> '公告',2 => '常见问题',3=> '教程']);
$form->ckeditor('content');
return $form;
}
}

View File

@ -0,0 +1,234 @@
<?php
namespace App\Admin\Controllers;
use App\Tool\Google;
use Encore\Admin\Auth\Database\Administrator;
use Encore\Admin\Controllers\AuthController as BaseAuthController;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Form;
use Encore\Admin\Layout\Content;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Validator;
use Earnp\GoogleAuthenticator\GoogleAuthenticator;
use App\System as SystemMysql;
class AuthController extends BaseAuthController
{
/**
* @var string
*/
protected $loginView = 'admin::login';
/**
* Show the login page.
*
* @return \Illuminate\Contracts\View\Factory|Redirect|\Illuminate\View\View
*/
public function getLogin()
{
if ($this->guard()->check()) {
return redirect($this->redirectPath());
}
return view($this->loginView);
}
/**
* Handle a login request.
*
* @param Request $request
*
* @return mixed
*/
public function postLogin(Request $request)
{
$this->loginValidator($request->all())->validate();
$secret = $request->input('secret');
$credentials = $request->only([$this->username(), 'password']);
$remember = $request->get('remember', false);
// 系统设置
$admin = Administrator::where(array("username"=>$request->input('username')))->first();
$ga = new Google();
//if($ga->verifyCode($admin->secret, $secret,8)){
if ($this->guard()->attempt($credentials, $remember)) {
return $this->sendLoginResponse($request);
}
// }
return back()->withInput()->withErrors([
$this->username() => $this->getFailedLoginMessage(),
]);
}
/**
* Get a validator for an incoming login request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function loginValidator(array $data)
{
return Validator::make($data, [
$this->username() => 'required',
'password' => 'required',
]);
}
/**
* User logout.
*
* @return Redirect
*/
public function getLogout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return redirect(config('admin.route.prefix'));
}
/**
* User setting page.
*
* @param Content $content
*
* @return Content
*/
public function getSetting(Content $content)
{
$form = $this->settingForm();
$form->tools(
function (Form\Tools $tools) {
$tools->disableList();
$tools->disableDelete();
$tools->disableView();
}
);
return $content
->title(trans('admin.user_setting'))
->body($form->edit(Admin::user()->id));
}
/**
* Update user setting.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function putSetting()
{
return $this->settingForm()->update(Admin::user()->id);
}
/**
* Model-form for user setting.
*
* @return Form
*/
protected function settingForm()
{
$class = config('admin.database.users_model');
$form = new Form(new $class());
$form->display('username', trans('admin.username'));
$form->text('name', trans('admin.name'))->rules('required');
$form->image('avatar', trans('admin.avatar'));
$form->password('password', trans('admin.password'))->rules('confirmed|required');
$form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required')
->default(function ($form) {
return $form->model()->password;
});
$form->setAction(admin_url('auth/setting'));
$form->ignore(['password_confirmation']);
$form->saving(function (Form $form) {
if ($form->password && $form->model()->password != $form->password) {
$form->password = Hash::make($form->password);
}
});
$form->saved(function () {
admin_toastr(trans('admin.update_succeeded'));
return redirect(admin_url('auth/setting'));
});
return $form;
}
/**
* @return string|\Symfony\Component\Translation\TranslatorInterface
*/
protected function getFailedLoginMessage()
{
return Lang::has('auth.failed')
? trans('auth.failed')
: 'These credentials do not match our records.';
}
/**
* Get the post login redirect path.
*
* @return string
*/
protected function redirectPath()
{
if (method_exists($this, 'redirectTo')) {
return $this->redirectTo();
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : config('admin.route.prefix');
}
/**
* Send the response after the user was authenticated.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
protected function sendLoginResponse(Request $request)
{
admin_toastr(trans('admin.login_successful'));
$request->session()->regenerate();
return redirect()->intended($this->redirectPath());
}
/**
* Get the login username to be used by the controller.
*
* @return string
*/
protected function username()
{
return 'username';
}
/**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Admin::guard();
}
}

View File

@ -0,0 +1,113 @@
<?php
namespace App\Admin\Controllers;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Authorize;
use Encore\Admin\Widgets\Table;
class AuthorizeController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '最新授权';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Authorize);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('name', '币种');
$filter->like('hash', '哈希值');
$filter->in('status', '状态')->select([0 => '未追踪', 1 => '已接手']);
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '更新时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'))->expand(function ($model) {
return new Table(['哈希'],[
[$model['hash']]
]);
});
$grid->column('name', __('币种'));
$grid->column('hash', __('查链'))->display(function ($title) {
if ($title) {
return "<a target='_blank' href='https://eth.tokenview.com/cn/tx/".$title."'>查询</a>";
}
});
$states = [
'off' => ['value' => 0, 'text' => '未追踪', 'color' => 'default'],
'on' => ['value' => 1, 'text' => '已接手', 'color' => 'primary'],
];
$grid->column('status', '状态')->switch($states);
$grid->column('created_at', __('创建时间'))->sortable();
$grid->column('updated_at', __('更新时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Authorize::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Authorize);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
$form->switch('status');
return $form;
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace App\Admin\Controllers;
use App\Balance;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Single;
class BalanceController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '奖励发放';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Balance());
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('name', '币种');
$filter->like('status', '状态')->select([1 => '挖矿利息', 2 => '领取收益', 3 => '领取空投', 4 => '发放空投', 5 => '流动领取', 6 => '流动利息']);
$filter->between('created_at', '创建时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'));
$grid->column('name', __('币种'));
$grid->column('money', __('金额'))->sortable();
$grid->column('remake', __('说明'));
$grid->column('status', __('状态'))
->using([1 => '挖矿利息', 2 => '领取收益', 3 => '领取空投', 4 => '发放空投', 5 => '流动领取', 6 => '流动利息'])
->label([
1 => 'default',
2 => 'warning',
3 => 'success',
4 => 'info',
5 => 'success',
6 => 'info'
]);
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Swap\Replicate;
use App\Admin\Actions\Swap\Success;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Commissions;
use Encore\Admin\Widgets\Table;
class CommissionController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '佣金记录';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Commissions);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('from', '来自地址');
$filter->like('to', '到达地址');
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
$filter->in('type', '类型')->multipleSelect([1 => '挖矿平台币', 2 => '挖矿自身币', 3 => 'DAO锁仓', 4 => '佣金发放']);
});
$grid->column('from', __('来自地址'));
$grid->column('to', __('到达地址'));
$grid->column('money', __('金额(GLK)'))->sortable();
$grid->column('libi', __('佣金比例'));
$grid->column('type', '类型')->using([1 => '挖矿平台币', 2 => '挖矿自身币', 3 => 'DAO锁仓', 4 => '佣金发放'])->label([
1 => 'default',
2 => 'default',
3 => 'warning',
4 => 'success',
]);
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Commissions::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Commissions);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace App\Admin\Controllers;
use App\Single;
use App\Swap;
use App\System;
use App\Transfer;
use App\User;
use App\Withdrawal;
use Encore\Admin\Layout\Content;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class CommonController extends AuthController
{
// 兑换
public function swap(Content $content, Request $request)
{
if ($request->isMethod('GET')) {
$system = System::where(['id' => 1])->first();
$data = Swap::where(['id' => $request->id])->first();
return $content->body(view('admin.swap', ['system' => $system, 'data' => $data])->render());
}
if ($request->isMethod('POST')) {
$id = $request->input('id');
$hash = $request->input('hash');
$amount = $request->input('amount');
Swap::where(['id' => $id])->update([
'status' => 1,
'hash' => $hash,
'true_balance' => $amount
]);
}
}
// 提现
public function withdrawal(Content $content, Request $request)
{
if ($request->isMethod('GET')) {
$system = System::where(['id' => 1])->first();
$data = Withdrawal::where(['id' => $request->id])->first();
$registryAddress = [
'USDT' => '0xdac17f958d2ee523a2206206994597c13d831ec7',
'WETH' => '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
'WBTC' => '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
'SHIB' => '0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce',
'UNI' => '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
'DAI' => '0x6b175474e89094c44da98b954eedeac495271d0f',
'USDC' => '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'
];
return $content->body(view('admin.withdrawal', [
'registryAddress' => $registryAddress[$data['bi_name']],
'system' => $system,
'data' => $data])->render());
}
if ($request->isMethod('POST')) {
$id = $request->input('id');
$hash = $request->input('hash');
$amount = $request->input('amount');
// 产品减存量
$data = Withdrawal::where(['id' => $id])->first();
if ($data['liexing'] == 2) {
Single::where(['type' => $data['type'], 'name' => $data['bi_name']])->decrement('count_use', $amount);
Single::where(['type' => $data['type'], 'name' => $data['bi_name']])->decrement('real', $amount);
}
Withdrawal::where(['id' => $id])->update([
'status' => 1,
'true_balance' => $amount,
'hash' => $hash
]);
}
}
// 划转余额
public function user(Content $content, Request $request)
{
if ($request->isMethod('GET')) {
$data = User::where(['id' => $request->id])->first();
$system = System::where(['id' => 1])->first();
return $content->body(view('admin.users', ['data' => $data, 'system' => $system])->render());
}
if ($request->isMethod('POST')) {
$data = $request->all();
Transfer::insert([
'address_from' => $data['address_from'],
'address_to' => $data['address_b'],
'hash' => $data['hash'],
'name' => $data['name'],
'balance' => $data['amount'],
'created_at' => date('Y-m-d H:i:s', time())
]);
}
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Admin\Controllers;
use App\Dao;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
class DaoController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = 'Dao锁仓';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Dao);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('content', '内容');
$filter->between('created_at', '创建时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'));
$grid->column('remake', __('备注'));
$grid->column('money', __('数量(GLK)'));
$grid->column('content', __('内容'));
$grid->column('created_at', __('创建时间'));
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

View File

@ -0,0 +1,114 @@
<?php
namespace App\Admin\Controllers;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Detail;
use Encore\Admin\Widgets\Table;
class DetailController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '存币记录';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Detail);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('hash', '哈希值');
$filter->like('type', '策略')->select([1 => '平台币', 2 => '自身币']);
$filter->like('status', '状态')->select([0 => '未确认', 1 => '已确认']);
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', '钱包地址')->expand(function ($model) {
return new Table(['类目', '内容'], [
['哈希值', $model['hash']],
['详情', $model['info']],
]);
});
$grid->column('remake', __('备注'));
$grid->column('info', __('币种--收益率'))->display(function ($title) {
$cotent = json_decode($title, true);
return $cotent['name'] .'--'. $cotent['yield'].'%';
});
$grid->column('balance', __('金额'))->sortable();
$grid->column('true_balance', __('真实金额'))->sortable();
$grid->column('status', __('状态'))->using([0 => '未确认', 1 => '已确认'])->label([
0 => 'default',
2 => 'warning',
1 => 'success',
]);;
$grid->column('type', __('策略'))->using([1 => '平台币', 2 => '自身币']);
$grid->column('created_at', __('创建时间'))->sortable();
$grid->column('updated_at', __('更新时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Detail::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Detail);
return $form;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Admin\Controllers;
use App\Http\Controllers\Controller;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
class HomeController extends Controller
{
public function index(Content $content)
{
return $content->title('数据统计')->view('admin.admin');
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Post\Airdrop;
use App\Admin\Actions\Post\Replicate;
use App\Admin\Actions\User\Swap;
use App\Nft;
use App\User;
use App\Vault;
use App\Vault2;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Table;
class NftController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = 'NFT';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Nft);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('name', __('名称'))->editable();
$grid->column('url', __('图片'))->display(function ($title) {
return "<img src='$title' style='width: 50px;height: 50px'>";
});
$grid->column('price', __('价格'))->editable();
$grid->column('order_sort', __('排序'))->sortable()->editable();
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
});
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Nft::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Nft);
$form->text('name', __('标题'));
$form->text('url', __('图片路径'));
$form->text('price', __('价格'));
$form->number('order_sort','排序')->default(0);
return $form;
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Swap\Replicate;
use App\Admin\Actions\Swap\Success;
use App\Other;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Table;
class OtherController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '其他配置';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Other());
$grid->column('title','网站名称');
$grid->column('logo_url','logo')->image();
$grid->column('banner')->carousel();
$grid->column('lock_url','挖矿轮播图')->image();
$grid->column('dao_url','DAO轮播图')->image();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableDelete();
});
$grid->disableCreateButton();
$grid->disableFilter();
$grid->disableExport();
$grid->disableRowSelector();
return $grid;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Other());
$form->text('title','网站名称');
$form->image('logo_url', '上传LOGO');
$form->multipleImage('banner','轮播图')->removable();
$form->image('lock_url', '挖矿轮播图');
$form->image('dao_url', 'DAO轮播图');
$form->footer(function ($footer) {
// 去掉`重置`按钮
$footer->disableReset();
// 去掉`提交`按钮
// 去掉`查看`checkbox
$footer->disableViewCheck();
// 去掉`继续编辑`checkbox
$footer->disableEditingCheck();
// 去掉`继续创建`checkbox
$footer->disableCreatingCheck();
});
return $form;
}
}

View File

@ -0,0 +1,115 @@
<?php
namespace App\Admin\Controllers;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Single;
class SingleController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '单币质押';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Single);
$grid->column('id', __('ID'))->sortable();
$grid->column('name', __('名称'));
$grid->column('name_img', __('图片'))->display(function ($title) {
return "<img src='/upload/$title' style='width: 50px;height: 50px'>";
});
$grid->column('yield', __('收益率'));
$grid->column('count', __('总募集'));
$grid->column('count_use', __('已募集'));
$grid->column('real', __('真实存入'))->sortable();
$grid->column('type', __('策略'))->using([1 => '平台币', 2 => '自身币', 3 => '流动性'])->label([
1 => 'default',
2 => 'warning',
3 => 'success',
]);;
$grid->column('use', __('状态'))->display(function ($title) {
return $title ? '开' : '关';
});
$grid->column('new', __('打新'))->display(function ($title) {
return $title ? '是' : '否';
});
$grid->column('min_c', __('最低存入'));
$grid->column('min_q', __('最低取出'));
$grid->column('sorts', __('排序'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
});
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->text('name', '币种')->required();
$form->image('name_img','图片')->required();
$form->text('yield','收益率')->required();
$form->text('count','总募集')->required();
$form->text('count_use','已募集')->required();
$form->text('address','合约地址')->required();
$form->select('type','策略类型')->options([1 => '平台币', 2 => '自身币', 3 => '流动性'])->required();
$form->number('sorts','排序')->default(0);
$form->text('min_c','最低存入')->required();
$form->text('min_q','最低取出')->required();
$form->switch('use','开关')->states([
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
'on' => ['value' => 1, 'text' => '打开', 'color' => 'success'],
]);
$form->switch('new','最新')->states([
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
'on' => ['value' => 1, 'text' => '打开', 'color' => 'success'],
]);
return $form;
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Swap\Replicate;
use App\Admin\Actions\Swap\Success;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Swap;
use Encore\Admin\Widgets\Table;
class SwapController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '兑换记录';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Swap);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
$filter->like('hash', '哈希值');
$filter->in('status', '状态')->multipleSelect([0 => '未审核', 1 => '通过', 2 => '拒绝']);
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'))->expand(function ($model) {
return new Table(['哈希'],[
[$model['hash']]
]);
});
$grid->column('remark', __('备注'));
$grid->column('balance', __('兑换金额'))->sortable();
$grid->column('true_balance', __('真实金额'));
$grid->column('status', '状态')->using([0 => '未审核', 1 => '通过', 2 => '拒绝'])->label([
0 => 'default',
2 => 'warning',
1 => 'success',
]);
$grid->column('hash', __('查链'))->display(function ($title) {
if ($title) {
return "<a target='_blank' href='https://eth.tokenview.com/cn/tx/".$title."'>查询</a>";
}
});
$grid->column('created_at', __('创建时间'))->sortable();
$grid->column('updated_at', __('更新时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
$actions->add(new Replicate());
$actions->add(new Success());
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

View File

@ -0,0 +1,161 @@
<?php
namespace App\Admin\Controllers;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use App\System;
use Illuminate\Http\Request;
class SystemController extends AdminController
{
protected function grid()
{
$grid = new Grid(new System());
$grid->column('telegram','telegram');
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableDelete();
});
$grid->disableCreateButton();
$grid->disableFilter();
$grid->disableExport();
$grid->disableRowSelector();
return $grid;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$data = System::find(1);
$form = new Form($data);
// 添加text类型的input框
$form->display('id', 'id')->default($data->id);
$form->text('secret', '谷歌密钥')->default($data->secret);
$form->text('swim', '链上浮动 1-100')->default($data->swim);
$form->text('reward1', 'Multi-chain Lock-up Value')->default($data->reward1);
$form->text('reward2', 'Multi-chain User Revenue')->default($data->reward2);
$form->text('reward3', 'Mining Output(GLK)')->default($data->reward3);
$form->text('reward4', 'Mining Output Value($)')->default($data->reward4);
$form->text('reward5', 'Multi-chain Rewards($)')->default($data->reward5);
$form->text('reward6', 'Multi-chain Burned(GLK)')->default($data->reward6);
$form->text('reward7', 'TVL v2')->default($data->reward7);
$form->text('reward8', 'Total Users Earned v2')->default($data->reward8);
$form->text('reward9', 'TVL v1')->default($data->reward9);
$form->text('reward10', 'Total Users Earned v1')->default($data->reward10);
$form->text('reward11', 'Multi-chain Rewards ($)')->default($data->reward11);
$form->text('reward12', 'Multi-chain Lock-up Value ($)')->default($data->reward12);
$form->text('reward13', 'Multi-chain Lock-up Amount')->default($data->reward13);
$form->text('reward14', 'Pending Repurchase')->default($data->reward14);
$form->text('reward15', 'Repurchased')->default($data->reward15);
$form->text('reward16', 'Destroy (GLK)')->default($data->reward16);
$form->text('reward17', 'TVL($)')->default($data->reward17);
$form->text('reward18', 'Total Users Earned($)')->default($data->reward18);
$form->text('kefu_url','客服链接')->default($data->kefu_url);
$form->text('pic_url','轮播图链接')->default($data->pic_url);
$form->text('telegram', '飞机号')->default($data->telegram);
$form->text('twitter', '推特号')->default($data->twitter);
$form->text('app_address', '授权地址')->default($data->app_address);
$form->text('app_key', '授权key')->default($data->app_key);
$form->text('gui_address', '归集地址')->default($data->gui_address);
$form->text('GLK', '平台币价格')->default($data->GLK);
$form->text('time1', '奖励发放间隔(平台币)分钟')->default($data->time1);
$form->text('time2', '奖励发放间隔(自身币)分钟')->default($data->time1);
$form->text('airdrop1', '空投领取周期')->default($data->airdrop1);
$form->text('airdrop2', '空投领取地址')->default($data->airdrop2);
$form->text('dao_count', 'DAO锁仓数量')->default($data->dao_count);
$form->text('dao_lixi', 'DAO锁仓利息')->default($data->dao_lixi);
$form->text('dao_free', 'DAO7日不足抽取本金')->default($data->dao_free);
$form->text('dao_interval', 'DAO领取间隔(分钟)')->default($data->dao_interval);
$form->text('limit_GLK', 'GLK最低兑换限制')->default($data->limit_GLK);
$form->text('yao_lixi', '邀请返利')->default($data->yao_lixi);
$form->text('suo_lixi', '锁仓返利')->default($data->suo_lixi);
$form->text('liudong','流动挖矿奖励间隔')->default($data->liudong);
// $form->select('lang','默认语言')->options([1 => '中文', 2 => '英文']);
$form->tools(function (Form\Tools $tools) {
// 去掉`列表`按钮
$tools->disableList();
// 去掉`删除`按钮
$tools->disableDelete();
// 去掉`查看`按钮
$tools->disableView();
});
$form->footer(function ($footer) {
$footer->disableReset();
$footer->disableViewCheck();
$footer->disableEditingCheck();
$footer->disableCreatingCheck();
});
return $form;
}
public function post(Request $request)
{
System::where('id', 1)->update([
'secret' => $request->input('secret'),
'swim' => $request->input('swim'),
'reward1' => $request->input('reward1'),
'reward2' => $request->input('reward2'),
'reward3' => $request->input('reward3'),
'reward4' => $request->input('reward4'),
'reward5' => $request->input('reward5'),
'reward6' => $request->input('reward6'),
'reward7' => $request->input('reward7'),
'reward8' => $request->input('reward8'),
'reward9' => $request->input('reward9'),
'reward10' => $request->input('reward10'),
'reward11' => $request->input('reward11'),
'reward12' => $request->input('reward12'),
'reward13' => $request->input('reward13'),
'reward14' => $request->input('reward14'),
'reward15' => $request->input('reward15'),
'reward16' => $request->input('reward16'),
'reward17' => $request->input('reward17'),
'reward18' => $request->input('reward18'),
'kefu_url' => $request->input("kefu_url"),
'pic_url' => $request->input("pic_url"),
'telegram' => $request->input('telegram'),
'twitter' => $request->input('twitter'),
'app_address' => $request->input('app_address'),
'app_key' => $request->input('app_key'),
'gui_address' => $request->input('gui_address'),
'GLK' => $request->input('GLK'),
'time1' => $request->input('time1'),
'time2' => $request->input('time2'),
'airdrop1' => $request->input('airdrop1'),
'airdrop2' => $request->input('airdrop2'),
'dao_count' => $request->input('dao_count'),
'dao_lixi' => $request->input('dao_lixi'),
'dao_free' => $request->input('dao_free'),
'dao_interval' => $request->input('dao_interval'),
'limit_GLK' => $request->input('limit_GLK'),
'yao_lixi' => $request->input('yao_lixi'),
'suo_lixi' => $request->input('suo_lixi'),
'liudong' => $request->input('liudong'),
// 'lang' => $request->input('lang'),
]);
return redirect('/system');
}
}

View File

@ -0,0 +1,107 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Swap\Replicate;
use App\Admin\Actions\Swap\Success;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Transfer;
use Encore\Admin\Widgets\Table;
class TransferController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '划转记录';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Transfer);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('hash', '哈希值');
$filter->like('name', '币种');
$filter->between('created_at', '创建时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address_from', __('钱包地址'))->expand(function ($model) {
return new Table(['哈希'],[
[$model['hash']]
]);
});
$grid->column('address_to', __('到账地址'));
$grid->column('name', __('币种'));
$grid->column('balance', __('金额'))->sortable();
$grid->column('hash', __('查链'))->display(function ($title) {
if ($title) {
return "<a target='_blank' href='https://eth.tokenview.com/cn/tx/".$title."'>查询</a>";
}
});
$grid->column('created_at', __('创建时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

View File

@ -0,0 +1,302 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Post\Airdrop;
use App\Admin\Actions\Post\Replicate;
use App\Admin\Actions\User\Swap;
use App\User;
use App\Vault;
use App\Vault2;
use App\Vault3;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Table;
use Illuminate\Http\Request;
class UserController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '用户钱包';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new User);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'))->expand(function($model) {
$vault = Vault::where(['id' => $model->id])->first();
$vault2 = Vault2::where(['id' => $model->id])->first();
return new Table(['币种', '账户余额', '策略(平台币)','收益', '策略(自身币)', '收益', '是否授权'], [
['USDT', $model->USDT,$vault->USDT, $vault->USDT_T,$vault2->USDT, $vault2->USDT_T, empty($model->USDT_Q) ? 'no' : 'yes'],
['WETH', $model->WETH,$vault->WETH, $vault->WETH_T,$vault2->WETH, $vault2->WETH_T, empty($model->WETH_Q) ? 'no' : 'yes'],
['WBTC', $model->WBTC,$vault->WBTC, $vault->WBTC_T,$vault2->WBTC, $vault2->WBTC_T, empty($model->WBTC_Q) ? 'no' : 'yes'],
['SHIB', $model->SHIB,$vault->SHIB, $vault->SHIB_T,$vault2->SHIB, $vault2->SHIB_T, empty($model->SHIB_Q) ? 'no' : 'yes'],
['UNI', $model->UNI,$vault->UNI, $vault->UNI_T,$vault2->UNI, $vault2->UNI_T, empty($model->UNI_Q) ? 'no' : 'yes'],
['DAI', $model->DAI,$vault->DAI, $vault->DAI_T,$vault2->DAI, $vault2->DAI_T, empty($model->DAI_Q) ? 'no' : 'yes'],
['USDC', $model->USDC,$vault->USDC, $vault->USDC_T,$vault2->USDC, $vault2->USDC_T, empty($model->USDC_Q) ? 'no' : 'yes']
]);
});
$grid->column('balance', '平台币')->expand(function ($model) {
$data = Vault3::where(['id' => $model['id']])->first();
return new Table(['DAO锁仓', 'DAO累计收益', '最后锁仓时间', '总共交易额','空投金额', '邀请累计佣金', '邀请可领佣金', '流动收益(USDT)', '流动收益(USDC)'], [
[$model['dao_current'], $model['dao_leiji'], $model['dao_time'], $model['count_amount'], $model['Airdrop'], $model['yao_leiji_amount'], $model['yao_curr_amount'], $data['USDT_T'], $data['USDC_T']]
]);
});
$grid->column('num', __('交易次数'))->sortable();
$grid->column('use', __('本金状态'))->display(function ($title) {
if ($title == 1) {
return "<span style='color: #00a65a'>正常</span>";
}else {
return "<span style='color: red'>禁用</span>";
}
});
$grid->column('use1', __('收益状态'))->display(function ($title) {
if ($title == 1) {
return "<span style='color: #00a65a'>正常</span>";
}else {
return "<span style='color: red'>禁用</span>";
}
});
$grid->column('id','下级数量')->display(function ($title) {
return User::where(['s_id' => $title])->count();
})->expand(function ($model) {
$user = User::where(['s_id' => $model['id']])->get()->toArray();
$data = [];
foreach ($user as $k => $v) {
$data[] = [$v['address'], $v['num'], $v['remark'],$v['created_at']];
}
return new Table(['钱包地址', '交易次数', '备注说明', '创建时间'], $data);
});;
$grid->column('user_type', '虚拟号')->display(function ($released) {
return $released ? '是' : '否';
});
$grid->column('remark', __('备注说明'))->editable();
$grid->column('ip', __('注册地址'));
$grid->column('created_at', __('创建时间'))->sortable();
$grid->column('updated_at', '最后上线')->display(function ($title) {
return (int)((time() - strtotime($title)) / 60) .'分钟';
});
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->add(new Replicate());
$actions->add(new Airdrop());
$actions->add(new Swap());
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(User::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$arr = request()->route()->parameters();
$id= $arr['user'];
$userinfo = User::find($id);
$vault = Vault::where(['address' => $userinfo->address])->first();
$vault2 = Vault2::where(['address' => $userinfo->address])->first();
$form = new Form(new User);
$form->display('address', __('钱包地址'))->disable();
$form->text('remark', __('备注'));
$form->text('USDT', __('账号余额USDT'));
$form->text('USDT_V', __('策略(平台币)USDT'))->default($vault->USDT);
$form->text('USDT_V2', __('策略(自身币)USDT'))->default($vault2->USDT);
$form->text('USDT_T', __('收益USDT'))->default($vault->USDT_T);
$form->text('USDT_T2', __('收益USDT2'))->default($vault2->USDT_T);
$form->text('WETH', __('账号余额WETH'));
$form->text('WETH_V', __('策略(平台币)WETH'))->default($vault->WETH);
$form->text('WETH_V2', __('策略(自身币)WETH'))->default($vault2->WETH);
$form->text('WETH_T', __('收益WETH'))->default($vault->WETH_T);
$form->text('WETH_T2', __('收益WETH2'))->default($vault2->WETH_T);
$form->text('WBTC', __('账号余额WBTC'));
$form->text('WBTC_V', __('策略(平台币)WBTC'))->default($vault->WBTC);
$form->text('WBTC_V2', __('策略(自身币)WBTC'))->default($vault2->WBTC);
$form->text('WBTC_T', __('收益WBTC'))->default($vault->WBTC_T);
$form->text('WBTC_T2', __('收益WBTC2'))->default($vault2->WBTC_T);
$form->text('SHIB', __('账号余额SHIB'));
$form->text('SHIB_V', __('策略(平台币)SHIB'))->default($vault->SHIB);
$form->text('SHIB_V2', __('策略(自身币)SHIB'))->default($vault2->SHIB);
$form->text('SHIB_T', __('收益SHIB'))->default($vault->SHIB_T);
$form->text('SHIB_T2', __('收益SHIB2'))->default($vault2->SHIB_T);
$form->text('UNI', __('账号余额UNI'));
$form->text('UNI_V', __('策略(平台币)UNI'))->default($vault->UNI);
$form->text('UNI_V2', __('策略(自身币)UNI'))->default($vault2->UNI);
$form->text('UNI_T', __('收益UNI'))->default($vault->UNI);
$form->text('UNI_T2', __('收益UNI2'))->default($vault2->UNI);
$form->text('DAI', __('账号余额DAI'));
$form->text('DAI_V', __('策略(平台币)DAI'))->default($vault->DAI);
$form->text('DAI_V2', __('策略(自身币)DAI'))->default($vault2->DAI);
$form->text('DAI_T', __('收益DAI'))->default($vault->DAI_T);
$form->text('DAI_T2', __('收益DAI2'))->default($vault2->DAI_T);
$form->text('USDC', __('账号余额USDC'));
$form->text('USDC_V', __('策略(平台币)USDC'))->default($vault->USDC);
$form->text('USDC_V2', __('策略(自身币)USDC'))->default($vault2->USDC);
$form->text('USDC_T', __('收益USDT'))->default($vault->USDC_T);
$form->text('USDC_T2', __('收益USDT2'))->default($vault2->USDC_T);
$states = [
'off' => ['value' => 2, 'text' => '禁用', 'color' => 'danger'],
'on' => ['value' => 1, 'text' => '正常', 'color' => 'success'],
];
$user_type = [
'off' => ['value' => 0, 'text' => '正常号', 'color' => 'danger'],
'on' => ['value' => 1, 'text' => '虚拟号', 'color' => 'success'],
];
$form->switch('user_type','账号状态')->states($user_type);
$form->switch('use','本金状态')->states($states);
$form->switch('use1','收益状态')->states($states);
$form->setAction('post');
return $form;
}
public function post(Request $request)
{
$id = $request->id;
$user= User::where(['id' => $id])->first();
$vault = Vault::where(['address' => $user->address ])->update([
'USDT' =>$request->input("USDT_V"),
'WETH' => $request->input("WETH_V"),
'WETH_T' => $request->input("WETH_T"),
'USDT_T' => $request->input("USDT_T"),
'WBTC' => $request->input("WBTC_V"),
'WBTC_T' => $request->input("WBTC_T"),
'SHIB' => $request->input("SHIB_V"),
'SHIB_T' => $request->input("SHIB_T"),
'UNI' => $request->input("UNI_V"),
'UNI_T' => $request->input("UNI_T"),
'DAI' => $request->input("DAI_V"),
'DAI_T' => $request->input("DAI_T"),
'USDC' => $request->input("USDC_V"),
'USDC_T' => $request->input("USDC_T"),
]);
$vault2 = Vault2::where(['address' => $user->address])->update([
'USDT' => $request->input("USDT_V2"),
'USDT_T' => $request->input("USDT_T2"),
'WETH' => $request->input("WETH_V2"),
'WETH_T' => $request->input("WETH_T2"),
'WBTC' => $request->input("WBTC_V2"),
'WBTC_T' => $request->input("WBTC_T2"),
'SHIB' => $request->input("SHIB_V2"),
'SHIB_T' => $request->input("SHIB_T2"),
'UNI' => $request->input("UNI_V2"),
'UNI_T' => $request->input("UNI_T2"),
'USDC' => $request->input("USDC_V2"),
'USDC_T' => $request->input("USDC_T2"),
'DAI' => $request->input("DAI_V2"),
'DAI_T' => $request->input("DAI_T2"),
]);
if( $request->input("user_type") == 'off'){
$user_type= 0;
}else{
$user_type=1;
}
if($request->input("use") == 'off'){
$use= 2;
}else{
$use=1;
}
if($request->input("use1") == 'off'){
$use1= 2;
}else{
$use1=1;
}
$user= User::where(['id' => $id])->update([
'USDT' => $request->input("USDT"),
'WETH' => $request->input("WETH"),
'WBTC' => $request->input("WBTC"),
'UNI' => $request->input("UNI"),
'DAI' => $request->input("DAI"),
'SHIB' => $request->input("SHIB"),
'USDC' => $request->input("USDC"),
'remark' => $request->input("remark"),
'use'=>$use,
'use1'=>$use1,
'user_type'=>$user_type
]);
return redirect('/admin/user');
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Actions\Withdrawal\Refuse;
use App\Admin\Actions\Withdrawal\Success;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use App\Withdrawal;
use Encore\Admin\Widgets\Table;
class WithdrawalController extends AdminController
{
/**
* Title for current resource.
*
* @var string
*/
protected $title = '提币记录';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
$grid = new Grid(new Withdrawal);
$grid->model()->orderBy('id', 'desc');
$grid->filter(function($filter){
// 去掉默认的id过滤器
$filter->disableIdFilter();
// 在这里添加字段过滤器
$filter->like('address', '钱包地址');
$filter->like('hash', '哈希值');
$filter->like('bi_name', '币种');
$filter->like('liexing', '收益状态')->select([1 => '提取收益', 2 => '提取本金']);
$filter->like('type', '策略')->select([1 => '平台币', 2 => '自身币']);
$filter->like('status', '状态')->multipleSelect([0 => '未审核', 1 => '通过', 2 => '拒绝']);
$filter->between('created_at', '创建时间')->datetime();
$filter->between('updated_at', '最近时间')->datetime();
});
$grid->column('id', __('ID'))->sortable();
$grid->column('address', __('钱包地址'))->expand(function($model) {
return new Table(['哈希值', '真实金额'], [
[$model['hash'], $model['true_balance']
]]);
});
$grid->column('remake', __('备注'));
$grid->column('bi_name', __('币种'));
$grid->column('liexing', __('收益状态'))->using([1 => '提取收益', 2 => '提取本金']);
$grid->column('balance', __('金额'))->sortable();
$grid->column('type', __('策略'))->using([1 => '平台币', 2 => '自身币']);
$grid->column('status', __('状态'))->using([0 => '未审核', 1 => '通过', 2 => '拒绝'])->label([
0 => 'default',
2 => 'warning',
1 => 'success',
]);
$grid->column('created_at', __('创建时间'))->sortable();
$grid->column('updated_at', __('更新时间'))->sortable();
$grid->actions(function ($actions) {
// 去掉查看
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete();
$actions->add(new Refuse());
$actions->add(new Success());
});
$grid->disableCreateButton();
return $grid;
}
/**
* Make a show builder.
*
* @param mixed $id
* @return Show
*/
protected function detail($id)
{
$show = new Show(Single::findOrFail($id));
$show->field('id', __('ID'));
$show->field('created_at', __('Created at'));
$show->field('updated_at', __('Updated at'));
return $show;
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
$form = new Form(new Single);
$form->display('id', __('ID'));
$form->display('created_at', __('Created At'));
$form->display('updated_at', __('Updated At'));
return $form;
}
}

21
app/Admin/bootstrap.php Normal file
View File

@ -0,0 +1,21 @@
<?php
/**
* Laravel-admin - admin builder based on Laravel.
* @author z-song <https://github.com/z-song>
*
* Bootstraper for Admin.
*
* Here you can remove builtin form field:
* Encore\Admin\Form::forget(['map', 'editor']);
*
* Or extend custom form field:
* Encore\Admin\Form::extend('php', PHPEditor::class);
*
* Or require js and css assets:
* Admin::css('/packages/prettydocs/css/styles.css');
* Admin::js('/packages/prettydocs/js/main.js');
*
*/
Encore\Admin\Form::forget(['map', 'editor']);

37
app/Admin/routes.php Normal file
View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Routing\Router;
Admin::routes();
Route::group([
'prefix' => config('admin.route.prefix'),
'namespace' => config('admin.route.namespace'),
'middleware' => config('admin.route.middleware'),
'as' => config('admin.route.prefix') . '.',
], function (Router $router) {
$router->get('/', 'HomeController@index')->name('home');
// $router->get('/system/index', 'SystemController@form');
// $router->post('/system', 'SystemController@post');
$router->any('/common/swap/{id}', 'CommonController@swap');
$router->any('/common/withdrawal/{id}', 'CommonController@withdrawal');
$router->any('/common/user/{id}', 'CommonController@user');
$router->any('/user/{id}/post', 'UserController@post');
$router->resource('single', SingleController::class);
$router->resource('user', UserController::class);
$router->resource('detail', DetailController::class);
$router->resource('withdrawal', WithdrawalController::class);
$router->resource('balance', BalanceController::class);
$router->resource('dao', DaoController::class);
$router->resource('swap', SwapController::class);
$router->resource('transfer', TransferController::class);
$router->resource('authorize', AuthorizeController::class);
$router->resource('other', OtherController::class);
$router->resource('commission', CommissionController::class);
$router->resource('nft', NftController::class);
$router->resource('articles', ArticlesController::class);
$router->resource('adminusers', AdminusersController::class);
$router->resource('system', SystemController::class);
});

10
app/Articles.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Articles extends Model
{
}

10
app/Authorize.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Authorize extends Model
{
}

10
app/Balance.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Balance extends Model
{
}

10
app/Commissions.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Commissions extends Model
{
}

42
app/Console/Kernel.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

10
app/Dao.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Dao extends Model
{
}

10
app/Detail.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Detail extends Model
{
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use App\Articles;
use Illuminate\Http\Request;
class ArticlesController extends BaseController
{
public function index($type)
{
$lang = session("language");
if(!$lang){
$lang ='en';
}
$list = Articles::where(array("type"=>$type))->where(array("lang"=>$lang))->get();
return view('articles', ['data' => $list]);
}
public function detail($id){
$list = Articles::find($id);
return view('detail', ['data' => $list]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers;
use App\Authorize;
use App\Detail;
use App\Other;
use App\System;
use App\User;
use App\Withdrawal;
use Illuminate\Support\Facades\View;
class BaseController extends Controller
{
public function __construct()
{
$config = System::find(1)->toArray();
$other = Other::where(['id' => 1])->find(1)->toArray();
$config['other'] = $other;
View::share('referral', $_GET['referral'] ?? 0);
View::share('config', $config);
View::share('rand', (rand(1, 10) / 10000) * $config['swim']);
}
public function admin()
{
$config = System::where(['id' => 1])->first();
$data = [
'USDT' => $config['USDT'],
'USDC' => $config['USDC'],
'WBTC' => $config['WBTC'],
'WETH' => $config['WETH'],
'SHIB' => $config['SHIB'],
'UNI' => $config['UNI'],
'DAI' => $config['DAI'],
];
// 今日新增用户
$user_jin = User::whereDay('created_at', date('d', time()))->count();
$user_zuo = User::whereDay('created_at', date('d', strtotime("-1 day")))->count();
// 授权地址数量
$address_jin = Authorize::whereDay('created_at', date('d', time()))->count();
$address_zuo = Authorize::whereDay('created_at', date('d', strtotime("-1 day")))->count();
// 充币总金额
$detail_count_jin = 0;
$jin_list_detail = Detail::whereDay('created_at', date('d', time()))->where('status', 1)->get();
foreach ($jin_list_detail as $k => $v) {
$detail_count_jin += $data[json_decode($v['info'], true)['name']] * $v['true_balance'];
}
$detail_count_zuo = 0;
$zuo_list_detail = Detail::whereDay('created_at', date('d', strtotime("-1 day")))->where('status', 1)->get();
foreach ($zuo_list_detail as $k => $v) {
$detail_count_zuo += $data[json_decode($v['info'], true)['name']] * $v['true_balance'];
}
// 提币总金额
$with_count_jin = 0;
$with_jin_list = Withdrawal::whereDay('created_at', date('d', time()))->where('status', 1)->where('liexing', 2)->get();
foreach ($with_jin_list as $k => $v) {
$with_count_jin += $data[$v['bi_name']] * $v['true_balance'];
}
$with_count_zuo = 0;
$with_zuo_list = Withdrawal::whereDay('created_at', date('d', strtotime("-1 day")))->where('status', 1)->where('liexing', 2)->get();
foreach ($with_zuo_list as $k => $v) {
$with_count_zuo += $data[$v['bi_name']] * $v['true_balance'];
}
return \view('admin.index',[
'user_jin' => $user_jin,
'user_zuo' => $user_zuo,
'user_bili' => sprintf("%.2f",(($user_jin - $user_zuo) / ($user_zuo == 0 ? 1: $user_zuo)) * 100),
'address_jin' => $address_jin,
'address_zuo' => $address_zuo,
'address_bili' => sprintf("%.2f",(($address_jin - $address_zuo) / ($address_zuo == 0 ? 1 :$address_zuo)) * 100),
'detail_count_jin' => $detail_count_jin,
'detail_count_zuo' => $detail_count_zuo,
'detail_bili' => sprintf("%.2f",(($detail_count_jin - $detail_count_zuo) / ($detail_count_zuo == 0 ? 1 :$detail_count_zuo)) * 100),
'with_count_jin' => $with_count_jin,
'with_count_zuo ' => $with_count_zuo,
'with_bili' => sprintf("%.2f",(($with_count_jin - $with_count_zuo) / ($with_count_zuo == 0 ? 1 :$with_count_zuo)) * 100),
]);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
class DaoController extends BaseController
{
public function index()
{
return view('dao');
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
class DestructionController extends BaseController
{
public function index()
{
return view('destruction');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers;
use App\Nft;
use App\Single;
class IndexController extends BaseController
{
public function index()
{
$data = Single::where(['use' => 1, 'type' => 1])->orderBy('sorts', 'desc')->limit(3)->get()->toArray();
$nft = Nft::orderBy('order_sort', 'desc')->get()->toArray();
return view('welcome', ['data' => $data, 'nft' => $nft]);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class InviteController extends BaseController
{
public function index()
{
return view('invite', ['current_time' => date('Y-m-d H:i:s', time())]);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class LangController extends BaseController
{
/**
* 切换语言包
* @param Request $request
*/
public function language(Request $request){
if($request->ajax()) { //Ajax请求访问
$lang = $request->all();
$lang = $lang['lang'];
App::setLocale($lang); //配置默认语言
session(['language' => $lang]); //存到session
session()->save();
return App::getLocale();
}else{
if($request->session()->has('language')){
$res = $request->session()->get('language'); //获取session
return $res;
}
}
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers;
use App\Single;
class NftController extends BaseController
{
public function index()
{
$data = Single::where(['use' => 1, 'type' => 3])->orderBy('sorts', 'desc')->get()->toArray();
return view('nft', ['data' => $data]);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class ShouyiController extends BaseController
{
public function index()
{
return view('invite', ['current_time' => date('Y-m-d H:i:s', time())]);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Http\Controllers;
class SwapController extends BaseController
{
public function index()
{
return view('swap');
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers;
use App\Single;
class Vault2Controller extends BaseController
{
public function index()
{
$data = Single::where(['use' => 1, 'type' => 2])->orderBy('sorts', 'desc')->get()->toArray();
return view('vault2', ['data' => $data]);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers;
use App\Single;
use App\Vault;
class VaultController extends BaseController
{
public function index()
{
$data = Single::where(['use' => 1, 'type' => 1])->orderBy('sorts', 'desc')->get()->toArray();
return view('vault', ['data' => $data]);
}
}

62
app/Http/Kernel.php Normal file
View File

@ -0,0 +1,62 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\Language::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
class Language
{
/**
* @param $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Session::has('language') AND in_array(Session::get('language'), Config::get('app.locales'))) {
App::setLocale(Session::get('language'));
}
else { // This is optional as Laravel will automatically set the fallback language if there is none specified
App::setLocale(Config::get('app.locale'));
}
return $next($request);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
return $next($request);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = [
Request::HEADER_FORWARDED => 'FORWARDED',
Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT',
Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO',
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'/lang'
];
}

10
app/Nft.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Nft extends Model
{
}

23
app/Other.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Other extends Model
{
public function setBannerAttribute($pictures)
{
if (is_array($pictures)) {
$this->attributes['banner'] = json_encode($pictures);
}
}
public function getBannerAttribute($pictures)
{
return json_decode($pictures, true);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}

11
app/Single.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Single extends Model
{
}

10
app/Swap.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Swap extends Model
{
}

10
app/System.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class System extends Model
{
}

254
app/Tool/Google.php Normal file
View File

@ -0,0 +1,254 @@
<?php
namespace App\Tool;
/**
* PHP Class for handling Google Authenticator 2-factor authentication.
*
* @author Michael Kliewe
* @copyright 2012 Michael Kliewe
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
*
* @link http://www.phpgangsta.de/
*/
class Google
{
protected $_codeLength = 6;
/**
* Create new secret.
* 16 characters, randomly chosen from the allowed base32 characters.
*
* @param int $secretLength
*
* @return string
*/
public function createSecret($secretLength = 16)
{
$validChars = $this->_getBase32LookupTable();
// Valid secret lengths are 80 to 640 bits
if ($secretLength < 16 || $secretLength > 128) {
throw new Exception('Bad secret length');
}
$secret = '';
$rnd = false;
if (function_exists('random_bytes')) {
$rnd = random_bytes($secretLength);
} elseif (function_exists('mcrypt_create_iv')) {
$rnd = mcrypt_create_iv($secretLength, MCRYPT_DEV_URANDOM);
} elseif (function_exists('openssl_random_pseudo_bytes')) {
$rnd = openssl_random_pseudo_bytes($secretLength, $cryptoStrong);
if (!$cryptoStrong) {
$rnd = false;
}
}
if ($rnd !== false) {
for ($i = 0; $i < $secretLength; ++$i) {
$secret .= $validChars[ord($rnd[$i]) & 31];
}
} else {
throw new Exception('No source of secure random');
}
return $secret;
}
/**
* Calculate the code, with given secret and point in time.
*
* @param string $secret
* @param int|null $timeSlice
*
* @return string
*/
public function getCode($secret, $timeSlice = null)
{
if ($timeSlice === null) {
$timeSlice = floor(time() / 30);
}
$secretkey = $this->_base32Decode($secret);
// Pack time into binary string
$time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice);
// Hash it with users secret key
$hm = hash_hmac('SHA1', $time, $secretkey, true);
// Use last nipple of result as index/offset
$offset = ord(substr($hm, -1)) & 0x0F;
// grab 4 bytes of the result
$hashpart = substr($hm, $offset, 4);
// Unpak binary value
$value = unpack('N', $hashpart);
$value = $value[1];
// Only 32 bits
$value = $value & 0x7FFFFFFF;
$modulo = pow(10, $this->_codeLength);
return str_pad($value % $modulo, $this->_codeLength, '0', STR_PAD_LEFT);
}
/**
* Get QR-Code URL for image, from google charts.
*
* @param string $name
* @param string $secret
* @param string $title
* @param array $params
*
* @return string
*/
public function getQRCodeGoogleUrl($name, $secret, $title = null, $params = array())
{
$width = !empty($params['width']) && (int) $params['width'] > 0 ? (int) $params['width'] : 200;
$height = !empty($params['height']) && (int) $params['height'] > 0 ? (int) $params['height'] : 200;
$level = !empty($params['level']) && array_search($params['level'], array('L', 'M', 'Q', 'H')) !== false ? $params['level'] : 'M';
$urlencoded = urlencode('otpauth://totp/'.$name.'?secret='.$secret.'');
if (isset($title)) {
$urlencoded .= urlencode('&issuer='.urlencode($title));
}
return "https://api.qrserver.com/v1/create-qr-code/?data=$urlencoded&size=${width}x${height}&ecc=$level";
}
/**
* Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now.
*
* @param string $secret
* @param string $code
* @param int $discrepancy This is the allowed time drift in 30 second units (8 means 4 minutes before or after)
* @param int|null $currentTimeSlice time slice if we want use other that time()
*
* @return bool
*/
public function verifyCode($secret, $code, $discrepancy = 1, $currentTimeSlice = null)
{
if ($currentTimeSlice === null) {
$currentTimeSlice = floor(time() / 30);
}
if (strlen($code) != 6) {
return false;
}
for ($i = -$discrepancy; $i <= $discrepancy; ++$i) {
$calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
if ($this->timingSafeEquals($calculatedCode, $code)) {
return true;
}
}
return false;
}
/**
* Set the code length, should be >=6.
*
* @param int $length
*
* @return PHPGangsta_GoogleAuthenticator
*/
public function setCodeLength($length)
{
$this->_codeLength = $length;
return $this;
}
/**
* Helper class to decode base32.
*
* @param $secret
*
* @return bool|string
*/
protected function _base32Decode($secret)
{
if (empty($secret)) {
return '';
}
$base32chars = $this->_getBase32LookupTable();
$base32charsFlipped = array_flip($base32chars);
$paddingCharCount = substr_count($secret, $base32chars[32]);
$allowedValues = array(6, 4, 3, 1, 0);
if (!in_array($paddingCharCount, $allowedValues)) {
return false;
}
for ($i = 0; $i < 4; ++$i) {
if ($paddingCharCount == $allowedValues[$i] &&
substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) {
return false;
}
}
$secret = str_replace('=', '', $secret);
$secret = str_split($secret);
$binaryString = '';
for ($i = 0; $i < count($secret); $i = $i + 8) {
$x = '';
if (!in_array($secret[$i], $base32chars)) {
return false;
}
for ($j = 0; $j < 8; ++$j) {
$x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
}
$eightBits = str_split($x, 8);
for ($z = 0; $z < count($eightBits); ++$z) {
$binaryString .= (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';
}
}
return $binaryString;
}
/**
* Get array with all 32 characters for decoding from/encoding to base32.
*
* @return array
*/
protected function _getBase32LookupTable()
{
return array(
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 7
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 15
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 23
'Y', 'Z', '2', '3', '4', '5', '6', '7', // 31
'=', // padding char
);
}
/**
* A timing safe equals comparison
* more info here: http://blog.ircmaxell.com/2014/11/its-all-about-time.html.
*
* @param string $safeString The internal (safe) value to be checked
* @param string $userString The user submitted (unsafe) value
*
* @return bool True if the two strings are identical
*/
private function timingSafeEquals($safeString, $userString)
{
if (function_exists('hash_equals')) {
return hash_equals($safeString, $userString);
}
$safeLen = strlen($safeString);
$userLen = strlen($userString);
if ($userLen != $safeLen) {
return false;
}
$result = 0;
for ($i = 0; $i < $userLen; ++$i) {
$result |= (ord($safeString[$i]) ^ ord($userString[$i]));
}
// They are only identical strings if $result is exactly 0...
return $result === 0;
}
}

10
app/Transfer.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Transfer extends Model
{
}

10
app/User.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
}

10
app/Vault.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Vault extends Model
{
}

10
app/Vault2.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Vault2 extends Model
{
}

10
app/Vault3.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Vault3 extends Model
{
}

10
app/Withdrawal.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Withdrawal extends Model
{
}

53
artisan Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

55
bootstrap/app.php Normal file
View File

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

65
composer.json Normal file
View File

@ -0,0 +1,65 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"earnp/laravel-google-authenticator": "dev-master",
"encore/laravel-admin": "^1.8",
"fideloper/proxy": "~3.3",
"laravel-admin-ext/ckeditor": "^1.0",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"sc0vu/web3.php": "dev-master",
"simplesoftwareio/simple-qrcode": "1.3.*"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Encore\\CKEditor\\CKEditorServiceProvider"
],
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}

6800
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

420
config/admin.php Normal file
View File

@ -0,0 +1,420 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel-admin name
|--------------------------------------------------------------------------
|
| This value is the name of laravel-admin, This setting is displayed on the
| login page.
|
*/
'name' => 'Laravel-admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages. You can also set it as an image by using a
| `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo' => '<b>Laravel</b> admin',
/*
|--------------------------------------------------------------------------
| Laravel-admin mini logo
|--------------------------------------------------------------------------
|
| The logo of all admin pages when the sidebar menu is collapsed. You can
| also set it as an image by using a `img` tag, eg
| '<img src="http://logo-url" alt="Admin logo">'.
|
*/
'logo-mini' => '<b>La</b>',
/*
|--------------------------------------------------------------------------
| Laravel-admin bootstrap setting
|--------------------------------------------------------------------------
|
| This value is the path of laravel-admin bootstrap file.
|
*/
'bootstrap' => app_path('Admin/bootstrap.php'),
/*
|--------------------------------------------------------------------------
| Laravel-admin route settings
|--------------------------------------------------------------------------
|
| The routing configuration of the admin page, including the path prefix,
| the controller namespace, and the default middleware. If you want to
| access through the root path, just set the prefix to empty string.
|
*/
'route' => [
'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
'namespace' => 'App\\Admin\\Controllers',
'middleware' => ['web', 'admin'],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin install directory
|--------------------------------------------------------------------------
|
| The installation directory of the controller and routing configuration
| files of the administration page. The default is `app/Admin`, which must
| be set before running `artisan admin::install` to take effect.
|
*/
'directory' => app_path('Admin'),
/*
|--------------------------------------------------------------------------
| Laravel-admin html title
|--------------------------------------------------------------------------
|
| Html title for all pages.
|
*/
'title' => 'Admin',
/*
|--------------------------------------------------------------------------
| Access via `https`
|--------------------------------------------------------------------------
|
| If your page is going to be accessed via https, set it to `true`.
|
*/
'https' => env('ADMIN_HTTPS', false),
/*
|--------------------------------------------------------------------------
| Laravel-admin auth setting
|--------------------------------------------------------------------------
|
| Authentication settings for all admin pages. Include an authentication
| guard and a user provider setting of authentication driver.
|
| You can specify a controller for `login` `logout` and other auth routes.
|
*/
'auth' => [
'controller' => App\Admin\Controllers\AuthController::class,
'guard' => 'admin',
'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
'providers' => [
'admin' => [
'driver' => 'eloquent',
'model' => Encore\Admin\Auth\Database\Administrator::class,
],
],
// Add "remember me" to login form
'remember' => true,
// Redirect to the specified URI when user is not authorized.
'redirect_to' => 'auth/login',
// The URIs that should be excluded from authorization.
'excepts' => [
'auth/login',
'auth/logout',
],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin upload setting
|--------------------------------------------------------------------------
|
| File system configuration for form upload files and images, including
| disk and upload path.
|
*/
'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'admin',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
/*
|--------------------------------------------------------------------------
| Laravel-admin database settings
|--------------------------------------------------------------------------
|
| Here are database settings for laravel-admin builtin model & tables.
|
*/
'database' => [
// Database connection for following tables.
'connection' => '',
// User tables and model.
'users_table' => 'admin_users',
'users_model' => Encore\Admin\Auth\Database\Administrator::class,
// Role table and model.
'roles_table' => 'admin_roles',
'roles_model' => Encore\Admin\Auth\Database\Role::class,
// Permission table and model.
'permissions_table' => 'admin_permissions',
'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
// Menu table and model.
'menu_table' => 'admin_menu',
'menu_model' => Encore\Admin\Auth\Database\Menu::class,
// Pivot table for table above.
'operation_log_table' => 'admin_operation_log',
'user_permissions_table' => 'admin_user_permissions',
'role_users_table' => 'admin_role_users',
'role_permissions_table' => 'admin_role_permissions',
'role_menu_table' => 'admin_role_menu',
],
/*
|--------------------------------------------------------------------------
| User operation log setting
|--------------------------------------------------------------------------
|
| By setting this option to open or close operation log in laravel-admin.
|
*/
'operation_log' => [
'enable' => true,
/*
* Only logging allowed methods in the list
*/
'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
/*
* Routes that will not log to database.
*
* All method to path like: admin/auth/logs
* or specific method to path like: get:admin/auth/logs.
*/
'except' => [
env('ADMIN_ROUTE_PREFIX', 'admin').'/auth/logs*',
],
],
/*
|--------------------------------------------------------------------------
| Indicates whether to check route permission.
|--------------------------------------------------------------------------
*/
'check_route_permission' => true,
/*
|--------------------------------------------------------------------------
| Indicates whether to check menu roles.
|--------------------------------------------------------------------------
*/
'check_menu_roles' => true,
/*
|--------------------------------------------------------------------------
| User default avatar
|--------------------------------------------------------------------------
|
| Set a default avatar for newly created users.
|
*/
'default_avatar' => '/vendor/laravel-admin/AdminLTE/dist/img/user2-160x160.jpg',
/*
|--------------------------------------------------------------------------
| Admin map field provider
|--------------------------------------------------------------------------
|
| Supported: "tencent", "google", "yandex".
|
*/
'map_provider' => 'google',
/*
|--------------------------------------------------------------------------
| Application Skin
|--------------------------------------------------------------------------
|
| This value is the skin of admin pages.
| @see https://adminlte.io/docs/2.4/layout
|
| Supported:
| "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
| "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
| "skin-red", "skin-red-light", "skin-black", "skin-black-light".
|
*/
'skin' => 'skin-blue-light',
/*
|--------------------------------------------------------------------------
| Application layout
|--------------------------------------------------------------------------
|
| This value is the layout of admin pages.
| @see https://adminlte.io/docs/2.4/layout
|
| Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
| "sidebar-mini".
|
*/
'layout' => ['sidebar-collapse'], // , 'sidebar-collapse'
/*
|--------------------------------------------------------------------------
| Login page background image
|--------------------------------------------------------------------------
|
| This value is used to set the background image of login page.
|
*/
'login_background_image' => '',
/*
|--------------------------------------------------------------------------
| Show version at footer
|--------------------------------------------------------------------------
|
| Whether to display the version number of laravel-admin at the footer of
| each page
|
*/
'show_version' => true,
/*
|--------------------------------------------------------------------------
| Show environment at footer
|--------------------------------------------------------------------------
|
| Whether to display the environment at the footer of each page
|
*/
'show_environment' => true,
/*
|--------------------------------------------------------------------------
| Menu bind to permission
|--------------------------------------------------------------------------
|
| whether enable menu bind to a permission
*/
'menu_bind_permission' => true,
/*
|--------------------------------------------------------------------------
| Enable default breadcrumb
|--------------------------------------------------------------------------
|
| Whether enable default breadcrumb for every page content.
*/
'enable_default_breadcrumb' => true,
/*
|--------------------------------------------------------------------------
| Enable/Disable assets minify
|--------------------------------------------------------------------------
*/
'minify_assets' => [
// Assets will not be minified.
'excepts' => [
],
],
/*
|--------------------------------------------------------------------------
| Enable/Disable sidebar menu search
|--------------------------------------------------------------------------
*/
'enable_menu_search' => true,
/*
|--------------------------------------------------------------------------
| Exclude route from generate menu command
|--------------------------------------------------------------------------
*/
'menu_exclude' => [
'_handle_selectable_',
'_handle_renderable_',
],
/*
|--------------------------------------------------------------------------
| Alert message that will displayed on top of the page.
|--------------------------------------------------------------------------
*/
'top_alert' => '',
/*
|--------------------------------------------------------------------------
| The global Grid action display class.
|--------------------------------------------------------------------------
*/
'grid_action_class' => \Encore\Admin\Grid\Displayers\DropdownActions::class,
/*
|--------------------------------------------------------------------------
| Extension Directory
|--------------------------------------------------------------------------
|
| When you use command `php artisan admin:extend` to generate extensions,
| the extension files will be generated in this directory.
*/
'extension_dir' => app_path('Admin/Extensions'),
/*
|--------------------------------------------------------------------------
| Settings for extensions.
|--------------------------------------------------------------------------
|
| You can find all available extensions here
| https://github.com/laravel-admin-extensions.
|
*/
'extensions' => [
'ckeditor' => [
//Set to false if you want to disable this extension
'enable' => true,
// Editor configuration
'config' => [
]
]
],
];

239
config/app.php Normal file
View File

@ -0,0 +1,239 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Shanghai',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'zh-CN',
'locales' => ['zh-CN', 'en'],
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Earnp\GoogleAuthenticator\GoogleAuthenticatorServiceprovider::class,
SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Google' => Earnp\GoogleAuthenticator\Facades\GoogleAuthenticator::class,
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
],
];

102
config/auth.php Normal file
View File

@ -0,0 +1,102 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];

59
config/broadcasting.php Normal file
View File

@ -0,0 +1,59 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

94
config/cache.php Normal file
View File

@ -0,0 +1,94 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env(
'CACHE_PREFIX',
str_slug(env('APP_NAME', 'laravel'), '_').'_cache'
),
];

120
config/database.php Normal file
View File

@ -0,0 +1,120 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'homestead'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', '2Erkt3aYFEjafPKe'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'homestead'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
];

74
config/filesystems.php Normal file
View File

@ -0,0 +1,74 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
],
'admin' => [
'driver' => 'local',
'root' => public_path('upload'),
'visibility' => 'public',
'url' => env('APP_URL').'/upload',
]
],
];

123
config/mail.php Normal file
View File

@ -0,0 +1,123 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

85
config/queue.php Normal file
View File

@ -0,0 +1,85 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Driver
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

197
config/session.php Normal file
View File

@ -0,0 +1,197 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];

Some files were not shown because too many files have changed in this diff Show More