52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
|
<?php
|
|||
|
/**
|
|||
|
* @Created by PhpStorm.
|
|||
|
* @Author:Soar
|
|||
|
* @Time:2024/1/4 11:18
|
|||
|
*/
|
|||
|
|
|||
|
namespace app\api\controller;
|
|||
|
|
|||
|
use app\common\controller\Api;
|
|||
|
|
|||
|
class Ranking extends Api
|
|||
|
{
|
|||
|
protected $noNeedLogin = ['*'];
|
|||
|
protected $noNeedRight = ['*'];
|
|||
|
private $url = "http://118.89.120.104:14859/api/v1/certificate";
|
|||
|
|
|||
|
public function getCertificate()
|
|||
|
{
|
|||
|
$match_id = $this->request->param("match_id");
|
|||
|
$player_id = $this->request->param("player_id");
|
|||
|
$http_get = $this->btnGet($this->url . "?match_id={$match_id}&player_id={$player_id}");
|
|||
|
|
|||
|
return $http_get;
|
|||
|
}
|
|||
|
|
|||
|
public function btnGet($url)
|
|||
|
{
|
|||
|
# 初始化一个curl会话
|
|||
|
$ch = curl_init();
|
|||
|
|
|||
|
# 判断是否是https
|
|||
|
if (stripos($url, "https://") !== false) {
|
|||
|
# 禁用后cURL将终止从服务端进行验证
|
|||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|||
|
# 使用的SSL版本(2 或 3)
|
|||
|
curl_setopt($ch, CURLOPT_SSLVERSION, 1);
|
|||
|
}
|
|||
|
# 设置请求地址
|
|||
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|||
|
# 在启用CURLOPT_RETURNTRANSFER的时候,返回原生的(Raw)输出
|
|||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|||
|
|
|||
|
# 执行这个请求
|
|||
|
$output = curl_exec($ch);
|
|||
|
# 关闭这个请求
|
|||
|
curl_close($ch);
|
|||
|
return $output;
|
|||
|
}
|
|||
|
|
|||
|
}
|