TencentCaptchaService.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Services\Common;
  3. use Illuminate\Support\Facades\Cache;
  4. class TencentCaptchaService{
  5. private $appId = 'kJuJadQt';
  6. private $appKey = 'QPk34Fzi';
  7. private $AppSecretKey = '5wWzxbiTgcREfZVMAj3m1PoZC';
  8. private $CaptchaAppId = '196587903';
  9. protected $client;
  10. public function __construct()
  11. {
  12. $this->client = new CurlService();
  13. }
  14. public function check($RendStr, $Ticket, $ip)
  15. {
  16. return true;
  17. if (empty($RendStr) || empty($Ticket) || empty($ip)) {
  18. return false;
  19. }
  20. $data= [
  21. 'appId' => $this->appId,
  22. 'appKey' => $this->appKey,
  23. 'AppSecretKey' => $this->AppSecretKey,
  24. 'CaptchaAppId' => $this->CaptchaAppId,
  25. 'RendStr' => $RendStr,
  26. 'Ticket' => $Ticket,
  27. 'IP' => $ip
  28. ];
  29. $res = $this->client->post("https://api.253.com/open/txyzm/yzm-v2",$data);
  30. if($res->code == '200000'){
  31. return true;
  32. }else{
  33. return false;
  34. }
  35. }
  36. }