Files
pgserver3.0/pgserver/application/admin/controller/PriceQuery.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

60 lines
2.3 KiB
PHP

<?php
namespace app\admin\controller;
use app\util\ReturnCode;
use app\model\Estate as EstateModel;
/**
* 价格查询控制器
* @author zdc
*
* Class PriceQuery
* @package app\admin\controller
*/
class PriceQuery extends Base
{
//构造函数
public function __construct(){
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: userId, ApiAuth, Category, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With");
header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS,PATCH');
header('Access-Control-Allow-Credentials:true');
exit;
}
parent::__construct();
}
/**
* @api {get} admin/price-query 价格查询列表
*/
public function index() {
$data = $this->request->get();
$map = [];
if (isset($data['property_full_name']) && !empty($data['property_full_name'])){
$map[] = ['a.property_full_name', 'like', '%'.$data['property_full_name'].'%'];
} else {
$map[] = ['a.create_time', '>=', date('Y-m-d',strtotime("-90 day"))." 00:00:00"];
$map[] = ['a.create_time', '<=', date('Y-m-d')." 23:59:59"];
}
//2020年5月24日14:03:28 cavan
if(empty($this->userInfo)){
return $this->buildFailed("获取价格查询列表失败,因用户信息为空,请重新登录","",ReturnCode::AUTH_ERROR);
}
//权限
if (!in_array("ROLE_ADMIN", $this->userInfo['roleCode'])) {
$user_ids = array($this->userInfo['user_id']); //$this->userInfo['user_ids'] ? implode(',', $this->userInfo['user_ids']) : '';
if($user_ids){
$map[] = ['i.user_id', 'in', $user_ids];
}
}
$map[] = ['i.status', 'in', '2,3,4,5,6,7,8'];
isset($data['city_id']) && $data['city_id'] && $map[] = ['a.city_id', '=', $data['city_id']]; //城市
isset($data['area_id']) && $data['city_id'] && $map[] = ['d.area_id', '=', $data['area_id']]; //城区
$estate = new EstateModel();
$res = $estate->getPriceQueryList($map, $this->getPage());
return $this->buildSuccess($res);
}
}