view->fetch(); } public function odm(){ return $this->view->fetch(); } public function special(){ return $this->view->fetch(); } public function job(){ return $this->view->fetch(); } public function privacy(){ return $this->view->fetch(); } public function policy(){ return $this->view->fetch(); } public function culture(){ return $this->view->fetch(); } public function decennial(){ return $this->view->fetch(); } public function Contact(){ return $this->view->fetch(); } public function submission(){ return $this->view->fetch(); } public function fq(){ $where = ['stat' => 0]; $where['country_code'] = $this->country_code; $order = [ 'sort' => 'asc', 'id' => 'desc' ]; $fq_list = model('fq')->getList($where, $order, null, 6); $data['fq_list'] = $fq_list; //echo "
=="; print_r($data); die;
        $this->assign($data);
			
			
            return $this->view->fetch();
        }
     public function honor(){
			
            return $this->view->fetch();
        }
     public function industry(){
			
            return $this->view->fetch();
        }
     public function weare(){
			
            return $this->view->fetch();
        }
     public function wewill(){
			
            return $this->view->fetch();
        }	
     public function vision(){
			
            return $this->view->fetch();
        }	
    public function achievement(){
			
          return $this->view->fetch();
      }	
      public function rdcenter(){
			
            return $this->view->fetch();
        }	
     public function search(){
			
            return $this->view->fetch();
        }
     public function transparent(){
			
            return $this->view->fetch(); 
}	
     public function distributor(){
			
            return $this->view->fetch(); 
    }	
     public function introduction(){
			
            return $this->view->fetch(); 
    }	
     public function business(){
			
            return $this->view->fetch(); 
    }	
     public function brand(){
			
            return $this->view->fetch();
    }
     public function product(){
			
            return $this->view->fetch(); 
    }	
	 public function headset(){
			
            return $this->view->fetch(); 
}
	 public function socket(){
			
            return $this->view->fetch(); 
}	
	 public function charger(){
			
            return $this->view->fetch(); 
}	
	 public function fan(){
			
            return $this->view->fetch(); 
}
	 public function ufo(){
			
            return $this->view->fetch(); 
}	
     public function faq(){
            
            return $this->view->fetch(); 
}   
	 public function pssd(){
            
            return $this->view->fetch(); 
}   
     public function h_speed(){
            
            return $this->view->fetch(); 
} 
     public function ssd(){
            
            return $this->view->fetch(); 
} 
     public function thunderbolt_3(){
            
            return $this->view->fetch(); 
} 
	public function stripe(){
			
           return $this->view->fetch(); 
}	
	public function series_95(){
			
           return $this->view->fetch(); 
}
public function backup(){
			
           return $this->view->fetch(); 
}
    public function series_35(){
            
           return $this->view->fetch(); 
}   		
	public function download(){
            $keywords_pa = $this->request->param();
            $keywords = '';
            $map['stat'] = 0;
            $map['cid'] = 44;
            if ( !empty($keywords_pa['keywords']) ) {
                $keywords = $keywords_pa['keywords'];
                $map['name|app_model'] = array('like',"%$keywords%");
            }
            $downloads = model('download')->where($map)->select();
            $this->assign('downloads',$downloads);
            $this->assign('keywords',$keywords);

           return $this->view->fetch(); 
}		
	public function report()
    {
       /* if ($this->customer_id <= 0)
            $this->redirect('/login.html');*/
        return $this->view->fetch();
    }

    public function create_report()
    {
        if ($this->customer_id <= 0)
            return $this->json(-100, 'Please log on first');

        $data = $this->request->post();
        if (empty($data) || !is_array($data))
            return $this->json(-1, 'Data error ');

        if ($data['product_name'] == '')
            return $this->json(-2, 'Product name cannot be empty');
        if ($data['product_model'] == '')
            return $this->json(-3, 'Product model cannot be empty');
        if ($data['product_manufacturer'] == '')
            return $this->json(-4, 'Manufacturer name cannot be empty');
        // if ($data['buy_source'] == '')
        //     return $this->json(-5, '购买渠道不能为空');

        if ($data['customer_telephone'] != '' && !preg_match("/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/", $data['customer_telephone']))
            return $this->json(-6, 'Phone format error ');
        if ($data['customer_email'] != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $data['customer_email']))
            return $this->json(-7, 'Email Address format error');

        $insert_data = [
            'customer_id'           => $this->customer_id,
            'product_name'          => $data['product_name'],
            'product_model'         => $data['product_model'],
            'product_manufacturer'  => $data['product_manufacturer'],
            'buy_source'            => $data['buy_source'],
            'product_price'         => floatval($data['product_price']),
            'customer_name'         => $data['customer_name'],
            'customer_email'        => $data['customer_email'],
            'customer_telephone'    => $data['customer_telephone'],
            'description'           => $data['description'],
            'create_time'           => time(),
        ];

        $result = model('report')->insert($insert_data);
        if (!$result)
            return $this->json(-8, 'Failure to submit');

        return $this->json(200, 'ok');
    }

	
   
    public function create()
    {

        $data = $this->request->post();
        if (empty($data) || !is_array($data))
            return $this->json(403, 'Data error ');

        if ($data['company'] == '')
            return $this->json(403-2, 'Company name cannot be empty');
        if ($data['name'] == '' && $data['last_name'])
            return $this->json(403-3, 'Your name cannot be empty');
        if ($data['email'] == '')
            return $this->json(403-4, 'Email cannot be empty');
        if ($data['country'] == '')
            return $this->json(403-5, 'Distribution region cannot be empty');
        // if ($data['buy_source'] == '')
        //     return $this->json(-5, '购买渠道不能为空');

        /*if ($data['customer_telephone'] != '' && !preg_match("/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/", $data['customer_telephone']))
            return $this->json(-6, 'Phone format error ');*/
        if ($data['email'] != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $data['email']))
            return $this->json(403-6, 'Email Address format error');
        
        $referer =  isset($data['refer']) ? $data['refer'] : 'https://www.baidu.com?wd=9558s';
        $url =  isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
          
        $searchFeed =  getKeywords($referer);
        $channel = isset($searchFeed['channel']) ? $searchFeed['channel'] : '';
        $keyword = isset($searchFeed['search']) ? $searchFeed['search'] : '';

        $fed = visitLog();

        $insert_data = [
            'company'       => $data['company'],
            'uri'               => $data['uri'],
            'name'              => $data['name'],
            'last_name'         => $data['last_name'],
            'email'             => $data['email'],
            'phone'             => trim($data['phone']),
            'country'           => $data['country'],
            'interest'          => $data['interested'],
            'is_inventory'      => $data['is_inventory'],
            'createtime'       => date("Y-m-d H:i:s"),
            'siteid'       => $this->siteid,
            'country_code'       => $this->country_code,
            
            'refer'       => $referer,
            'url'       => $url,
            'channel'       => $channel,
            'keyword'       => $keyword,
            'ip'       => $fed['ip'],
            'state'       => $fed['country'],
            'province'       => $fed['province'],
            'city'       => $fed['city'],
            'drvice'       => $fed['drive'],
            'user_agent'       => $fed['system']." ".$fed['brower'],
        ];

        $result = model('agents')->insert($insert_data);
        if (!$result)
            return $this->json(201, 'Failure to submit');

        return $this->json(200, 'ok');
    }
 	
	
	
}