正在显示
3 个修改的文件
包含
41 行增加
和
1 行删除
| @@ -310,4 +310,25 @@ class QuanqiusouApi | @@ -310,4 +310,25 @@ class QuanqiusouApi | ||
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | + /** | ||
| 314 | + * 获取代理信息 | ||
| 315 | + * @param $domain | ||
| 316 | + * @return array|mixed | ||
| 317 | + * @author zbj | ||
| 318 | + * @date 2024/10/26 | ||
| 319 | + */ | ||
| 320 | + public function getV5RemainDay($domain){ | ||
| 321 | + $token = md5($domain.'qqs'); | ||
| 322 | + try { | ||
| 323 | + $client = new \GuzzleHttp\Client(); | ||
| 324 | + $res = $client->request('GET', 'https://quanqiusou.cn/extend_api/api/get_remain_day_by_domain.php?'.http_build_query(['token' => $token]), [ | ||
| 325 | + 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 | ||
| 326 | + ])->getBody()->getContents(); | ||
| 327 | + return Arr::s2a($res); | ||
| 328 | + } catch (\Exception | GuzzleException $e) { | ||
| 329 | + errorLog('获取代理失败', [$domain], $e); | ||
| 330 | + return []; | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + | ||
| 313 | } | 334 | } |
| @@ -400,7 +400,8 @@ class AdsController extends BaseController | @@ -400,7 +400,8 @@ class AdsController extends BaseController | ||
| 400 | }else{ | 400 | }else{ |
| 401 | $item['project_id'] = 0; | 401 | $item['project_id'] = 0; |
| 402 | } | 402 | } |
| 403 | - | 403 | + //获取剩余天数 |
| 404 | + $item['remaining_days'] = ReInquiryCount::getRemainingDays($item['domain'], $item['type'], $item['project_id']); | ||
| 404 | } | 405 | } |
| 405 | 406 | ||
| 406 | return $this->response('success', Code::SUCCESS, $result); | 407 | return $this->response('success', Code::SUCCESS, $result); |
| @@ -103,4 +103,22 @@ class ReInquiryCount extends Base | @@ -103,4 +103,22 @@ class ReInquiryCount extends Base | ||
| 103 | } | 103 | } |
| 104 | return $res; | 104 | return $res; |
| 105 | } | 105 | } |
| 106 | + | ||
| 107 | + public static function getRemainingDays($domain, $type, $project_id) | ||
| 108 | + { | ||
| 109 | + $cache_key = 're_inquiry_count_' . $domain . '_' . date('Ymd'); | ||
| 110 | + $data = Cache::get($cache_key); | ||
| 111 | + if($data === null){ | ||
| 112 | + if($project_id){ | ||
| 113 | + $data = Project::where('id', $project_id)->value('remain_day'); | ||
| 114 | + }else if($type == 3){ | ||
| 115 | + $data = '-'; | ||
| 116 | + }else{ | ||
| 117 | + $res = (new QuanqiusouApi())->getV5RemainDay($domain); | ||
| 118 | + $data = $res['data']['remain_day'] ??'-'; | ||
| 119 | + } | ||
| 120 | + Cache::put($cache_key, $data, 24 * 3600); | ||
| 121 | + } | ||
| 122 | + return $data; | ||
| 123 | + } | ||
| 106 | } | 124 | } |
-
请 注册 或 登录 后发表评论