|
@@ -9,6 +9,7 @@ use App\Models\Server;
|
|
|
use App\Models\ServerTrojan;
|
|
|
use App\Utils\CacheKey;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class ServerService
|
|
|
{
|
|
@@ -268,12 +269,18 @@ class ServerService
|
|
|
->where('user_id', $userId)
|
|
|
->where('rate', $rate)
|
|
|
->where('method', $method)
|
|
|
- ->lockForUpdate()
|
|
|
->first();
|
|
|
if ($serverLog) {
|
|
|
- $serverLog->u = $serverLog->u + $u;
|
|
|
- $serverLog->d = $serverLog->d + $d;
|
|
|
- return $serverLog->save();
|
|
|
+ try {
|
|
|
+ $serverLog->update([
|
|
|
+ 'u' => DB::raw("u+{$u}"),
|
|
|
+ 'd' => DB::raw("d+{$d}")
|
|
|
+ ]);
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ info($e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
} else {
|
|
|
$serverLog = new ServerLog();
|
|
|
$serverLog->user_id = $userId;
|