| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | 
							- <?php
 
- namespace App\Http\Controllers\Mobile\Auth;
 
- use App\Http\Controllers\Mobile\MobileBaseController;
 
- use App\Services\Auth\AuthService;
 
- use App\Services\Common\EmailService;
 
- use App\Services\Common\TaskService;
 
- use App\Services\Company\CompanyService;
 
- use App\Services\Person\MemberInfoService;
 
- class EmailController extends MobileBaseController
 
- {
 
-     /**
 
-      * @var EmailService
 
-      */
 
-     protected $emailService;
 
-     /**
 
-      * @var CompanyService
 
-      */
 
-     private $companyService;
 
-     private $memberInfoService;
 
-     /**
 
-      * @var AuthService
 
-      */
 
-     private $authService;
 
-     private $taskService;
 
-     /**
 
-      * EmailController constructor.
 
-      * @param EmailService $emailService
 
-      * @param CompanyService $companyService
 
-      * @param MemberInfoService $memberInfoService
 
-      * @param AuthService $authService
 
-      * @param TaskService $taskService
 
-      */
 
-     public function __construct(EmailService $emailService, TaskService $taskService, CompanyService $companyService, MemberInfoService $memberInfoService, AuthService $authService)
 
-     {
 
-         $this->emailService = $emailService;
 
-         $this->companyService = $companyService;
 
-         $this->memberInfoService = $memberInfoService;
 
-         $this->authService = $authService;
 
-         $this->taskService = $taskService;
 
-     }
 
-     public function checkEmail($token, $tag = 'none')
 
-     {
 
-         $message = $this->emailService->checkAuthEmail($token);
 
-         if (is_null($message)) {
 
-             //  return "地址已失效";//token不对
 
-             return $this->showMessage("地址已失效", route('mobile.home'), true, "首页");
 
-         }
 
-         //token验证是对的
 
-         if ($message['alias']==EmailService::TEMPLATE_VALIDATION) {
 
-             //验证邮箱逻辑
 
-             if ($tag == 'company') {
 
-                 if ($this->companyService->verifyEmail($message['email'])) {
 
-                     $this->taskService->doTask(23);
 
-                     return $this->showMessage("邮箱认证成功!", route('mobile.home'), false, "首页");
 
-                 }
 
-             }
 
-             if ($tag == 'personal') {
 
-                 if ($this->memberInfoService->verifyEmail($message['email'])) {
 
-                     return $this->showMessage("邮箱认证成功!", route('mobile.home'), false, "首页");
 
-                 }
 
-             }
 
-         }
 
-         if ($message['alias']==EmailService::TEMPLATE_PASSWORD_RESET) {
 
-             //重置密码逻辑
 
-             $token=$this->authService->getTokenByEmail($message['email']);
 
-             return view('mobile.app.auth.password_reset', ['token'=>$token]);
 
-         }
 
-         return $this->showMessage("地址已失效", route('mobile.home'), true, "首页");
 
-     }
 
- }
 
 
  |