|
@@ -40,10 +40,42 @@ class Subscribe extends Base
|
|
|
public function goods_info()
|
|
|
{
|
|
|
$url = input('url');
|
|
|
- $import_path = $_SERVER['DOCUMENT_ROOT'].'/upload/excel/template.xlsx';
|
|
|
+ if(empty($url)){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $file_name = explode('/',$url);
|
|
|
+ $import_path = $_SERVER['DOCUMENT_ROOT'].'/upload/excel/'.$file_name;
|
|
|
$objReader =\PHPExcel_IOFactory::createReader('Excel2007');
|
|
|
$objExcel = $objReader->load($import_path);
|
|
|
$list = $objExcel->getActiveSheet()->toArray();
|
|
|
+ if(empty($list)){
|
|
|
+ $this->error('暂无数据');
|
|
|
+ }
|
|
|
+ foreach ($list as $k=>$v){
|
|
|
+ if($k > 0 && $v[0]){
|
|
|
+ $array = array();
|
|
|
+ $array['name'] = $v[0];
|
|
|
+ $array['record_name'] = $v[1];
|
|
|
+ $array['avg_price'] = $v[2];
|
|
|
+ $array['fitment_state'] = $v[3];
|
|
|
+ $array['trait'] = $v[4].'、';
|
|
|
+ $array['sale_state'] = $v[5];
|
|
|
+ $array['floor_area'] = $v[6];
|
|
|
+ $array['covered_area'] = $v[7];
|
|
|
+ $array['property_class'] = $v[8].'、';
|
|
|
+ $array['property_deadline'] = $v[9];
|
|
|
+ $array['plot_ratio'] = $v[10];
|
|
|
+ $array['greening_rate'] = $v[11];
|
|
|
+ $array['tower_num'] = $v[12];
|
|
|
+ $array['resident_num'] = $v[13];
|
|
|
+ $array['floor_case'] = $v[14];
|
|
|
+ $array['floor_height'] = $v[15];
|
|
|
+ $array['stall_num'] = $v[16];
|
|
|
+ $array['stall_ratio'] = $v[17];
|
|
|
+ Db::name('store_property')->insert($array);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var_dump($list);exit();
|
|
|
$this->success('获取成功',$url);
|
|
|
}
|