| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | 
							- <?php
 
- namespace App\Http\Controllers\Web\Common;
 
- use Aix\Sms\Contracts\Smser;
 
- use App\Http\Controllers\Web\WebBaseController;
 
- use App\Services\Auth\AuthService;
 
- use App\Services\Common\GeetestService;
 
- use App\Services\Common\SmsService;
 
- use App\Validators\SmsValidatorRequest;
 
- class SmsController extends WebBaseController
 
- {
 
-     
 
-     protected $smsService;
 
-     
 
-     private $geetestService;
 
-     
 
-     private $authService;
 
-     
 
-     public function __construct(AuthService $authService, SmsService $smsService, GeetestService $geetestService)
 
-     {
 
-         $this->smsService = $smsService;
 
-         $this->geetestService = $geetestService;
 
-         $this->authService = $authService;
 
-     }
 
-     public function sendSms(SmsValidatorRequest $smsValidatorRequest)
 
-     {
 
-         $method=$smsValidatorRequest->type.'Sms';
 
-         $result=$this->$method($smsValidatorRequest->mobile);
 
-         return $result;
 
-     }
 
-     protected function loginSms($mobile)
 
-     {
 
-         if (!$this->authService->checkUser($mobile, "", 2)) {
 
-             return $this->sendErrorResponse("该手机号码没有绑定账号,请先注册");
 
-         }
 
-         $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_LOGIN);
 
-         return $this->sendSuccessResponse();
 
-     }
 
-     protected function registerSms($mobile)
 
-     {
 
-         $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_REGISTER);
 
-         return $this->sendSuccessResponse();
 
-     }
 
-     protected function checkSms($mobile)
 
-     {
 
-         $this->smsService->sendAuthSms($mobile, Smser::TEMPLATE_AUTH_CHECK);
 
-         return $this->sendSuccessResponse();
 
-     }
 
- }
 
 
  |