Commit 6e3c3b78 authored by hujun's avatar hujun

商铺数据转移

parent 838d7064
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace app\api\controller; namespace app\api\controller;
use app\model\Regions;
use think\Controller; use think\Controller;
use think\Db; use think\Db;
...@@ -20,7 +21,7 @@ class TransferHouseInfo extends Controller ...@@ -20,7 +21,7 @@ class TransferHouseInfo extends Controller
*/ */
public function table() { public function table() {
$num = Db::table('houseinfos')->order('id desc')->value('id'); $num = Db::table('houseinfos')->order('id desc')->value('id');
$regions = new Regions();
for ($i = 1; $i <= $num; $i++) { for ($i = 1; $i <= $num; $i++) {
$house_info_data = Db::table('houseinfos')->field('*') $house_info_data = Db::table('houseinfos')->field('*')
->where('id',$i) ->where('id',$i)
...@@ -38,10 +39,15 @@ class TransferHouseInfo extends Controller ...@@ -38,10 +39,15 @@ class TransferHouseInfo extends Controller
$g_house_data['external_title'] = $house_info_data_ext['foreign_name']; $g_house_data['external_title'] = $house_info_data_ext['foreign_name'];
$g_house_data['internal_address'] = $house_info_data['address']; $g_house_data['internal_address'] = $house_info_data['address'];
$g_house_data['external_address'] = $house_info_data_ext['address_detail_c']; $g_house_data['external_address'] = $house_info_data_ext['address_detail_c'];
$g_house_data['province'] = $house_info_data['province']; $g_house_data['province'] = '上海';
$g_house_data['city'] = $house_info_data['city']; $g_house_data['city'] = $house_info_data['city'];
$g_house_data['disc'] = $house_info_data['disc']; $g_house_data['disc'] = $house_info_data['disc'];
// business_district_id // business_district_id
if ($house_info_data['city'] != '') {
$code_arr = $regions->getRegionsCodeByName($g_house_data['province'], $g_house_data['city'], $g_house_data['disc']);
$g_house_data['code'] = implode('##', $code_arr);
}
$g_house_data['market_area'] = $house_info_data['business_area']; $g_house_data['market_area'] = $house_info_data['business_area'];
$g_house_data['shop_area_start'] = $house_info_data['room_area']; $g_house_data['shop_area_start'] = $house_info_data['room_area'];
$g_house_data['shop_area_end'] = $house_info_data['room_area2']; $g_house_data['shop_area_end'] = $house_info_data['room_area2'];
...@@ -88,7 +94,6 @@ class TransferHouseInfo extends Controller ...@@ -88,7 +94,6 @@ class TransferHouseInfo extends Controller
echo $i.'-'; echo $i.'-';
Db::table('g_houses')->insert($g_house_data); Db::table('g_houses')->insert($g_house_data);
$g_house_data_ext['house_id'] = $house_info_data['id']; $g_house_data_ext['house_id'] = $house_info_data['id'];
$g_house_data_ext['fee_rule'] = $house_info_data['fee_rule']; $g_house_data_ext['fee_rule'] = $house_info_data['fee_rule'];
$g_house_data_ext['internal_item_advantage'] = $house_info_data['sellingpoint']; $g_house_data_ext['internal_item_advantage'] = $house_info_data['sellingpoint'];
...@@ -113,7 +118,7 @@ class TransferHouseInfo extends Controller ...@@ -113,7 +118,7 @@ class TransferHouseInfo extends Controller
Db::table('g_houses_to_agents')->insert([ Db::table('g_houses_to_agents')->insert([
'houses_id' => $house_info_data['id'], 'houses_id' => $house_info_data['id'],
'agents_id' => $v, 'agents_id' => $v,
'type' => 1 'type' => 2
]); ]);
} }
} }
......
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