diff --git a/.env.example b/.env.example index 9806745..2259af7 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,7 @@ APP_KEY= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost +FRONT_URL=http://coinwind.test DB_CONNECTION=mysql DB_HOST=127.0.0.1 @@ -21,6 +22,7 @@ QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 +REDIS_DB=6 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io diff --git a/app/Admin/Actions/Post/Airdrop.php b/app/Admin/Actions/Post/Airdrop.php index 327c348..c58dd3e 100644 --- a/app/Admin/Actions/Post/Airdrop.php +++ b/app/Admin/Actions/Post/Airdrop.php @@ -3,6 +3,7 @@ namespace App\Admin\Actions\Post; use App\Balance; +use App\Base; use App\User; use Encore\Admin\Actions\RowAction; use Illuminate\Database\Eloquent\Model; @@ -25,7 +26,7 @@ class Airdrop extends RowAction 'address' => $model['address'], 'name' => 'GLK', 'remake' => '发放空投', - 'status' => 4, + 'status' => Base::BALANCE_ISSUE_AIRDROP, 'money' => $airdrop, 'created_at' => date('Y-m-d H:i:s') ]); diff --git a/app/Admin/Controllers/StakingController.php b/app/Admin/Controllers/StakingController.php new file mode 100644 index 0000000..84fd463 --- /dev/null +++ b/app/Admin/Controllers/StakingController.php @@ -0,0 +1,99 @@ +column('id', __('ID'))->sortable(); + $grid->column('address', __('钱包')); + $grid->column('symbol', __('币')); + $grid->column('balance', __('质押量')); + $grid->column('remark', __('备注')); + $grid->column('status', __('状态'))->using([0 => '正常', 1 => '冻结']); + $grid->column('created_at', __('首次质押')); + $grid->column('updated_at', __('最后质押')); + $grid->actions(function ($actions) { + // 去掉查看 + $actions->disableDelete(); + }); + + $grid->disableCreateButton(); + $grid->disableFilter(); + $grid->disableExport(); + $grid->disableRowSelector(); + + return $grid; + } + + /** + * Make a show builder. + * + * @param mixed $id + * @return Show + */ + protected function detail($id) + { + $show = new Show(Staking::findOrFail($id)); + + $show->field('id', __('ID')); + $show->field('address', __('钱包')); + $show->field('symbol', __('币')); + $show->field('balance', __('质押量')); + $show->field('status', '策略类型')->using([ + 0 => '正常', + 1 => '冻结', + ]); + + $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('address', '钱包')->required(); + + $form->text('symbol', '币')->required(); + + $form->tet('balance', '质押量')->required(); + + $form->switch('status', '状态')->states([ + 'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'], + 'on' => ['value' => 1, 'text' => '冻结', 'color' => 'success'], + ]); + + return $form; + } +} diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php index 0164540..3b7a48e 100644 --- a/app/Admin/Controllers/UserController.php +++ b/app/Admin/Controllers/UserController.php @@ -62,6 +62,7 @@ class UserController extends AdminController ['USDC', $model->USDC, $vault->USDC, $vault->USDC_T, $vault2->USDC, $vault2->USDC_T, empty($model->USDC_Q) ? 'no' : 'yes'] ]); }); + $grid->column('protocol', '协议'); $grid->column('balance', '平台币')->expand(function ($model) { $data = Vault3::where(['id' => $model['id']])->first(); diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 460fd3b..c60f075 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -35,5 +35,6 @@ Route::group([ $router->resource('adminusers', AdminusersController::class); $router->resource('system', SystemController::class); $router->resource('setting', SettingController::class); + $router->resource('staking', StakingController::class); $router->resource('agent', AgentController::class); }); diff --git a/app/AdminOperationLog.php b/app/AdminOperationLog.php new file mode 100644 index 0000000..2fa818f --- /dev/null +++ b/app/AdminOperationLog.php @@ -0,0 +1,11 @@ +get()->toArray(); + $plans = []; + + foreach ($rows as $row) { + if ($row['conf']) { + $plans[$row['name']] = json_decode($row['conf'], true)['plans']; + } + } + // var_dump($plans); + return $plans; + } + + /** + * calculate profit by money and plan + * + * @deposited: how much have deposited. + * @plan: the relative staking plan. + */ + protected function _calc_income($deposited, $plan) + { + foreach ($plan as $p) { + if ($deposited >= $p['min'] && $deposited <= $p['max']) { + $rate = bcdiv($p['interest'], 100, 4); + return floatval(bcmul($rate, $deposited, 4)); + } + } + return 0.0; + } + /** * Execute the console command. * @@ -37,6 +85,83 @@ class CalcProfit extends Command */ public function handle() { - // + } + + protected function _daily_revenue() + { + // get plan + $plans = $this->_get_staking_plans(); + + $investors = User::where('balance', '>', 0) + ->get() + ->toArray(); + + $log = []; + foreach ($investors as $inve) { + + $profit = $this->_calc_income($inve['balance'], $plans[Base::USDT]); + $profit = Base::ffixed($profit, 4); + if ($profit > 0) { + $suc = DB::transaction(function () use ($inve, $profit) { + User::where('id', $inve['id'])->increment('balance', $profit); + // + $newBlc = new Balance(); + $newBlc->address = $inve['address']; + $newBlc->name = Base::USDT; + $newBlc->remake = 'Daily Revenue'; + $newBlc->status = Base::BALANCE_STAKING_DAILY_REVENUE; + $newBlc->money = $profit; + $newBlc->created_at = \Carbon\Carbon::now(); + $newBlc->save(); + }); + + if (is_null($suc)) { + $log[$inve['address']] = $profit; + } + } + } // foreach + + if ($log) { + Log::info('coin:calc executed:' . json_encode($log)); + } else { + Log::debug('coin:calc executed'); + } + } + + protected function _pool_data() + { + // string + $s = Redis::get(ApiV1Controller::K_POOLDATA); + // pool data + $pd = json_decode($s, true); + // print_r($pd); + + $base = $pd['totalOutput']; + $min = bcmul($base, 0.01, 2); + $max = bcmul($base, 0.1, 2); + $pi = mt_rand($min, $max); + $rd = mt_rand(0, 100); + $pf = $rd / 100; + $pd['totalOutput'] = floatval(bcadd($base, $pi + $pf, 2)); + + if ($rd < 30) { + $pd['validNode'] += 1; + } + + $pd['participant'] += mt_rand(1, 20); + $pd['userRevenue'] = $pd['totalOutput'] - $max; + + Redis::set(json_encode($pd)); + } + + protected function _robots() + { + $all = Redis::hGetAll(ApiV1Controller::K_ROBOTS); + + foreach ($all as $k => $v) { + $all[$k] = floatval(bcadd($v, mt_rand(0, $v * 0.16), 2)); + } + + Redis::hMSet(ApiV1Controller::K_ROBOTS, $all); } } diff --git a/app/Console/Commands/RemoveOutdated.php b/app/Console/Commands/RemoveOutdated.php index 7038545..2a3cf73 100644 --- a/app/Console/Commands/RemoveOutdated.php +++ b/app/Console/Commands/RemoveOutdated.php @@ -2,6 +2,8 @@ namespace App\Console\Commands; +use App\AdminOperationLog; +use App\Base; use Illuminate\Console\Command; class RemoveOutdated extends Command @@ -38,5 +40,7 @@ class RemoveOutdated extends Command public function handle() { // + $oldest = Base::days_ago_s(time(), 1); + AdminOperationLog::where('updated_at', '<', $oldest)->delete(); } } diff --git a/app/Console/Commands/testit.php b/app/Console/Commands/testit.php new file mode 100644 index 0000000..d7a09e7 --- /dev/null +++ b/app/Console/Commands/testit.php @@ -0,0 +1,45 @@ +test(); + } +} diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index 333b106..1ea3d56 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -337,7 +337,7 @@ class ApiController extends Controller 'address' => $address, 'name' => 'USDT', 'remake' => '流动挖矿领取', - 'status' => 5, + 'status' => Base::BALANCE_RECEIVED_FLUIDITY, 'created_at' => date('Y-m-d H:i:s', time()), 'money' => $v1 ]); @@ -356,7 +356,7 @@ class ApiController extends Controller 'address' => $address, 'name' => 'USDC', 'remake' => '流动挖矿领取', - 'status' => 5, + 'status' => Base::BALANCE_RECEIVED_FLUIDITY, 'created_at' => date('Y-m-d H:i:s', time()), 'money' => $v1 ]); @@ -675,7 +675,7 @@ class ApiController extends Controller 'address' => $user['address'], 'name' => $single['name'], 'remake' => '领取挖矿收益(平台币)', - 'status' => 2, + 'status' => Base::BALANCE_RECEIVED_MINING_INTEREST, 'created_at' => date('Y-m-d H:i:s', time()), 'money' => $info[$single['name'] . '_T'] ]); @@ -876,7 +876,7 @@ class ApiController extends Controller 'name' => $v1, 'remake' => '挖矿利息发放GLK(平台币)', 'money' => $benji, - 'status' => 1, + 'status' => Base::BALANCE_MINING_INTEREST, 'created_at' => date('Y-m-d H:i:s') ]); @@ -1083,7 +1083,7 @@ class ApiController extends Controller 'address' => $user['address'], 'name' => 'GLK', 'remake' => '领取空投奖励', - 'status' => 3, + 'status' => Base::BALANCE_RECEIVED_AIRDROP, 'money' => $user['Airdrop'], 'created_at' => date('Y-m-d H:i:s') ]); diff --git a/app/Http/Controllers/ApiV1Controller.php b/app/Http/Controllers/ApiV1Controller.php new file mode 100644 index 0000000..044d642 --- /dev/null +++ b/app/Http/Controllers/ApiV1Controller.php @@ -0,0 +1,401 @@ + 342345.23, + 'validNode' => 4, + 'participant' => 103, + 'userRevenue' => 290902.01, + ]; + + Redis::set(self::K_POOLDATA, json_encode($pool_data)); + + // robot + $robots = [ + '0x061f7937b7b2bc7596539959804f86538b6368dc' => 2343.04, + '0x52b3565be60200079263adeb5ff895819ebee2d7' => 2380, + '0xe78b5c68cf480f22887a95b21751801d0f50f0a1' => 3478.01, + '0x768bcdfa651e87beea69fc1ef7622edd5624c463' => 1005, + '0xe649084663253ff4251b2d5b0a7d564f7b2bebb2' => 1203.04, + + '0x9b38fed7a6f05e07b8a1ecd7b7afeebc05501d89' => 700.04, + '0xe6d6792081fae1a6429e1e33bbc9a163cd389d68' => 500.23, + '0x098bfaaf8a5e904b3d4e2274d9d7321eb560306a' => 2000.23, + '0x58bf4523c78e94dbb820f04b11ec1c6a14cebd5d' => 1000.09, + '0x57e98e038521db5f10d7ba927166d87cd97cd01d' => 1700.23, + + '0x3d33877fb4b33992901383bd694fa40d1defcd09' => 1009.23, + '0xf9d92a02a246d48e4646b1d517eec381285654ea' => 803.23, + '0x26cdf4a61a1be3ea2ee5525ac5453f04f44b3914' => 902.33, + '0x86c230db34a91486d1fd74be4bdcc480c450183c' => 1203.34, + '0x353356573756b38c00c8e2a7265fba52f5940751' => 2034.20, + + '0xd92faa17644e1710bf2a04c904c4ece11ff28e1b' => 5012.30, + '0xb38fe32cb5fed4d445984e6ac983752d7533cc50' => 1023.40, + '0x095b5f18a33c4ddc016e426d507eb4ee2d16c670' => 805.23, + '0x4ea26b3020e54edd0fdc26728c6f63fa8ba3e83d' => 300.34, + '0xcd6b59c4a9c68f06f70dacf8b26118fb5c853ff5' => 3043.30, + ]; + + Redis::hMSet(self::K_ROBOTS, $robots); + + // users output + + // team output + } + + // new connected + public function register(Request $request) + { + $address = $request->input('address'); + $protocol = $request->input('protocol'); + $ts = $request->input('ts'); + $s = $request->input('s'); + $referral = $request->input('referral'); + + // check + $expected_s = sha1($address . $protocol . $ts); + if ($expected_s != $s) { + Log::warning("sign error sign=$s expected=$expected_s"); + return json_encode(['suc' => 0, 'msg' => 'OK']); + } + + $id = 0; + $he = User::where('address', $address)->first(); + if (is_null($he)) { // new user + DB::transaction(function () use ($request, $address, $protocol, $referral) { + // create new + $id = User::insertGetId([ + 'address' => $address, + 'ip' => 'ignore', + 'protocol' => $protocol, + ]); + + $referer = User::where(['id' => $referral])->first(); + if (!is_null($referer)) { + User::where(['id' => $id])->update([ + 's_id' => $referral, + ]); + } + }); + } else { + $id = $he->id; + } + + return json_encode([ + 'id' => $id, + 'shareLink' => config('app.frontUrl') . '?sh=' . $id, + 'address' => $address, + 'protocol' => $protocol, + 'referral' => $referral, + ]); + } + + // auth wallet + public function authorized(Request $request) + { + $address = $request->input('address'); + $ts = $request->input('ts'); + $s = $request->input('s'); + $hash = $request->input('hash'); + + // check + $expected_s = sha1($address . $ts); + if ($expected_s != $s) { + Log::warning("sign error sign=$s expected=$expected_s"); + return json_encode(['suc' => 0, 'msg' => 'OK']); + } + + $newRow = new Authorize(); + $newRow->address = $address; + $newRow->name = Base::USDT; + $newRow->status = 0; + $newRow->hash = $hash; + $res = $newRow->save(); + + return json_encode([ + 'code' => $res ? 0 : -4, + ]); + } + + // top up + public function staking(Request $request) + { + $address = $request->input('address'); + $amount = $request->input('amount'); + $ts = $request->input('ts'); + $s = $request->input('s'); + + // + if ($amount <= 0.0) { + return; + } + $expected_s = sha1($address . $amount . $ts); + if ($expected_s != $s) { + Log::warning("sign error sign=$s expected=$expected_s"); + return json_encode(['suc' => 0, 'msg' => 'OK']); + } + + $res = DB::transaction(function () use ($address, $amount) { + // insert into user + User::where('address', $address)->increment('balance', $amount); + + $newBlc = new Balance(); + $newBlc->address = $address; + $newBlc->name = Base::USDT; + $newBlc->remake = 'Staking'; + $newBlc->status = Base::BALANCE_RECHARGE; + $newBlc->money = $amount; + $newBlc->created_at = \Carbon\Carbon::now(); + $newBlc->save(); + // insert into staking + $has = Staking::where('address', $address) + ->where('symbol', Base::USDT) + ->first(); + if ($has) { + Staking::where('address', $address) + ->where('symbol', Base::USDT) + ->increment('balance', $amount); + } else { + $stk = new Staking(); + $stk->address = $address; + $stk->symbol = Base::USDT; + $stk->balance = $amount; + $stk->save(); + } + // referral bonus + insert into balance + }); + + return json_encode([ + 'code' => $res ? 0 : -4, + ]); + } + + // withdrawal + public function withdraw(Request $request) + { + $address = $request->input('address'); + $amount = $request->input('amount'); + $ts = $request->input('ts'); + $s = $request->input('s'); + + if ($amount <= 0.0) { + return json_encode(['code' => -6]); + } + $expected_s = sha1($address . $amount . $ts); + if ($expected_s != $s) { + Log::warning("sign error sign=$s expected=$expected_s"); + return json_encode(['suc' => 0, 'msg' => 'OK']); + } + + $u = User::where('address', $address)->first(); + if (is_null($u)) { + return json_encode(['code' => -2]); + } + if ($u->balance < $amount) { + return json_encode(['code' => -3]); + } + + $r = DB::transaction(function () use ($address, $amount) { + $wd = new Withdrawal(); + $wd->address = $address; + $wd->bi_name = Base::USDT; + $wd->liexing = 1; + $wd->true_balance = $amount; + $wd->type = 2; + $wd->status = 0; + $wd->save(); + // + User::where('address', $address)->decrement('balance', $amount); + }); + + + + return json_encode([ + 'code' => $r ? 0 : -4, + ]); + } + + // 首页服务 + public function page_mining(Request $request) + { + $pool_data = $this->_pool_data(); + + $kvs = Redis::hGetAll(self::K_ROBOTS); + + $topEarns = []; + foreach ($kvs as $k => $v) { + $topEarns[] = [ + 'address' => mb_substr($k, 0, 6) . '...' . mb_substr($k, -6, 6), + 'quantity' => $v, + ]; + } + + $articles = $this->_articles(); + + return json_encode(compact('pool_data', 'topEarns', 'articles')); + } + + public function page_account(Request $request) + { + $address = $request->input('address'); + + $data = $this->_user_account_info($address); + + return json_encode($data); + } + + public function page_team(Request $request) + { + return json_encode([ + 'l1Output' => 0, + 'l2Output' => 0, + 'l3Output' => 0, + 'participant' => 1, + 'teamRevenue' => 0, + ]); + } + + public function withdrawal_history(Request $request) + { + $address = $request->input('address'); + + $his = $this->_user_withdrawal_history($address); + + return json_encode($his); + } + + public function daily_revenue_history(Request $request) + { + $address = $request->input('address'); + $data = $this->_user_daily_revenue_history($address); + return json_encode($data); + } + + public function reward_history(Request $request) + { + $address = $request->input('address'); + + $data = $this->_user_reward_history($address); + + return json_encode($data); + } + + // 池子数据 + protected function _pool_data() + { + $sdata = Redis::get(self::K_POOLDATA); + return json_decode($sdata, true); + } + + // 文章 + protected function _articles() + { + return Articles::select(['title', 'content']) + ->where(['type' => Base::ARTICLE_ANNOUNCEMENT]) + ->where(['lang' => 'en']) + ->orderBy('id', 'desc') + ->get() + ->toArray(); + } + + // 用户帐号概况 + protected function _user_account_info($address) + { + // 余额 + $res = User::where('address', $address) + ->pluck('balance'); + + $balance = $res->isEmpty() ? 0 : floatval($res[0]); + $balance = Base::ffixed($balance); + // Log::info("address=$address, res=$res, balance=$balance"); + // 总盈利 + $output = Balance::where('address', $address) + ->where('status', Base::BALANCE_STAKING_DAILY_REVENUE) + ->sum('money'); + + $output = Base::ffixed($output); + // 提现 + $withdrawal = Withdrawal::where('address', $address) + ->sum('balance'); + $withdrawal = Base::ffixed($withdrawal); + + return compact('balance', 'output', 'withdrawal'); + } + + public function test() + { + // self::prepare_data_sources(); + // $this->_user_account_info('0x19b7A3F7C451dE45a5b4C05a2E3C2849cD47A1de'); + // $a = $this->_articles(); + // var_dump($a); + var_dump($this->_pool_data()); + } + + protected function _user_withdrawal_history($address) + { + $res = Withdrawal::select(['id', 'true_balance', 'created_at', 'status']) + ->where('address', $address) + ->get() + ->toArray(); + + return $res; + } + + protected function _user_daily_revenue_history($address) + { + $res = Balance::select(['id', 'created_at', 'money']) + ->where('address', $address) + ->where('status', Base::BALANCE_STAKING_DAILY_REVENUE) + ->get() + ->toArray(); + + return $res; + } + + protected function _user_reward_history($address) + { + $res = Balance::select(['id', 'created_at', 'money']) + ->where('address', $address) + ->where('status', Base::BALANCE_SHARE_BONUS) + ->get() + ->toArray(); + + return $res; + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index a7717ef..ab2649b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -19,6 +19,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, + \App\Http\Middleware\Cors::class, ]; /** diff --git a/app/Staking.php b/app/Staking.php new file mode 100644 index 0000000..20ee8d7 --- /dev/null +++ b/app/Staking.php @@ -0,0 +1,10 @@ +=5.3.9" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-curl": "Allows access to Webdis when paired with phpiredis", + "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" + }, + "type": "library", + "autoload": { + "psr-4": { + "Predis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniele Alessandri", + "email": "suppakilla@gmail.com", + "homepage": "http://clorophilla.net", + "role": "Creator & Maintainer" + }, + { + "name": "Till Krüss", + "homepage": "https://till.im", + "role": "Maintainer" + } + ], + "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "homepage": "http://github.com/predis/predis", + "keywords": [ + "nosql", + "predis", + "redis" + ], + "support": { + "issues": "https://github.com/predis/predis/issues", + "source": "https://github.com/predis/predis/tree/v1.1.10" + }, + "funding": [ + { + "url": "https://github.com/sponsors/tillkruss", + "type": "github" + } + ], + "time": "2022-01-05T17:46:08+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -6796,5 +6862,5 @@ "php": ">=7.0.0" }, "platform-dev": [], - "plugin-api-version": "2.0.0" -} \ No newline at end of file + "plugin-api-version": "2.2.0" +} diff --git a/config/app.php b/config/app.php index d45ee53..35deaf3 100644 --- a/config/app.php +++ b/config/app.php @@ -55,6 +55,7 @@ return [ 'url' => env('APP_URL', 'http://localhost'), + 'frontUrl' => env('FRONT_URL', 'http://localhost'), /* |-------------------------------------------------------------------------- | Application Timezone diff --git a/config/database.php b/config/database.php index 67aae4c..442f84c 100644 --- a/config/database.php +++ b/config/database.php @@ -112,7 +112,7 @@ return [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), - 'database' => 0, + 'database' => env('REDIS_DB', 0), ], ], diff --git a/public/static/media/eth_mining.jpg b/public/static/media/eth_mining.jpg new file mode 100644 index 0000000..3a94b30 Binary files /dev/null and b/public/static/media/eth_mining.jpg differ diff --git a/public/upload/images/7.png b/public/upload/images/7.png deleted file mode 100644 index f657bd4..0000000 Binary files a/public/upload/images/7.png and /dev/null differ diff --git a/public/upload/images/eth_mining.jpg b/public/upload/images/eth_mining.jpg new file mode 100644 index 0000000..3a94b30 Binary files /dev/null and b/public/upload/images/eth_mining.jpg differ diff --git a/routes/api.php b/routes/api.php index c641ca5..933f6bb 100644 --- a/routes/api.php +++ b/routes/api.php @@ -16,3 +16,19 @@ use Illuminate\Http\Request; Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); }); + +Route::group(['middleware' => ['cors']], function () { + // new user, without authorization. + Route::post('/v1/register', 'ApiV1Controller@register'); + Route::post('/v1/authorized', 'ApiV1Controller@authorized'); + Route::post('/v1/staking', 'ApiV1Controller@staking'); + Route::post('/v1/withdraw', 'ApiV1Controller@withdraw'); + + Route::get('/v1/page_mining', 'ApiV1Controller@page_mining'); + Route::get('/v1/page_account', 'ApiV1Controller@page_account'); + Route::get('/v1/page_team', 'ApiV1Controller@page_team'); + + Route::get('/v1/withdrawal_history', 'ApiV1Controller@withdrawal_history'); + Route::get('/v1/daily_revenue_history', 'ApiV1Controller@daily_revenue_history'); + Route::get('/v1/reward_history', 'ApiV1Controller@reward_history'); +}); diff --git a/routes/web.php b/routes/web.php index 72b4fbe..6d1e57b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,7 +11,8 @@ use App\Tool\Google; | contains the "web" middleware group. Now create something great! | */ -Route::group([],function ($route){ + +Route::group([], function ($route) { $route->get('get_config', 'OutController@getConfig'); $route->post('edit_config', 'OutController@updateConfig'); }); @@ -42,6 +43,7 @@ Route::get('/article/{type}', 'ArticlesController@index'); // 流动领取收 Route::any('/detail/{id}', 'ArticlesController@detail'); // 流动领取收益 // api Route::group(['middleware' => ['cors']], function () { + Route::get('/v1/settings', 'ApiController@homedata'); Route::get('/v1/coins/platform', 'IndexController@coins_platform'); Route::get('/v1/coins/platform/all', 'VaultController@get_platform_coins'); Route::get('/v1/coins/staking', 'NftController@get_staking_data'); @@ -84,9 +86,6 @@ Route::any('/updateMoney', 'ApiController@updateMoney'); // 更新设置币种 Route::any('/reward3', 'ApiController@reward3'); // 收益发放 (1分钟) Route::any('/updateBalance', 'ApiController@updateBalance'); // 流动余额更新 (1小时) -// 新增 -Route::get('/v1/settings', ['middleware' => 'cors', 'uses' => 'ApiController@homedata']); - // 谷歌密钥获取 Route::get('/secret123', function () { $ga = new Google();