Update AuthService.php

This commit is contained in:
全栈小学生 2023-07-11 10:11:15 +08:00
parent 079693238f
commit f95d27974c

View File

@ -16,7 +16,9 @@ use app\model\member\Member;
use app\Request; use app\Request;
use app\service\api\member\MemberService; use app\service\api\member\MemberService;
use app\service\core\site\CoreSiteService; use app\service\core\site\CoreSiteService;
use app\service\core\weapp\CoreWeappAuthService;
use core\base\BaseApiService; use core\base\BaseApiService;
use core\exception\ApiException;
use core\exception\AuthException; use core\exception\AuthException;
/** /**
@ -54,16 +56,18 @@ class AuthService extends BaseApiService
$site_info = (new CoreSiteService())->getSiteCache($site_id); $site_info = (new CoreSiteService())->getSiteCache($site_id);
if(empty($site_info)) throw new AuthException('SITE_NOT_EXIST'); if(empty($site_info)) throw new AuthException('SITE_NOT_EXIST');
if($site_info['status'] == SiteDict::CLOSE){ if($site_info['status'] == SiteDict::CLOSE){
$rule = trim(strtolower($request->rule()->getRule())); $rule = strtolower(trim($request->rule()->getRule()));
if($rule != 'site') throw new AuthException('SITE_CLOSE_NOT_ALLOW'); if($rule != 'site') throw new AuthException('SITE_CLOSE_NOT_ALLOW');
} }
$request->siteId($site_id); $request->siteId($site_id);
return true; return true;
} }
/** /**
* 绑定手机号 * 绑定手机号
* @param string $mobile * @param string $mobile
* @return void * @param string $mobile_code
* @return true
*/ */
public function bindMobile(string $mobile, string $mobile_code){ public function bindMobile(string $mobile, string $mobile_code){