first commit
This commit is contained in:
60
pgserver/application/api/controller/BizInquiry.php
Normal file
60
pgserver/application/api/controller/BizInquiry.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user