GeoService.php
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* @remark :
* @name :GeoService.php
* @author :lyh
* @method :post
* @time :2025/7/3 14:21
*/
namespace App\Services\Geo;
class GeoService
{
public $api_key = 'UkzZljFv83Z2qBi5YR1o3f2otAVWtug6';
public $api_url = 'https://api.cmer.com/';
/**
* 获取AI平台数据
* @param $content
* @param $platform
* @return mixed|string
*/
public function getAiPlatformResult($content,$platform)
{
$url = $this->api_url . 'v1/websearch_chat';
$header = [
'accept: application/json',
'X-CmerApi-Host: llm-chat.p.cmer.com',
'apikey: '.$this->api_key,
'Content-Type: application/json'
];
$message = [
'messages'=>[
[
'content'=>$content,
'role'=>'user'
],
],
'platform' => $platform,
'security_check' => true
];
$data = http_post($url,json_encode($message,true),$header);
return $data;
}
/**
* 获取Google数据
* @param $search
* @param int $lum_json 默认1 不只是什么参数
* @return mixed|string
*/
public function getGooglePlatformResult($search)
{
$url = 'https://api.cmer.com/ai-overviews';
$header = [
'accept: application/json',
'apikey: UkzZljFv83Z2qBi5YR1o3f2otAVWtug6',
'Content-Type: application/json',
'X-CmerApi-Host:ai-overviews.p.cmer.com'
];
$param = [
'q' => $search,
'location' => 'New York, United States',
'gl' => 'us',
'hl'=>'en'
];
$url = $url . '?' . http_build_query($param);
return http_get($url, $header);
}
/**
* @remark :请求deepSeek数据
* @name :getDeepSeek
* @author :lyh
* @method :post
* @time :2025/7/15 10:59
*/
public function getDeepSeekResult($content,$model = 'deepseek-r1'){
$url = $this->api_url . 'v1/chat';
$header = [
'accept: application/json',
'X-CmerApi-Host: llm-chat.p.cmer.com',
'apikey: '.$this->api_key,
'Content-Type: application/json'
];
$message = [
'messages'=>[
[
'content'=>$content,
'role'=>'user'
],
],
'model' => $model,
"supplier"=> "bailian",
'security_check' => true
];
$data = http_post($url,json_encode($message,true),$header);
return $data;
}
}