get(); $useragent = $_SERVER['HTTP_USER_AGENT']; $ip = get_ip(); $address = GetIpLookup($ip); //echo $ip."
=="; print_r($address);die;
        $url = getpageurl();
        $keywords =getKeywords($url); 
        
        $curUrl = parse_url($url);
        $host = $curUrl['host'];
    
        $feed = array(
            "items" => 'ORICO Official',
            "forum" => $controller,
            "forum_code" => $controller,
            "url" => $url,
            "refer" => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $url,
            "channel" => isset($keywords['channel']) ? $keywords['channel'] : $host,
            "channel_type" => isset($keywords['channel']) ?$keywords['channel'] :'1',
            "keyword" => isset($keywords['search']) ?$keywords['search'] :'',
            "start_time" => date("y-m-d H:i:s"),
            "ip" => $ip,
            "country" => isset($address['country']) ? $address['country'] :'',
            "province" =>  isset($address['province']) ? $address['province'] :'',
            "city" => isset($address['city']) ? $address['city'] :'',
            "drive" => isMobile() ? "H5": "PC",
            "system" => getOs($useragent),
            "brower" => getBroswer($useragent),

            "uuid" =>  $data['uuid'],
            "end_time" => date("y-m-d H:i:s"),
            "elapsed_time" => $data['dt'],
          
        );
    

        $feed = http_build_query($feed);
        $result = CurlRequest('https://producer.datamaster.cc/api/v1/browser_logs/send', $feed);
        $res = json_decode($result, true);
         return $this->json(200, 'ok');

    }

    public function records()
    {

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


        $useragent = $data['user_agent'];
        $ip = get_ip();
        $address = GetIpLookup($ip);
        //echo $ip."
=="; print_r($address);die;
        $url = $data['url'];
        $keywords =getKeywords($url); 
        
        $arr_url = parse_url($url);
        $content = pregReplaceImg($data['content'],'https://'.$arr_url['host']);
          
        $fds = array(
            "items" => 'ORICO Official',
            "forum" => $data['forum'],
            "forum_code" => $data['forum'],
            "url" => $data['url'],
            "refer" =>isset($data['refer']) ? $data['refer'] : $arr_url['host'],
            "channel" => isset($keywords['channel']) ? $keywords['channel'] : $arr_url['host'],
            "channel_type" => isset($keywords['channel']) ?$keywords['channel'] :'1',
            "keyword" => isset($keywords['search']) ?$keywords['search'] :'',
            "start_time" => date("y-m-d H:i:s"),
            "ip" => $ip,
            "country" => isset($address['country']) ? $address['country'] :'',
            "province" =>  isset($address['province']) ? $address['province'] :'',
            "city" => isset($address['city']) ? $address['city'] :'',
            "content" => $content,
            "drive" => $data['drive'],
            "event_type" => $data['event_type'],
            "system" => getOs($useragent),
            "brower" => getBroswer($useragent),
          
        );
        
    
        $feeds = http_build_query($fds);
        $result = CurlRequest('https://producer.datamaster.cc/api/v1/action_logs/send', $feeds);
        $res = json_decode($result, true);
        return $this->json(200, 'ok');
        
        
    }



}