update: other

This commit is contained in:
tokumeikoi 2021-01-10 03:25:31 +09:00
parent 3f1c505922
commit c5639a9bef
5 changed files with 15 additions and 7 deletions

View File

@ -5,6 +5,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use App\Models\Order; use App\Models\Order;
use App\Models\User; use App\Models\User;
use Illuminate\Support\Facades\DB;
class CheckCommission extends Command class CheckCommission extends Command
{ {
@ -62,13 +63,20 @@ class CheckCommission extends Command
->where('invite_user_id', '!=', NULL) ->where('invite_user_id', '!=', NULL)
->get(); ->get();
foreach ($order as $item) { foreach ($order as $item) {
DB::beginTransaction();
$inviter = User::find($item->invite_user_id); $inviter = User::find($item->invite_user_id);
if (!$inviter) continue; if (!$inviter) continue;
$inviter->commission_balance = $inviter->commission_balance + $item->commission_balance; $inviter->commission_balance = $inviter->commission_balance + $item->commission_balance;
if ($inviter->save()) { if (!$inviter->save()) {
$item->commission_status = 2; DB::rollBack();
$item->save(); continue;
} }
$item->commission_status = 2;
if (!$item->save()){
DB::rollBack();
continue;
}
DB::commit();
} }
} }

View File

@ -125,7 +125,7 @@ class V2rayController extends Controller
public function viewConfig(Request $request) public function viewConfig(Request $request)
{ {
$serverService = new ServerService(); $serverService = new ServerService();
$config = $serverService->getVmessConfig($request->input('node_id'), 23333); $config = $serverService->getV2RayConfig($request->input('node_id'), 23333);
return response([ return response([
'data' => $config 'data' => $config
]); ]);

View File

@ -109,7 +109,7 @@ class DeepbworkController extends Controller
} }
$serverService = new ServerService(); $serverService = new ServerService();
try { try {
$json = $serverService->getVmessConfig($nodeId, $localPort); $json = $serverService->getV2RayConfig($nodeId, $localPort);
} catch (\Exception $e) { } catch (\Exception $e) {
abort(500, $e->getMessage()); abort(500, $e->getMessage());
} }

View File

@ -92,7 +92,7 @@ class PoseidonController extends Controller
$serverService = new ServerService(); $serverService = new ServerService();
try { try {
$json = $serverService->getVmessConfig($nodeId, $localPort); $json = $serverService->getV2RayConfig($nodeId, $localPort);
$json->poseidon = [ $json->poseidon = [
'license_key' => (string)config('v2board.server_license'), 'license_key' => (string)config('v2board.server_license'),
]; ];

View File

@ -126,7 +126,7 @@ class ServerService
->get(); ->get();
} }
public function getVmessConfig(int $nodeId, int $localPort) public function getV2RayConfig(int $nodeId, int $localPort)
{ {
$server = Server::find($nodeId); $server = Server::find($nodeId);
if (!$server) { if (!$server) {