feature: i18n

This commit is contained in:
Tokumeikoi 2020-10-13 23:55:17 +08:00
parent c984fa2e0b
commit 393680c963
14 changed files with 19 additions and 11 deletions

View File

@ -73,10 +73,12 @@ class ShadowsocksTidalabController extends Controller
Cache::put(CacheKey::get('SERVER_SHADOWSOCKS_ONLINE_USER', $server->id), count($data), 3600); Cache::put(CacheKey::get('SERVER_SHADOWSOCKS_ONLINE_USER', $server->id), count($data), 3600);
$serverService = new ServerService(); $serverService = new ServerService();
$userService = new UserService(); $userService = new UserService();
DB::beginTransaction();
foreach ($data as $item) { foreach ($data as $item) {
$u = $item['u'] * $server->rate; $u = $item['u'] * $server->rate;
$d = $item['d'] * $server->rate; $d = $item['d'] * $server->rate;
if (!$userService->trafficFetch((float)$u, (float)$d, (int)$item['user_id'])) { if (!$userService->trafficFetch((float)$u, (float)$d, (int)$item['user_id'])) {
DB::rollBack();
return response([ return response([
'ret' => 0, 'ret' => 0,
'msg' => 'user fetch fail' 'msg' => 'user fetch fail'
@ -92,6 +94,7 @@ class ShadowsocksTidalabController extends Controller
'trojan' 'trojan'
); );
} }
DB::commit();
return response([ return response([
'ret' => 1, 'ret' => 1,

View File

@ -74,10 +74,12 @@ class TrojanTidalabController extends Controller
Cache::put(CacheKey::get('SERVER_TROJAN_ONLINE_USER', $server->id), count($data), 3600); Cache::put(CacheKey::get('SERVER_TROJAN_ONLINE_USER', $server->id), count($data), 3600);
$serverService = new ServerService(); $serverService = new ServerService();
$userService = new UserService(); $userService = new UserService();
DB::beginTransaction();
foreach ($data as $item) { foreach ($data as $item) {
$u = $item['u'] * $server->rate; $u = $item['u'] * $server->rate;
$d = $item['d'] * $server->rate; $d = $item['d'] * $server->rate;
if (!$userService->trafficFetch($u, $d, $item['user_id'])) { if (!$userService->trafficFetch($u, $d, $item['user_id'])) {
DB::rollBack();
return response([ return response([
'ret' => 0, 'ret' => 0,
'msg' => 'user fetch fail' 'msg' => 'user fetch fail'
@ -93,6 +95,7 @@ class TrojanTidalabController extends Controller
'trojan' 'trojan'
); );
} }
DB::commit();
return response([ return response([
'ret' => 1, 'ret' => 1,

View File

@ -80,7 +80,7 @@ class UserService
{ {
$user = User::find($userId); $user = User::find($userId);
if (!$user) { if (!$user) {
return false; return true;
} }
$user->t = time(); $user->t = time();
$user->u = $user->u + $u; $user->u = $user->u + $u;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="/assets/admin/antd.chunk.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/admin/components.chunk.css?v={{$verison}}">
<link rel="stylesheet" href="/assets/admin/umi.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/admin/umi.css?v={{$verison}}">
<link rel="stylesheet" href="/assets/admin/custom.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/admin/custom.css?v={{$verison}}">
<meta charset="utf-8"> <meta charset="utf-8">
@ -27,7 +27,7 @@
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/assets/admin/vendors.async.js?v={{$verison}}"></script> <script src="/assets/admin/vendors.async.js?v={{$verison}}"></script>
<script src="/assets/admin/antd.async.js?v={{$verison}}"></script> <script src="/assets/admin/components.async.js?v={{$verison}}"></script>
<script src="/assets/admin/umi.js?v={{$verison}}"></script> <script src="/assets/admin/umi.js?v={{$verison}}"></script>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script>

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<link rel="stylesheet" href="/assets/user/antd.chunk.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/user/components.chunk.css?v={{$verison}}">
<link rel="stylesheet" href="/assets/user/umi.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/user/umi.css?v={{$verison}}">
<link rel="stylesheet" href="/assets/user/custom.css?v={{$verison}}"> <link rel="stylesheet" href="/assets/user/custom.css?v={{$verison}}">
<meta charset="utf-8"> <meta charset="utf-8">
@ -28,7 +28,7 @@
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/assets/user/vendors.async.js?v={{$verison}}"></script> <script src="/assets/user/vendors.async.js?v={{$verison}}"></script>
<script src="/assets/user/antd.async.js?v={{$verison}}"></script> <script src="/assets/user/components.async.js?v={{$verison}}"></script>
<script src="/assets/user/umi.js?v={{$verison}}"></script> <script src="/assets/user/umi.js?v={{$verison}}"></script>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script>