|
|
@@ -42,6 +42,13 @@ final class UserController extends BaseController
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ if ($node->type === 0) {
|
|
|
+ return $response->withJson([
|
|
|
+ 'ret' => 0,
|
|
|
+ 'msg' => 'Node is not enabled.',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
$node->update(['node_heartbeat' => time()]);
|
|
|
|
|
|
if ($node->node_bandwidth_limit !== 0 && $node->node_bandwidth_limit <= $node->node_bandwidth) {
|
|
|
@@ -160,6 +167,13 @@ final class UserController extends BaseController
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ if ($node->type === 0) {
|
|
|
+ return $response->withJson([
|
|
|
+ 'ret' => 0,
|
|
|
+ 'msg' => 'Node is not enabled.',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
$pdo = DB::getPdo();
|
|
|
$stat = $pdo->prepare('
|
|
|
UPDATE user SET last_use_time = UNIX_TIMESTAMP(),
|
|
|
@@ -228,14 +242,22 @@ final class UserController extends BaseController
|
|
|
|
|
|
$data = $data->data;
|
|
|
$node_id = $request->getQueryParam('node_id');
|
|
|
+ $node = (new Node())->find($node_id);
|
|
|
|
|
|
- if ($node_id === null || ! (new Node())->where('id', $node_id)->exists()) {
|
|
|
+ if ($node === null) {
|
|
|
return $response->withJson([
|
|
|
'ret' => 0,
|
|
|
'msg' => 'Node not found.',
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ if ($node->type === 0) {
|
|
|
+ return $response->withJson([
|
|
|
+ 'ret' => 0,
|
|
|
+ 'msg' => 'Node is not enabled.',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
$stat = DB::getPdo()->prepare('
|
|
|
INSERT INTO online_log (user_id, ip, node_id, first_time, last_time)
|
|
|
VALUES (?, ?, ?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP())
|
|
|
@@ -285,14 +307,22 @@ final class UserController extends BaseController
|
|
|
|
|
|
$data = $data->data;
|
|
|
$node_id = $request->getQueryParam('node_id');
|
|
|
+ $node = (new Node())->find($node_id);
|
|
|
|
|
|
- if ($node_id === null || ! (new Node())->where('id', $node_id)->exists()) {
|
|
|
+ if ($node === null) {
|
|
|
return $response->withJson([
|
|
|
'ret' => 0,
|
|
|
'msg' => 'Node not found.',
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ if ($node->type === 0) {
|
|
|
+ return $response->withJson([
|
|
|
+ 'ret' => 0,
|
|
|
+ 'msg' => 'Node is not enabled.',
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($data as $log) {
|
|
|
$list_id = (int) $log?->list_id;
|
|
|
$user_id = (int) $log?->user_id;
|