Commit 0b2ed47c authored by clone's avatar clone

Merge branch '0529-v3.3.0' of https://gitee.com/zwyjjc/tl_estate into 0529-v3.3.0

parents 82038bf1 7943e33d
......@@ -123,7 +123,7 @@ class BatchProcessing extends Basic
$model = new OfficeGBuilding();
$house_service = new HouseService();
$field = 'id,title,address,city,longitude';
$field = 'id,title,address,city,disc,longitude';
$get_params[] = ['EXP', "`longitude` = '' or `longitude` is null "];
$model_res = $model->getBusinessDistrict($field, $get_params);
......@@ -131,14 +131,11 @@ class BatchProcessing extends Basic
$fail = 0;
foreach ($model_res as $key => $v) {
$id = $v['id'];
// $address = $v['city'].$v['disc'].$v['address'];
$address = $v['address'];
$city = $v['city'];
/*获取商圈经纬度*/
$res = $house_service->getLatLng($address, $city);
dump($address);
dump($city);
dump($res);
exit;
if($res){
$success_num ++;
......@@ -148,16 +145,16 @@ class BatchProcessing extends Basic
$fail ++;
$longitude = '';//'经度'
$latitude = '';//'维度'
$log_text = '商圈:'.$v['name'].' 城市: '.$v['city'].' 数据库ID: '.$id;
Log::write($log_text, '获取商圈经纬度-失败'); //记录日志
$log_text = '办公楼名:'.$v['name'].' 城市: '.$v['city'].' 数据库ID: '.$id;
big_log($log_text); //记录日志
}
$insert=[];
$insert["id"] = $id;
$insert["longitude"] = $longitude;
$insert["latitude"] = $latitude;
$res = $model->updateBusinessDistrict($insert);//int(1)
$log_text = '商圈:'.$v['name'].' 城市: '.$v['city'].' 经度: '.$longitude.' 纬度: '.$latitude.' 数据库写入返回值: '.$res;
Log::write($log_text, '获取商圈经纬度'); //记录日志
$log_text = '办公楼名:'.$v['title'].' 城市: '.$v['city'].' 纬度,经度: ['.$latitude.','.$longitude.'] 数据库写入返回值: '.$res;
big_log($log_text,'getBuildingLatAadLng'); //记录日志
}
return $this->response("200", "处理完成",['成功数'=>$success_num,'失败数'=>$fail]);
}
......
......@@ -11,6 +11,7 @@ namespace app\index\controller;
use app\index\extend\Basic;
use app\index\service\OfficeService;
use app\index\service\PositionService;
use think\Request;
class OfficeManage extends Basic
......@@ -156,4 +157,37 @@ class OfficeManage extends Basic
return $this->response($code, $msg, $data);
}
/**
* 获得两个经纬度距离
*
* @return \think\Response
*/
public function getDistance()
{
$code = 200;
$msg = "";
$data = [];
$address_latitude = $this->params['address_latitude'];
$address_longitude = $this->params['address_longitude'];
$stations_latitude = $this->params['stations_latitude'];
$stations_longitude = $this->params['stations_longitude'];
if (empty($address_latitude) || empty($address_longitude) || empty($stations_latitude) || empty($stations_longitude)) {
return $this->response(101, '参数错误');
}
$first_position = $address_latitude . ',' . $address_longitude;
$end_position = $stations_latitude . ',' . $stations_longitude;
$position_service = new PositionService();
$distance = $position_service->getPositionDistance($first_position, $end_position);
if ($distance) {
$data['distance'] = $distance;
} else {
$data['distance'] = 0;
$code = 101;
$msg = '获取距离失败';
}
return $this->response($code, $msg, $data);
}
}
\ No newline at end of file
......@@ -911,14 +911,13 @@ class OfficePayLog extends Basic
$bargain_where['id'] = $pay_data['bargain_id'];
$price = $this->m_bargain->getFieldValue('price', $bargain_where);
$pay_data['price'] = empty($price)? 0:$price;
$m_order = new OfficeOrderModel();
$house_data = $m_order->selectOrderByOrderId('b.id,c.address as internal_address,a.f_id', ['order_id'=>$pay_data['order_id']]);
$pay_data['house_id'] = empty($house_data[0]['id']) ? '':$house_data[0]['id'];
$pay_data['address'] = empty($house_data[0]['internal_address']) ? '':$house_data[0]['internal_address'];
}
$m_order = new OfficeOrderModel();
$house_data = $m_order->selectOrderByOrderId('b.id,c.address,a.f_id', ['order_id'=>$pay_data['order_id']]);
$pay_data['house_id'] = empty($house_data[0]['id']) ? '':$house_data[0]['id'];
$pay_data['address'] = empty($house_data[0]['address']) ? '':$house_data[0]['address'];
$m_pay_adjustment = new OfficeOPayLogAdjustment();
$source_id = $m_pay_adjustment->getFieldColumn('id', ['paylog_id'=> $pay_data['id']]);
$pay_data['source_id'] = empty($source_id) ? 0 : implode(',', $source_id);
......
......@@ -95,6 +95,7 @@ class Basic extends Controller
'index/dailyBackImg',
'office_index/getLabelsList',
'index/modifyAgentPassword',
'office_index/getDistance',
);
/**
......
......@@ -12,6 +12,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\VipService;
use app\chat\utils\CurlUtil;
use app\extra\RedisExt;
use app\index\validate\HouseValidate;
use app\model\AAgents;
......@@ -591,14 +592,15 @@ class HouseService
*/
function getLatLng($address='',$city='')
{
$result = array();
$ak = 'eqkGg4WQehHn4k7ssWZTv8RPvydUm35s';//百度地图ak,百度开发者中心去免费申请
$url ="http://api.map.baidu.com/geocoder/v2/?callback=renderOption&output=json&address=".$address."&city=".$city."&ak=".$ak;
$data = file_get_contents($url);
$data = str_replace('renderOption&&renderOption(', '', $data);
$result = array();
$curl = new CurlUtil();
$url = "http://api.map.baidu.com/geocoder/v2/?address={$address}&output=json&ak={$ak}&callback=json&city={$city}";
$data = $curl->get($url);
$data = str_replace('json&&json(', '', $data->body);
$data = str_replace(')', '', $data);
$data = json_decode($data,true);
// exit;
if (!empty($data) && $data['status'] == 0) {
$result['lat'] = $data['result']['location']['lat'];
$result['lng'] = $data['result']['location']['lng'];
......
......@@ -58,7 +58,7 @@ class OfficeOrderModel extends Model
->field($filed)
->alias("a")
->join("office_g_room b", "a.house_id = b.id", "left")
->join("office_g_building c", "c.id = b.building_id", "left")
->join("office_g_building c", "b.building_id = c.id", "left")
->where($where_)
->select();
//echo $this->db_->getLastSql();
......
......@@ -1057,6 +1057,7 @@ Route::group('office_index', [
'inspectionRecordStore/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 1]], //门店约带看
'inspectionRecordDistrict/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 2]], //部门约带看
'inspectionRecordAll/:check_status' => ['index/OfficeReport/inspectionRecordAll', ['method' => 'GET'], ['check_status' => 3]], //全部约带看
'getDistance' => ['index/OfficeManage/getDistance', ['method' => 'GET']], //获取两个经纬度距离
]);
Route::group('office_api', [
......
......@@ -1213,6 +1213,8 @@ define(['doT', 'css!style/shop_edit.css', 'ckfinder', 'ckfinderStart'], function
if(data.code == 200) {
if(data.data. is_alert == 1){
alert('该房源所在楼盘因信息不完整导致下架状态,请联系店长在后台楼盘列表补充楼盘信息!楼盘信息补充完整后,该房源会自动上架!');
location.replace('/admin.php/office_index/getRoomList');
}else{
alert('添加成功!');
location.replace('/admin.php/office_index/getRoomList');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment