Commit f9dc4f4c authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !504
parents 88b2fe45 cdcdc312
...@@ -22,7 +22,7 @@ class OssController extends BaseController ...@@ -22,7 +22,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension; $object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName; $filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']); $ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath); $result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) { if (!isset($result["info"]['url'])) {
$this->msg = '上传失败'; $this->msg = '上传失败';
$this->code = -1; $this->code = -1;
......
...@@ -19,7 +19,7 @@ class OssController extends BaseController ...@@ -19,7 +19,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension; $object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName; $filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']); $ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath); $result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) { if (!isset($result["info"]['url'])) {
return ['code' => 1, 'msg' => '上传失败']; return ['code' => 1, 'msg' => '上传失败'];
} }
......
...@@ -23,7 +23,7 @@ class OssController extends BaseController ...@@ -23,7 +23,7 @@ class OssController extends BaseController
$object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension; $object = md5(date('Y-m-d H:i:s') . $uploaded_file->tempName) . '.' . $uploaded_file->extension;
$filePath = $uploaded_file->tempName; $filePath = $uploaded_file->tempName;
$ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']); $ossClient = new OssClient(Yii::$app->params['Oss']['AccessKeyId'], Yii::$app->params['Oss']['AccessKeySecret'], Yii::$app->params['Oss']['Endpoint']);
$result = $ossClient->uploadFile(Yii::$app->params['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath); $result = $ossClient->uploadFile(Yii::$app->params['Oss']['Bucket'], 'upload/' . (empty($type) ? '' : $type . '/') . $object, $filePath);
if (!isset($result["info"]['url'])) { if (!isset($result["info"]['url'])) {
$msg = '上传失败'; $msg = '上传失败';
$code = -1; $code = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment