68 lines
2.0 KiB
PHP
Executable File
68 lines
2.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: ORICO
|
|
* Date: 2023-08-21
|
|
* Time: 17:36
|
|
*/
|
|
|
|
namespace app\us\controller;
|
|
|
|
|
|
class Track extends BaseController
|
|
{
|
|
|
|
|
|
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."<pre>=="; 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" =>$data['refer'],
|
|
"channel" => isset($keywords['channel']) ? $keywords['channel'] :'',
|
|
"channel_type" => isset($keywords['channel']) ?$keywords['channel'] :'',
|
|
"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),
|
|
|
|
);
|
|
//echo "<pre>=="; print_r($fds);die;
|
|
|
|
$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');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} |