|
|
|
@ -15,6 +15,7 @@ use Admin\Event\QiNiuEvent;
|
|
|
|
|
use Think\Model;
|
|
|
|
|
use Think\Upload;
|
|
|
|
|
use Base\Service\OssService;
|
|
|
|
|
use Base\Tool\Storage;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 图片模型
|
|
|
|
@ -70,15 +71,14 @@ class PictureModel extends Model{
|
|
|
|
|
$this->where(['id'=>$value['id']])->save($data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (C('OSS_STATUS')) {
|
|
|
|
|
if (C('STORAGE_TYPE')) {
|
|
|
|
|
$path = explode('/', $value['path']);
|
|
|
|
|
$saveFileName = 'icon/' . $path[4];
|
|
|
|
|
$localFilePath = '.' . $value['path'];
|
|
|
|
|
$ossService = new OssService();
|
|
|
|
|
$result = $ossService->upload($localFilePath, $saveFileName);
|
|
|
|
|
$result = Storage::upload($localFilePath, $saveFileName);
|
|
|
|
|
if ($result['status']) {
|
|
|
|
|
$dataUrl['oss_url'] = $ossService->getUrl($saveFileName);
|
|
|
|
|
$coo = $this->where(['id' => $value['id']])->save($dataUrl);
|
|
|
|
|
$dataUrl['oss_url'] = $result['data']['url'];
|
|
|
|
|
$this->where(['id' => $value['id']])->save($dataUrl);
|
|
|
|
|
} else {
|
|
|
|
|
$this->error = $result['message'];
|
|
|
|
|
return false;
|
|
|
|
|