-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
586 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
<?php | ||
|
||
namespace App\Admin\Controllers; | ||
|
||
use App\Models\Product; | ||
use Encore\Admin\Controllers\AdminController; | ||
use Encore\Admin\Form; | ||
use Encore\Admin\Grid; | ||
use Encore\Admin\Show; | ||
|
||
class Pro2Controller extends AdminController | ||
{ | ||
/** | ||
* Title for current resource. | ||
* | ||
* @var string | ||
*/ | ||
protected $title = 'Product'; | ||
|
||
/** | ||
* Make a grid builder. | ||
* | ||
* @return Grid | ||
*/ | ||
protected function grid() | ||
{ | ||
$grid = new Grid(new Product()); | ||
|
||
$grid->column('id', __('Id')); | ||
$grid->column('name', __('Name')); | ||
$grid->column('tag', __('Tag')); | ||
$grid->column('price', __('Price')); | ||
$grid->column('price_usdt', __('Price usdt')); | ||
$grid->column('price_coin', __('Price coin')); | ||
$grid->column('coin_wallet_address', __('Coin wallet address')); | ||
$grid->column('coin_wallet_qrcode', __('Coin wallet qrcode')); | ||
$grid->column('wallet_type_id', __('Wallet type id')); | ||
$grid->column('wait_days', __('Wait days')); | ||
$grid->column('valid_days', __('Valid days')); | ||
$grid->column('valid_days_text', __('Valid days text')); | ||
$grid->column('choose_reason', __('Choose reason')); | ||
$grid->column('choose_reason_text', __('Choose reason text')); | ||
$grid->column('service_rate', __('Service rate')); | ||
$grid->column('pay_user_rate', __('Pay user rate')); | ||
$grid->column('now_rate', __('Now rate')); | ||
$grid->column('freed_rate', __('Freed rate')); | ||
$grid->column('freed_days', __('Freed days')); | ||
$grid->column('parent1_rate', __('Parent1 rate')); | ||
$grid->column('parent2_rate', __('Parent2 rate')); | ||
$grid->column('invite_rate', __('Invite rate')); | ||
$grid->column('bonus_team_a', __('Bonus team a')); | ||
$grid->column('bonus_team_b', __('Bonus team b')); | ||
$grid->column('bonus_team_c', __('Bonus team c')); | ||
$grid->column('upgrade_team_a', __('Upgrade team a')); | ||
$grid->column('upgrade_team_b', __('Upgrade team b')); | ||
$grid->column('upgrade_team_c', __('Upgrade team c')); | ||
$grid->column('risk_rate', __('Risk rate')); | ||
$grid->column('gas_fee', __('Gas fee')); | ||
$grid->column('pledge_fee', __('Pledge fee')); | ||
$grid->column('pledge_days', __('Pledge days')); | ||
$grid->column('valid_rate', __('Valid rate')); | ||
$grid->column('package_rate', __('Package rate')); | ||
$grid->column('thumb', __('Thumb')); | ||
$grid->column('desc', __('Desc')); | ||
$grid->column('content', __('Content')); | ||
$grid->column('status', __('Status')); | ||
$grid->column('created_at', __('Created at')); | ||
$grid->column('updated_at', __('Updated at')); | ||
$grid->column('deleted_at', __('Deleted at')); | ||
$grid->column('total_revenue', __('Total revenue')); | ||
$grid->column('yesterday_revenue', __('Yesterday revenue')); | ||
$grid->column('yesterday_gas', __('Yesterday gas')); | ||
$grid->column('yesterday_efficiency', __('Yesterday efficiency')); | ||
$grid->column('total_revenue_text', __('Total revenue text')); | ||
$grid->column('yesterday_revenue_text', __('Yesterday revenue text')); | ||
$grid->column('yesterday_gas_text', __('Yesterday gas text')); | ||
$grid->column('yesterday_efficiency_text', __('Yesterday efficiency text')); | ||
|
||
return $grid; | ||
} | ||
|
||
/** | ||
* Make a show builder. | ||
* | ||
* @param mixed $id | ||
* @return Show | ||
*/ | ||
protected function detail($id) | ||
{ | ||
$show = new Show(Product::findOrFail($id)); | ||
|
||
$show->field('id', __('Id')); | ||
$show->field('name', __('Name')); | ||
$show->field('tag', __('Tag')); | ||
$show->field('price', __('Price')); | ||
$show->field('price_usdt', __('Price usdt')); | ||
$show->field('price_coin', __('Price coin')); | ||
$show->field('coin_wallet_address', __('Coin wallet address')); | ||
$show->field('coin_wallet_qrcode', __('Coin wallet qrcode')); | ||
$show->field('wallet_type_id', __('Wallet type id')); | ||
$show->field('wait_days', __('Wait days')); | ||
$show->field('valid_days', __('Valid days')); | ||
$show->field('valid_days_text', __('Valid days text')); | ||
$show->field('choose_reason', __('Choose reason')); | ||
$show->field('choose_reason_text', __('Choose reason text')); | ||
$show->field('service_rate', __('Service rate')); | ||
$show->field('pay_user_rate', __('Pay user rate')); | ||
$show->field('now_rate', __('Now rate')); | ||
$show->field('freed_rate', __('Freed rate')); | ||
$show->field('freed_days', __('Freed days')); | ||
$show->field('parent1_rate', __('Parent1 rate')); | ||
$show->field('parent2_rate', __('Parent2 rate')); | ||
$show->field('invite_rate', __('Invite rate')); | ||
$show->field('bonus_team_a', __('Bonus team a')); | ||
$show->field('bonus_team_b', __('Bonus team b')); | ||
$show->field('bonus_team_c', __('Bonus team c')); | ||
$show->field('upgrade_team_a', __('Upgrade team a')); | ||
$show->field('upgrade_team_b', __('Upgrade team b')); | ||
$show->field('upgrade_team_c', __('Upgrade team c')); | ||
$show->field('risk_rate', __('Risk rate')); | ||
$show->field('gas_fee', __('Gas fee')); | ||
$show->field('pledge_fee', __('Pledge fee')); | ||
$show->field('pledge_days', __('Pledge days')); | ||
$show->field('valid_rate', __('Valid rate')); | ||
$show->field('package_rate', __('Package rate')); | ||
$show->field('thumb', __('Thumb')); | ||
$show->field('desc', __('Desc')); | ||
$show->field('content', __('Content')); | ||
$show->field('status', __('Status')); | ||
$show->field('created_at', __('Created at')); | ||
$show->field('updated_at', __('Updated at')); | ||
$show->field('deleted_at', __('Deleted at')); | ||
$show->field('total_revenue', __('Total revenue')); | ||
$show->field('yesterday_revenue', __('Yesterday revenue')); | ||
$show->field('yesterday_gas', __('Yesterday gas')); | ||
$show->field('yesterday_efficiency', __('Yesterday efficiency')); | ||
$show->field('total_revenue_text', __('Total revenue text')); | ||
$show->field('yesterday_revenue_text', __('Yesterday revenue text')); | ||
$show->field('yesterday_gas_text', __('Yesterday gas text')); | ||
$show->field('yesterday_efficiency_text', __('Yesterday efficiency text')); | ||
|
||
return $show; | ||
} | ||
|
||
/** | ||
* Make a form builder. | ||
* | ||
* @return Form | ||
*/ | ||
protected function form() | ||
{ | ||
$form = new Form(new Product()); | ||
|
||
$form->text('name', __('Name')); | ||
$form->text('tag', __('Tag')); | ||
$form->decimal('price', __('Price'))->default(0.00); | ||
$form->decimal('price_usdt', __('Price usdt'))->default(0.00); | ||
$form->decimal('price_coin', __('Price coin'))->default(0.00); | ||
$form->text('coin_wallet_address', __('Coin wallet address')); | ||
$form->text('coin_wallet_qrcode', __('Coin wallet qrcode')); | ||
$form->number('wallet_type_id', __('Wallet type id')); | ||
$form->number('wait_days', __('Wait days')); | ||
$form->number('valid_days', __('Valid days')); | ||
$form->text('valid_days_text', __('Valid days text')); | ||
$form->text('choose_reason', __('Choose reason')); | ||
$form->text('choose_reason_text', __('Choose reason text')); | ||
$form->decimal('service_rate', __('Service rate'))->default(0.00); | ||
$form->decimal('pay_user_rate', __('Pay user rate'))->default(0.00); | ||
$form->decimal('now_rate', __('Now rate'))->default(0.00); | ||
$form->decimal('freed_rate', __('Freed rate'))->default(0.00); | ||
$form->number('freed_days', __('Freed days')); | ||
$form->decimal('parent1_rate', __('Parent1 rate'))->default(0.00); | ||
$form->decimal('parent2_rate', __('Parent2 rate'))->default(0.00); | ||
$form->decimal('invite_rate', __('Invite rate'))->default(0.00); | ||
$form->decimal('bonus_team_a', __('Bonus team a'))->default(0.00); | ||
$form->decimal('bonus_team_b', __('Bonus team b'))->default(0.00); | ||
$form->decimal('bonus_team_c', __('Bonus team c'))->default(0.00); | ||
$form->number('upgrade_team_a', __('Upgrade team a')); | ||
$form->number('upgrade_team_b', __('Upgrade team b')); | ||
$form->number('upgrade_team_c', __('Upgrade team c')); | ||
$form->decimal('risk_rate', __('Risk rate'))->default(0.00); | ||
$form->decimal('gas_fee', __('Gas fee'))->default(0.00000); | ||
$form->decimal('pledge_fee', __('Pledge fee'))->default(0.00000); | ||
$form->number('pledge_days', __('Pledge days'))->default(1); | ||
$form->decimal('valid_rate', __('Valid rate'))->default(0.00); | ||
$form->decimal('package_rate', __('Package rate'))->default(0.00); | ||
$form->text('thumb', __('Thumb')); | ||
$form->text('desc', __('Desc')); | ||
$form->textarea('content', __('Content')); | ||
$form->switch('status', __('Status'))->default(1); | ||
$form->decimal('total_revenue', __('Total revenue'))->default(0.00000); | ||
$form->decimal('yesterday_revenue', __('Yesterday revenue'))->default(0.00000); | ||
$form->decimal('yesterday_gas', __('Yesterday gas'))->default(0.00000); | ||
$form->decimal('yesterday_efficiency', __('Yesterday efficiency'))->default(0.00000); | ||
$form->text('total_revenue_text', __('Total revenue text'))->default('矿池总产量'); | ||
$form->text('yesterday_revenue_text', __('Yesterday revenue text'))->default('昨日产量'); | ||
$form->text('yesterday_gas_text', __('Yesterday gas text'))->default('昨日消耗GAS'); | ||
$form->text('yesterday_efficiency_text', __('Yesterday efficiency text'))->default('昨日挖矿效率'); | ||
|
||
return $form; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\Announcement; | ||
use App\Models\ArticleCategory; | ||
use App\Models\Product; | ||
use Illuminate\Http\Request; | ||
use Storage; | ||
|
||
class IndexController extends Controller | ||
{ | ||
public function index(Request $request) | ||
{ | ||
$data = []; | ||
// Banner 图片 | ||
$banner = []; | ||
$banner[] = config('app.banner1'); | ||
$banner[] = config('app.banner2'); | ||
$banner[] = config('app.banner3'); | ||
$banner_list = []; | ||
foreach ($banner as $ban) { | ||
if ($ban) { | ||
$banner_list[] = Storage::disk('oss')->url($ban); | ||
} else { | ||
return ''; | ||
} | ||
} | ||
$data['banner'] = array_values($banner_list); | ||
|
||
// 获取公告 | ||
$announcement = Announcement::where('is_recommand', '=', 1) | ||
->where('status', '=', 1) | ||
->select('id', 'title') | ||
->get(); | ||
$data['announcement'] = $announcement; | ||
|
||
// 导航栏 | ||
$nav = ArticleCategory::where('status', '=', 1) | ||
->orderBy('order', 'asc') | ||
->select('id', 'title', 'icon') | ||
->get(); | ||
$data['nav'] = $nav; | ||
|
||
// 抢购算力 切换 | ||
// 矿池运营数据 TODO | ||
$list = Product::where('status', '=', 0) | ||
->orderBy('id', 'asc') | ||
->get(); | ||
//print_r($list->toArray()); | ||
foreach ($list as $k => $v) { | ||
// | ||
$data['coinlist'][$k]['name'] = $v->wallet_slug; | ||
$data['coinlist'][$k]['total_revenue'] = $v->total_revenue; | ||
$data['coinlist'][$k]['yesterday_revenue'] = $v->yesterday_revenue; | ||
$data['coinlist'][$k]['yesterday_gas'] = $v->yesterday_gas; | ||
$data['coinlist'][$k]['yesterday_efficiency'] = $v->yesterday_efficiency; | ||
$data['coinlist'][$k]['total_revenue_text'] = $v->total_revenue_text; | ||
$data['coinlist'][$k]['yesterday_revenue_text'] = $v->yesterday_revenue_text; | ||
$data['coinlist'][$k]['yesterday_gas_text'] = $v->yesterday_gas_text; | ||
$data['coinlist'][$k]['yesterday_efficiency_text'] = $v->yesterday_efficiency_text; | ||
} | ||
|
||
// 矿池总产量 total_revenue 昨日产量 yesterday_revenue 昨日消耗GAS yesterday_gas 挖矿效率 yesterday_efficiency | ||
// $data['filpool']['progress'] = config('filpool.progress'); // 矿池填充进度 | ||
// $data['filpool']['node_power'] = config('filpool.node_power'); // 节点总有效算力 | ||
// $data['filpool']['community_power'] = config('filpool.community_power'); // 社区总有效算力 | ||
// $data['filpool']['community_torage_space'] = config('filpool.community_torage_space'); // 社区总存储空间 | ||
// $data['filpool']['total_revenue'] = config('filpool.total_revenue'); // 矿池总收益 | ||
// $data['filpool']['yesterday_revenue'] = config('filpool.yesterday_revenue'); // 昨日收益 | ||
// $data['filpool']['yesterday_gas'] = config('filpool.yesterday_gas'); // 昨日消耗GAS | ||
// $data['filpool']['single_revenue'] = config('filpool.single_revenue'); // 有效算力单T收益 | ||
|
||
// 产品列表 | ||
$product = Product::where('status', '=', 0) | ||
->orderBy('id', 'desc') | ||
->select('id', 'name', 'thumb', 'choose_reason') | ||
->get(); | ||
|
||
$data['product'] = $product; | ||
|
||
return $data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.