1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Services\Common;
- use Illuminate\Support\Facades\Cache;
- class TencentCaptchaService{
- private $appId = 'kJuJadQt';
- private $appKey = 'QPk34Fzi';
- private $AppSecretKey = '5wWzxbiTgcREfZVMAj3m1PoZC';
- private $CaptchaAppId = '196587903';
- protected $client;
- public function __construct()
- {
- $this->client = new CurlService();
- }
- public function check($RendStr, $Ticket, $ip)
- {
- if (empty($RendStr) || empty($Ticket) || empty($ip)) {
- return false;
- }
- $data= [
- 'appId' => $this->appId,
- 'appKey' => $this->appKey,
- 'AppSecretKey' => $this->AppSecretKey,
- 'CaptchaAppId' => $this->CaptchaAppId,
- 'RendStr' => $RendStr,
- 'Ticket' => $Ticket,
- 'IP' => $ip
- ];
- $res = $this->client->post("https://api.253.com/open/txyzm/yzm-v2",$data);
- if($res->code == '200000' && $res->data['CaptchaMsg'] == "OK"){
- return true;
- }else{
- return false;
- }
- }
- }
|