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

61 lines
1.9 KiB
PHP

<?php
namespace app\api\controller;
use think\Db;
class BizInquiry extends Base
{
/**
* @api {post} api/BizInquiry/search 业务系统估价查询接口
*/
public function search()
{
$building_name = request()->param('building_name');
$start_time = request()->param('start_time'); //时间戳
$end_time = request()->param('end_time'); //时间戳
if (empty($building_name)) {
return $this->buildFailed('缺少物业名称');
}
$map = [];
$data = [];
// foreach ($building_name as $key=>$value) {
// unset($map);
// if (!empty($start_time)) {
// $map[] = ['create_time', '>', $start_time];
// }
// if (!empty($end_time)) {
// $map[] = ['create_time', '<', $end_time];
// }
// $map[] = ['property_name', 'like', $value.'%'];
// $eva_unit_price = $this->getSearch($map);
// $data[] = ['building_name'=>$value, 'eva_unit_price'=>$eva_unit_price];
// }
if (!empty($start_time)) {
$map[] = ['create_time', '>', $start_time];
}
if (!empty($end_time)) {
$map[] = ['create_time', '<', $end_time];
}
$map[] = ['property_name', 'like', $building_name.'%'];
$eva_unit_price = $this->getSearch($map);
$data[] = ['building_name'=>$building_name, 'eva_unit_price'=>$eva_unit_price];
return $this->buildSuccess(['estate_list'=>$data]);
}
public function getSearch($where)
{
$eva_unit_price = Db::name('return_price')
->where($where)
->order('create_time', 'desc')
->field('eva_unit_price')
->find();
if ($eva_unit_price) {
return $eva_unit_price['eva_unit_price'];
} else {
return 0;
}
}
}