diff --git a/composer.json b/composer.json index 9955d13..1afa2cb 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,11 @@ "topthink/framework": "^6.0.0", "topthink/think-orm": "^2.0", "liguangchun/ip": "^1.1", - "ext-bcmath": "*" + "ext-bcmath": "*", + "aliyuncs/oss-sdk-php": "^2.3", + "obs/esdk-obs-php": "^3.19", + "baidubce/bce-sdk-php": "^0.8.22", + "qcloud/cos-sdk-v5": "^2.0" }, "autoload": { "files": [ diff --git a/src/service/douyin/DouYinException.php b/src/exception/DouYinException.php similarity index 96% rename from src/service/douyin/DouYinException.php rename to src/exception/DouYinException.php index 5fb7351..c22d393 100644 --- a/src/service/douyin/DouYinException.php +++ b/src/exception/DouYinException.php @@ -14,7 +14,7 @@ // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library // +---------------------------------------------------------------------- -namespace DtApp\ThinkLibrary\service\douyin; +namespace DtApp\ThinkLibrary\exception; use Exception; diff --git a/src/service/WeMini/NewTmplService.php b/src/service/WeMini/NewTmplService.php new file mode 100644 index 0000000..b5570fd --- /dev/null +++ b/src/service/WeMini/NewTmplService.php @@ -0,0 +1,41 @@ +http(str_replace('ACCESS_TOKEN', $access_token, $url), '', true); + } +} diff --git a/src/service/douyin/WatermarkService.php b/src/service/douyin/WatermarkService.php index 4862f50..2424c0b 100644 --- a/src/service/douyin/WatermarkService.php +++ b/src/service/douyin/WatermarkService.php @@ -16,6 +16,7 @@ namespace DtApp\ThinkLibrary\service\douyin; +use DtApp\ThinkLibrary\exception\DouYinException; use DtApp\ThinkLibrary\facade\Pregs; use DtApp\ThinkLibrary\Service; use stdClass; @@ -238,11 +239,14 @@ class WatermarkService extends Service * 正则匹配 mid * @param $content * @return mixed + * @throws DouYinException */ private function getItemId($content) { preg_match('/"(?<=itemId:\s\")\d+"/', $content, $matches); + if (!isset($matches[0])) throw new DouYinException('视频不存在'); preg_match("~\"(.*?)\"~", $matches[0], $matches2); + if (!isset($matches2[1])) throw new DouYinException('视频不存在'); return $matches2[1]; } @@ -250,12 +254,15 @@ class WatermarkService extends Service * 正则匹配 dytk * @param $content * @return mixed + * @throws DouYinException */ private function getDyTk($content) { preg_match("~dytk(.*?)}~", $content, $matches); + if (!isset($matches[1])) throw new DouYinException('视频不存在'); $Dytk = $matches[1]; preg_match("~\"(.*?)\"~", $Dytk, $matches2); + if (!isset($matches2[1])) throw new DouYinException('视频不存在'); return $matches2[1]; }