Skip to content

Commit

Permalink
init v2ray support
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Nov 19, 2017
1 parent d0765ea commit dc57308
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 28 deletions.
29 changes: 29 additions & 0 deletions app/Console/Commands/V2rayInit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php


namespace App\Console\Commands;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use App\Models\User;
use App\Utils\Tools;

class V2rayInit extends Base
{
protected function configure()
{
$this->setName('v2ray:init');
$this->setDescription('Init v2ray Users');
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$users = User::all();
foreach ($users as $user){
if(strlen($user->v2ray_uuid) == 0){
$user->v2ray_uuid = Tools::genUUID();
$user->save();
}
}
}
}
1 change: 1 addition & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Kernel
Commands\Migration::class,
Commands\GenLang::class,
Commands\CreateAdmin::class,
Commands\V2rayInit::class,
];

public function __construct()
Expand Down
1 change: 1 addition & 0 deletions app/Services/Factories/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static function newPaypalClient()
$apiContext = new ApiContext(
new OAuthTokenCredential(config('paypal.client_id'), config('paypal.secret'))
);
$apiContext->setConfig(config('paypal'));
return $apiContext;
}
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"tracy/tracy": "^2.4",
"shadowsocks/shadowsocks": "0.1.*",
"zircote/swagger-php": "^2.0",
"illuminate/pagination": "^5.4",
"illuminate/pagination": "^5.5",
"martinlindhe/laravel-vue-i18n-generator": "^0.1.13",
"illuminate/events": "^5.4",
"pongtan/fake-laravel": "^0.0.1",
"illuminate/events": "^5.5",
"pongtan/fake-laravel": "^5.5",
"paypal/rest-api-sdk-php": "^1.12",
"latrell/alipay": "^1.2"
},
Expand Down
51 changes: 26 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/v2ray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'alter_id' => 2,
'level' => 2,
];
31 changes: 31 additions & 0 deletions databases/2017_11_19_205437_update_user_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UpdateUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user', function (Blueprint $table) {
$table->string('v2ray_uuid')->default("");
$table->integer('v2ray_level')->default(2);
$table->integer('v2ray_alter_id')->default(2);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

0 comments on commit dc57308

Please sign in to comment.