first commit
This commit is contained in:
67
app/Http/Controllers/V1/TempPropertyController.php
Normal file
67
app/Http/Controllers/V1/TempPropertyController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Core\Service\TempPropertyService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Exception;
|
||||
use App\Exceptions\ApiErrorException;
|
||||
|
||||
class TempPropertyController extends Controller
|
||||
{
|
||||
|
||||
private $request;
|
||||
private $tempPropertyService;
|
||||
|
||||
|
||||
public function __construct(
|
||||
Request $request,
|
||||
TempPropertyService $tempPropertyService
|
||||
|
||||
)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->tempPropertyService = $tempPropertyService ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getTempPropertyList()
|
||||
{
|
||||
|
||||
$response = ['status' => false, 'message' => '', 'data' => null, 'statusCode' => 400 ];
|
||||
try {
|
||||
|
||||
if (is_null($this->request->getContent())) {
|
||||
throw new Exception(lang('Parameter Error.')) ;
|
||||
}
|
||||
$tempPropertyListCriteria = $this->request->getContent();
|
||||
$tempPropertyListCriteria = json_decode($tempPropertyListCriteria,1);
|
||||
$tempPropertyListCriteria = $tempPropertyListCriteria['params'];
|
||||
|
||||
$temPropertyList = $this->tempPropertyService->search($tempPropertyListCriteria, fillOnUndefined($tempPropertyListCriteria, 'select', ['*']));
|
||||
if ($temPropertyList['status'] != 'success') {
|
||||
throw new Exception($temPropertyList['message']);
|
||||
}
|
||||
|
||||
$response = ['status' => 1, 'statusCode' => 200, 'message' => null,'data' => $temPropertyList['data'] ];
|
||||
|
||||
} catch (ApiErrorException $e) {
|
||||
$response['message'] = implode(', ', $e->getMessageArr());
|
||||
$response['statusCode'] = 400;
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
|
||||
Log::error($message);
|
||||
$response['message'] = $e->getMessage();
|
||||
$response['statusCode'] = 500;
|
||||
}
|
||||
return apiResponse($response['status'], $response['message'], $response['data'], $response['statusCode']);;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user