Commit b0b96f66 authored by hujun's avatar hujun

商铺数据转移

parent 9066ead9
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/4/3
* Time: 9:54
*/
namespace app\api\controller;
use app\model\GHouses;
use app\model\GHousesExt;
use app\model\HouseInfos;
use think\Controller;
class TransferHouseInfo extends Controller
{
/**
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function table() {
$house_info = new HouseInfos();
$g_house_info = new GHouses();
$g_house_info_ext = new GHousesExt();
$num = $house_info->count();
for ($i = 1; $i <= $num; $i++) {
$house_info_data = $house_info->alias('a')
->join('houseInfo_exts b', 'a.id=b.house_id','left')
->where('a.id',$i)
->find();
if (empty($house_info_data)) {
continue;
}
$g_house_data['id'] = $house_info_data['id'];
$g_house_data['internal_title'] = $house_info_data['title'];
$g_house_data['external_title'] = $house_info_data['foreign_name'];
$g_house_data['internal_address'] = $house_info_data['address'];
$g_house_data['external_address'] = $house_info_data['address_detail_c'];
$g_house_data['province'] = $house_info_data['province'];
$g_house_data['city'] = $house_info_data['city'];
$g_house_data['disc'] = $house_info_data['disc'];
// business_district_id
$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_end'] = $house_info_data['room_area2'];
$g_house_data['rent_type'] = $house_info_data['rent_type'];
$g_house_data['rent_price'] = $house_info_data['price'];
$g_house_data['industry_type'] = $house_info_data['yetai'];
$g_house_data['case_manager_phone'] = $house_info_data['title'];
//状态 0待审批 1上架 2下架 3回收
if ($g_house_data['room_num_left'] == 0) {
$g_house_data['status'] = 2;
} else {
$g_house_data['status'] = 1;
}
$g_house_data['home_page_sort'] = $house_info_data['home_page_sort'];
$g_house_data['shop_type'] = $house_info_data['shangpu_type'];
$g_house_data['shop_sign'] = $house_info_data['shangpu_tags'];
$g_house_data['management_fee'] = $house_info_data['management_fee']*100;
//商铺类型(0商场,1街铺)
if ($g_house_data['shop_type'] == 1) {
$g_house_data['slotting_fee'] = $house_info_data['slotting_fee']*100;
} else {
$g_house_data['slotting_fee'] = $house_info_data['transfer_fee']*100;
}
$g_house_data['residue_num'] = $house_info_data['room_num_left'];
$g_house_data['total'] = $house_info_data['room_num_total'];
$g_house_data['longitude'] = $house_info_data['longitude'];
$g_house_data['latitude'] = $house_info_data['latitude'];
$g_house_data['is_show'] = $house_info_data['show_all'];
$g_house_data['is_can_records'] = $house_info_data['iscanreport'];
$g_house_data['is_has_gas'] = $house_info_data['has_gas'];
$g_house_data['is_carefully_chosen'] = $house_info_data['carefully_chosen'];
//是否独家0否1是
$g_house_data['is_exclusive_type'] = $house_info_data['exclusive_type'];
$g_house_data['upload_id'] = $house_info_data['admin_id'];
$g_house_data['operation_id'] = $house_info_data['title'];
$g_house_data['file_path'] = $house_info_data['file_path'];
$g_house_data['landmark'] = $house_info_data['landmark'];
$g_house_data['create_time'] = $house_info_data['created'];
$g_house_data['update_time'] = $house_info_data['modified'];
$g_house_info->insert($g_house_data);
$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['internal_item_advantage'] = $house_info_data['id'];
$g_house_data_ext['external_item_advantage'] = $house_info_data['foreign_advantage'];
$g_house_data_ext['tiny_brochure_url'] = $house_info_data['id'];
$g_house_data_ext['auditorium'] = $house_info_data['auditorium'];
$g_house_data_ext['traffic'] = $house_info_data['traffic'];
$g_house_data_ext['agent_start_time'] = $house_info_data['exclusive_start'];
$g_house_data_ext['agent_end_time'] = $house_info_data['exclusive_end'];
$g_house_data_ext['enter_num'] = $house_info_data['enter_num'];
$g_house_data_ext['do_business_date'] = $house_info_data['business_date'];
$g_house_data_ext['start_business_date'] = $house_info_data['start_business_date'];
$g_house_data_ext['opening_date'] = $house_info_data['id'];
$g_house_data_ext['sign_rule'] = $house_info_data['singn_rule'];
$g_house_data_ext['landlord_phone'] = $house_info_data['landlord_phone'];
$g_house_data_ext['create_time'] = $house_info_data['created'];
$g_house_data_ext['update_time'] = $house_info_data['modified'];
$g_house_info_ext->insert($g_house_data_ext);
}
}
}
\ 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