public function actionGetSource() { echo new ReturnInfo(RET_SUC, Source::getSourceDomains()); }
/** * validate IosUrl, AndroidUrl, Official */ public function regexUrl($attribute, $params) { switch ($attribute) { case 'OfficialWeb': if (!empty($this->OfficialWeb)) { //"(^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_\+~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?$)"; $regex = "(^(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?\$)"; if (!preg_match($regex, $this->OfficialWeb)) { throw new THttpException("App官方网站地址格式有误"); //$this->addError('OfficialWeb', $attribute."地址错误"); } } break; case 'AppUrl': if (!empty($this->AppUrl)) { $appHost = parse_url($this->AppUrl); if (isset($appHost['host'])) { $appMarketArray = Source::getSourceDomains(); if (!in_array($appHost['host'], $appMarketArray)) { throw new THttpException("App链接有误"); //$this->addError('AppUrl', $attribute."地址错误"); } } else { throw new THttpException($attribute . "App链接有误"); //$this->addError('AppUrl', $attribute."地址错误"); } } break; } }