|
@@ -11,6 +11,7 @@
|
|
namespace Luolongfei\App\Console;
|
|
namespace Luolongfei\App\Console;
|
|
|
|
|
|
use Luolongfei\App\Exceptions\LlfException;
|
|
use Luolongfei\App\Exceptions\LlfException;
|
|
|
|
+use Luolongfei\App\Exceptions\WarningException;
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Cookie\CookieJar;
|
|
use GuzzleHttp\Cookie\CookieJar;
|
|
use Luolongfei\Libs\Log;
|
|
use Luolongfei\Libs\Log;
|
|
@@ -40,6 +41,9 @@ class FreeNom extends Base
|
|
// 匹配登录状态的正则
|
|
// 匹配登录状态的正则
|
|
const LOGIN_STATUS_REGEX = '/<li.*?Logout.*?<\/li>/i';
|
|
const LOGIN_STATUS_REGEX = '/<li.*?Logout.*?<\/li>/i';
|
|
|
|
|
|
|
|
+ // 匹配无域名的正则
|
|
|
|
+ const NO_DOMAIN_REGEX = '/<tr\sclass="carttablerow"><td\scolspan="5">(?P<msg>[^<]+)<\/td><\/tr>/i';
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @var Client
|
|
* @var Client
|
|
*/
|
|
*/
|
|
@@ -141,9 +145,14 @@ class FreeNom extends Base
|
|
*
|
|
*
|
|
* @return array
|
|
* @return array
|
|
* @throws LlfException
|
|
* @throws LlfException
|
|
|
|
+ * @throws WarningException
|
|
*/
|
|
*/
|
|
protected function getAllDomains(string $domainStatusPage)
|
|
protected function getAllDomains(string $domainStatusPage)
|
|
{
|
|
{
|
|
|
|
+ if (preg_match(self::NO_DOMAIN_REGEX, $domainStatusPage, $m)) {
|
|
|
|
+ throw new WarningException(34520014, [$this->username, $m['msg']]);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!preg_match_all(self::DOMAIN_INFO_REGEX, $domainStatusPage, $allDomains, PREG_SET_ORDER)) {
|
|
if (!preg_match_all(self::DOMAIN_INFO_REGEX, $domainStatusPage, $allDomains, PREG_SET_ORDER)) {
|
|
throw new LlfException(34520003);
|
|
throw new LlfException(34520003);
|
|
}
|
|
}
|
|
@@ -428,6 +437,8 @@ class FreeNom extends Base
|
|
$token = $this->getToken($domainStatusPage);
|
|
$token = $this->getToken($domainStatusPage);
|
|
|
|
|
|
$this->renewAllDomains($allDomains, $token);
|
|
$this->renewAllDomains($allDomains, $token);
|
|
|
|
+ } catch (WarningException $e) {
|
|
|
|
+ system_log(sprintf(lang('100129'), $e->getMessage()));
|
|
} catch (LlfException $e) {
|
|
} catch (LlfException $e) {
|
|
system_log(sprintf(lang('100051'), $e->getMessage()));
|
|
system_log(sprintf(lang('100051'), $e->getMessage()));
|
|
$this->sendExceptionReport($e);
|
|
$this->sendExceptionReport($e);
|