diff --git a/.env b/.env index e6d65dd..92aca90 100644 --- a/.env +++ b/.env @@ -28,6 +28,6 @@ REGIONID=cn-hangzhou SIGNNAME=域展科技 TEMPLATECODE=SMS_176560077 OSS_BUCKET=hphb-storage -OSS_ENDPOINT=hphb-cdn.uzchain.tech -#OSS_ENDPOINT=oss-cn-beijing.aliyuncs.com +CDN_NAME=hphb-cdn.uzchain.tech +OSS_ENDPOINT=oss-cn-beijing.aliyuncs.com diff --git a/app/common.php b/app/common.php index 4288dc2..68c409f 100644 --- a/app/common.php +++ b/app/common.php @@ -236,7 +236,15 @@ if (! function_exists('aliyun')) { if (empty($info['info']['url'])) { return ['code' => 1, 'message' => "上传失败"]; } - return ['code' => 0, 'message' => "", 'url' => $info['info']['url']]; + return [ + 'code' => 0, + 'message' => "", + 'url' => str_replace( + env('ALIYUNSMS.OSS_BUCKET').'.'.env('ALIYUNSMS.OSS_ENDPOINT'), + env('ALIYUNSMS.CDN_NAME'), + $info['info']['url'] + ), + ]; } catch (OssException $e) { return ['code' => 1, 'message' => $e->getMessage()]; }