GeoService.php 2.6 KB
<?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;
    }
}