Commit c4eb5b9d authored by hujun's avatar hujun

转换房东手机号

parent 7a1b928a
......@@ -517,7 +517,8 @@ Route::group('task', [
'updateShopAddress' => ['task/JobTask/updateShopAddress', ['method' => 'get']], //默认图片
'updateShopAgeLimit' => ['task/JobTask/updateShopAgeLimit', ['method' => 'get']], //默认年限
'push' => ['task/PushMessageTask/push', ['method' => 'get']] //推送
'push' => ['task/PushMessageTask/push', ['method' => 'get']], //推送
'updateLandlordLimit' => ['task/JobTask/updateLandlordLimit', ['method' => 'get']] //转换房东手机号
]);
Route::group('broker', [
......
......@@ -6,6 +6,7 @@ use app\index\service\ImageDepotService;
use app\model\GHouses;
use app\model\GHousesExt;
use app\model\GImageDepot;
use app\model\GLandlordPhone;
use think\Image;
use think\Request;
......@@ -20,11 +21,13 @@ class JobTask
{
private $gHouseModel;
private $gHouseExtModel;
private $g_landlord_phone;
public function __construct()
{
$this->gHouseModel = new GHouses();
$this->gHouseExtModel = new GHousesExt();
$this->g_landlord_phone = new GLandlordPhone();
}
public function updateShopTask()
......@@ -154,4 +157,31 @@ class JobTask
}
}
}
//转换房东手机号
public function updateLandlordLimit() {
set_time_limit(0); // 取消脚本运行时间的超时上限
$field = "house_id,landlord_phone";
$params['landlord_phone'] = ['<>', ''];
$total = $this->gHouseExtModel->getTotal($params);
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$save_data = [];
$houseList = $this->gHouseExtModel->getList($pageNo, $pageSize, 'id asc',$field, $params);
foreach ($houseList as $key=>$item) {
$tmp_data = json_decode($item['landlord_phone'], true);
foreach ($tmp_data as $k=>$v) {
$data['house_id'] = $item['house_id'];
$data['name'] = $v['name'];
$data['phone'] = $v['phone'];
$save_data[] = $data;
}
}
$this->g_landlord_phone->insertData($save_data);
unset($save_data);
}
}
}
\ No newline at end of file
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