write find code for harim

This commit is contained in:
2025-11-01 15:39:42 +03:30
parent 0f7fcd7d1b
commit 93384d39ee
3 changed files with 18 additions and 5 deletions

View File

@@ -21,6 +21,13 @@ class PanjareVahedController extends Controller
public function receiveNewRequest(ReceiveNewRequest $request): JsonResponse
{
$iv = config('harim_web_services.Get_Info.iv');
$keyString = config('harim_web_services.Get_Info.keyString');
$key = hash('sha256',$keyString, true);
$decrypted = openssl_decrypt($request->data, 'aes-256-cbc', $key, false, $iv);
$wkt = 'POLYGON(('.implode(',', array_map(fn ($c) => "{$c[0]} {$c[1]}", $request->primary_area['coordinates'])).'))';
$result = DB::selectOne('SELECT ST_AsText(ST_PointOnSurface(ST_GeomFromText(?, 4326))) AS point', [$wkt]);
preg_match('/POINT\(([^ ]+) ([^ ]+)\)/', $result->point, $matches);
@@ -62,12 +69,11 @@ class PanjareVahedController extends Controller
'response_options' => json_encode($request->response_options),
'isic' => $request->isic,
'primary_area' => json_encode($request->primary_area),
'data' => $request->data['data'],
'token' => $request->data['token'],
'data' => $decrypted,
'token' => $decrypted->token,
]);
return response()->json([
'request_id' => $request->request_id,
'id' => $harim->id,
'city' => $city->edarateShahri()->first()->name_fa,
'province' => $city->province()->first()->name_fa,