-
Notifications
You must be signed in to change notification settings - Fork 26
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
1 parent
ccb105d
commit 4fbc81f
Showing
346 changed files
with
40,734 additions
and
24 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,48 @@ | ||
APP_NAME=V2Board | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=false | ||
APP_URL=http://localhost | ||
|
||
LOG_CHANNEL=stack | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=localhost | ||
DB_PORT=3306 | ||
DB_DATABASE=laravel | ||
DB_USERNAME=root | ||
DB_PASSWORD=123456 | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
QUEUE_CONNECTION=redis | ||
SESSION_DRIVER=redis | ||
SESSION_LIFETIME=120 | ||
|
||
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 | ||
MAIL_FROM_ADDRESS=null | ||
MAIL_FROM_NAME=null | ||
MAILGUN_DOMAIN= | ||
MAILGUN_SECRET= | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
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,5 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.scss linguist-vendored | ||
*.js linguist-vendored | ||
CHANGELOG.md export-ignore |
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 |
---|---|---|
@@ -1,23 +1,21 @@ | ||
/vendor/ | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# Laravel 4 specific | ||
bootstrap/compiled.php | ||
app/storage/ | ||
|
||
# Laravel 5 & Lumen specific | ||
public/storage | ||
public/hot | ||
|
||
# Laravel 5 & Lumen specific with changed public path | ||
public_html/storage | ||
public_html/hot | ||
|
||
storage/*.key | ||
/node_modules | ||
/config/v2board.php | ||
/public/hot | ||
/public/storage | ||
/public/env.example.js | ||
/storage/*.key | ||
/vendor | ||
.env | ||
Homestead.yaml | ||
Homestead.json | ||
/.vagrant | ||
.env.backup | ||
.phpunit.result.cache | ||
.idea | ||
.lock | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
composer.phar | ||
composer.lock | ||
yarn.lock | ||
docker-compose.yml | ||
.DS_Store |
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 |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# lotusboard | ||
NeoBranch Only! | Enhanced V2board | ||
# Lotusboard | ||
|
||
The enhanced v2board | ||
|
||
### UserManual | 用戶手冊 | ||
|
||
[Documents](https://lotusnetwork.github.io) | ||
|
||
Hysteria | ||
- Multiple bugs fixed | ||
|
||
VLESS | ||
- Add vless support | ||
- Multi GUN mode on grpc | ||
- other stuffs that Vmess has | ||
- XTLS supported | ||
|
||
Vmess | ||
- TLS fingerprint, firefox by default | ||
- Websocket ed4096(0rtt enabled for xray) | ||
- Subscription info was translated into English | ||
- Auto zero encryption when TLS enabled | ||
|
||
|
||
Subscription: | ||
|
||
- ClashVPN mode profile (Proxy all traffic except local and icmp), add &flag=gclh to fetch it | ||
|
||
- Simplified the default clash config |
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,127 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\CommissionLog; | ||
use Illuminate\Console\Command; | ||
use App\Models\Order; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class CheckCommission extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'check:commission'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = '返佣服务'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->autoCheck(); | ||
$this->autoPayCommission(); | ||
} | ||
|
||
public function autoCheck() | ||
{ | ||
if ((int)config('v2board.commission_auto_check_enable', 1)) { | ||
Order::where('commission_status', 0) | ||
->where('invite_user_id', '!=', NULL) | ||
->where('status', 3) | ||
->where('updated_at', '<=', strtotime('-3 day', time())) | ||
->update([ | ||
'commission_status' => 1 | ||
]); | ||
} | ||
} | ||
|
||
public function autoPayCommission() | ||
{ | ||
$orders = Order::where('commission_status', 1) | ||
->where('invite_user_id', '!=', NULL) | ||
->get(); | ||
foreach ($orders as $order) { | ||
DB::beginTransaction(); | ||
if (!$this->payHandle($order->invite_user_id, $order)) { | ||
DB::rollBack(); | ||
continue; | ||
} | ||
$order->commission_status = 2; | ||
if (!$order->save()) { | ||
DB::rollBack(); | ||
continue; | ||
} | ||
DB::commit(); | ||
} | ||
} | ||
|
||
public function payHandle($inviteUserId, Order $order) | ||
{ | ||
$level = 3; | ||
if ((int)config('v2board.commission_distribution_enable', 0)) { | ||
$commissionShareLevels = [ | ||
0 => (int)config('v2board.commission_distribution_l1'), | ||
1 => (int)config('v2board.commission_distribution_l2'), | ||
2 => (int)config('v2board.commission_distribution_l3') | ||
]; | ||
} else { | ||
$commissionShareLevels = [ | ||
0 => 100 | ||
]; | ||
} | ||
for ($l = 0; $l < $level; $l++) { | ||
$inviter = User::find($inviteUserId); | ||
if (!$inviter) continue; | ||
if (!isset($commissionShareLevels[$l])) continue; | ||
$commissionBalance = $order->commission_balance * ($commissionShareLevels[$l] / 100); | ||
if (!$commissionBalance) continue; | ||
if ((int)config('v2board.withdraw_close_enable', 0)) { | ||
$inviter->balance = $inviter->balance + $commissionBalance; | ||
} else { | ||
$inviter->commission_balance = $inviter->commission_balance + $commissionBalance; | ||
} | ||
if (!$inviter->save()) { | ||
DB::rollBack(); | ||
return false; | ||
} | ||
if (!CommissionLog::create([ | ||
'invite_user_id' => $inviteUserId, | ||
'user_id' => $order->user_id, | ||
'trade_no' => $order->trade_no, | ||
'order_amount' => $order->total_amount, | ||
'get_amount' => $commissionBalance | ||
])) { | ||
DB::rollBack(); | ||
return false; | ||
} | ||
$inviteUserId = $inviter->invite_user_id; | ||
// update order actual commission balance | ||
$order->actual_commission_balance = $order->actual_commission_balance + $commissionBalance; | ||
} | ||
return true; | ||
} | ||
|
||
} |
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,54 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Jobs\OrderHandleJob; | ||
use App\Services\OrderService; | ||
use Illuminate\Console\Command; | ||
use App\Models\Order; | ||
use App\Models\User; | ||
use App\Models\Plan; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
class CheckOrder extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'check:order'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = '订单检查任务'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
ini_set('memory_limit', -1); | ||
$orders = Order::whereIn('status', [0, 1]) | ||
->orderBy('created_at', 'ASC') | ||
->get(); | ||
foreach ($orders as $order) { | ||
OrderHandleJob::dispatch($order->trade_no); | ||
} | ||
} | ||
} |
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,65 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Services\ServerService; | ||
use App\Services\TelegramService; | ||
use App\Utils\CacheKey; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Cache; | ||
|
||
class CheckServer extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'check:server'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = '节点检查任务'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->checkOffline(); | ||
} | ||
|
||
private function checkOffline() | ||
{ | ||
$serverService = new ServerService(); | ||
$servers = $serverService->getAllServers(); | ||
foreach ($servers as $server) { | ||
if ($server['parent_id']) continue; | ||
if ($server['last_check_at'] && (time() - $server['last_check_at']) > 1800) { | ||
$telegramService = new TelegramService(); | ||
$message = sprintf( | ||
"节点掉线通知\r\n----\r\n节点名称:%s\r\n节点地址:%s\r\n", | ||
$server['name'], | ||
$server['host'] | ||
); | ||
$telegramService->sendMessageWithAdmin($message); | ||
Cache::forget(CacheKey::get(sprintf("SERVER_%s_LAST_CHECK_AT", strtoupper($server['type'])), $server->id)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.