refactor the web services
This commit is contained in:
@@ -5,29 +5,42 @@ namespace App\Services;
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use SoapClient;
|
||||
use SoapFault;
|
||||
|
||||
class NikarayanService
|
||||
{
|
||||
/**
|
||||
* @throws SoapFault
|
||||
*/
|
||||
public function updateRoadObservedInfoByNikarayan(Request $request, RoadObserved $roadObserved, $files)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
$url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
|
||||
try {
|
||||
$url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
|
||||
|
||||
$array = array('strUserName' => 'vaytelrop',
|
||||
'strPassword' => 'VaYtelROP*2024',
|
||||
'strAutoID' => $roadObserved->fk_RegisteredEventMessage,
|
||||
'strStateID' => ($request->input('rms-status') == 1) ? '2' : '3',
|
||||
'strDescription' => $request->input('rms-description') ?? $roadObserved->rms_description,
|
||||
'strPreviousImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strNextImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strRMSDateAndTime' => $roadObserved->updated_at
|
||||
);
|
||||
$array = array('strUserName' => 'vaytelrop',
|
||||
'strPassword' => 'VaYtelROP*2024',
|
||||
'strAutoID' => $roadObserved->fk_RegisteredEventMessage,
|
||||
'strStateID' => ($request->input('rms-status') == 1) ? '2' : '3',
|
||||
'strDescription' => $request->input('rms-description') ?? $roadObserved->rms_description,
|
||||
'strPreviousImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strNextImageLink' => "https://rms.rmto.ir/".$files,
|
||||
'strRMSDateAndTime' => $roadObserved->updated_at
|
||||
);
|
||||
|
||||
$soapClient = new SoapClient($url);
|
||||
$soapClient = new SoapClient($url);
|
||||
$result = $soapClient->UpdateInfo_RoadObservedProblems($array);
|
||||
Log::channel('nikarayan')->info($result);
|
||||
|
||||
return $soapClient->UpdateInfo_RoadObservedProblems($array);
|
||||
return $result;
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Log::channel('nikarayan')->error($e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user