SmsSend.php 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\common\service;
  3. use app\common\library\Sms;
  4. class SmsSend{
  5. protected $mobile;
  6. protected $code;
  7. protected $event;
  8. /**
  9. * @param mixed $mobile
  10. */
  11. public static function setMobile($mobile)
  12. {
  13. $clss=new self;
  14. $clss->mobile = $mobile;
  15. return $clss;
  16. }
  17. /**
  18. * @param mixed $code
  19. */
  20. public function setCode($code)
  21. {
  22. $this->code = $code;
  23. return $this;
  24. }
  25. /**
  26. * @param mixed $event
  27. */
  28. public function setEvent($event)
  29. {
  30. $this->event = $event;
  31. return $this;
  32. }
  33. public function check(){
  34. $config=config('site.system_sms_open');
  35. if(!$config){
  36. return;
  37. }
  38. if(!Sms::check($this->mobile,$this->code,$this->event)){
  39. throw_user('验证码错误');
  40. }
  41. }
  42. }