Tul xxx Tul
User / IP
:
216.73.216.159
Host / Server
:
45.84.207.204 / aircan.me
System
:
Linux lt-bnk-web1726.main-hosting.eu 5.14.0-611.36.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 3 11:23:52 EST 2026 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
u931257429
/
domains
/
aircan.me
/
public_html
/
ventas
/
app
/
Http
/
Controllers
/
API
/
Viewing: SyncController.php
<?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use App\Services\SyncService; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; class SyncController extends Controller { protected $syncService; public function __construct(SyncService $syncService) { $this->syncService = $syncService; } public function ping() { return response()->json([ 'status' => 'ok', 'server_time' => now()->toIso8601String(), 'version' => config('app.version', '1.0.0'), ]); } public function status() { return response()->json([ 'status' => 'ok', 'server_time' => now()->toIso8601String(), 'stats' => $this->syncService->getStats(), ]); } public function push(Request $request) { $request->validate([ 'device_id' => 'required|string', 'table' => 'required|string', 'items' => 'required|array', ]); $results = []; $deviceId = $request->input('device_id'); $table = $request->input('table'); foreach ($request->input('items') as $item) { try { $this->applyChange($table, $item); $results[$item['uuid']] = ['success' => true]; } catch (\Exception $e) { $results[$item['uuid']] = [ 'success' => false, 'error' => $e->getMessage(), ]; } } return response()->json([ 'status' => 'ok', 'results' => $results, 'processed_at' => now()->toIso8601String(), ]); } protected function applyChange(string $table, array $item): void { $operation = $item['operation']; $data = $item['data'] ?? []; $recordId = $item['record_id']; DB::beginTransaction(); try { switch ($operation) { case 'insert': $exists = DB::table($table)->where('id', $recordId)->exists(); if (!$exists) { DB::table($table)->insert($data); } else { DB::table($table)->where('id', $recordId)->update($data); } break; case 'update': DB::table($table)->where('id', $recordId)->update($data); break; case 'delete': DB::table($table)->where('id', $recordId)->delete(); break; } DB::commit(); } catch (\Exception $e) { DB::rollBack(); throw $e; } } public function pull(Request $request) { $since = $request->input('since'); $deviceId = $request->input('device_id'); $items = []; $syncableTables = [ 'productos', 'categorias', 'clientes', 'proveedores', ]; foreach ($syncableTables as $table) { try { $query = DB::table($table); if ($since) { $query->where('updated_at', '>', $since); } $records = $query->get(); foreach ($records as $record) { $items[] = [ 'table' => $table, 'operation' => 'update', 'record_id' => $record->id, 'data' => (array) $record, 'updated_at' => $record->updated_at, ]; } } catch (\Exception $e) { continue; } } return response()->json([ 'status' => 'ok', 'items' => $items, 'count' => count($items), 'server_time' => now()->toIso8601String(), ]); } public function syncNow() { $results = $this->syncService->fullSync(); return response()->json([ 'status' => 'ok', 'results' => $results, ]); } public function retryFailed() { $results = $this->syncService->retryFailed(); return response()->json([ 'status' => 'ok', 'results' => $results, ]); } public function clearOld(Request $request) { $days = $request->input('days', 7); $deleted = $this->syncService->clearSynced($days); return response()->json([ 'status' => 'ok', 'deleted' => $deleted, ]); } }
Coded With 💗 by
0x6ick