diff --git a/app/Http/Controllers/api/CurrencyController.php b/app/Http/Controllers/api/CurrencyController.php index 9fbe3e6..f043061 100644 --- a/app/Http/Controllers/api/CurrencyController.php +++ b/app/Http/Controllers/api/CurrencyController.php @@ -29,7 +29,11 @@ class CurrencyController extends Controller // 4. Debug check: If it is STILL empty, the API failed and we have no backup data yet. if ($goldCurrencies->isEmpty()) { - return $this->failed(null, 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.'); + // FIX: Pass an array to format the 'alert' as a JSON Object for Kotlin! + return $this->failed(null, [ + 'title' => 'خطا', + 'message' => 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.' + ]); } // 5. Map the data @@ -61,7 +65,7 @@ class CurrencyController extends Controller try { $url = 'https://BrsApi.ir/Api/Market/Gold_Currency.php?key=B727Ue3kBrbtCwHR3BmSVZKRRNF1sllp'; - // FIX: Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls + // Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls $response = Http::withoutVerifying() ->withHeaders([ 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',