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