| xqd
@@ -77,7 +77,7 @@ class InfoController extends Controller
|
|
|
$arr = [];
|
|
|
foreach ($pics['url'] as $pic) {
|
|
|
$arr[] = [
|
|
|
- 'pic'=>$pic,
|
|
|
+ 'pic'=>getenv('APP_URL').$pic,
|
|
|
'dream_id'=>$id,
|
|
|
'created_at'=>date("Y-m-d H:i:s"),
|
|
|
'updated_at'=>date("Y-m-d H:i:s"),
|
| xqd
@@ -132,8 +132,8 @@ class InfoController extends Controller
|
|
|
// 删除以前图片 重新插入
|
|
|
if (!empty($b)) {
|
|
|
foreach ($b as $old_pic){
|
|
|
- if (is_file('.'.$old_pic)) {
|
|
|
- unlink('.'.$old_pic);
|
|
|
+ if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
|
|
|
+ unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
|
|
|
}
|
|
|
BaseAttachmentModel::where('url',$old_pic)->delete();
|
|
|
DreamImages::where('pic',$old_pic)->delete();
|
| xqd
@@ -142,7 +142,7 @@ class InfoController extends Controller
|
|
|
$arr = []; //插入新的图片
|
|
|
foreach ($a as $pic) {
|
|
|
$arr[] = [
|
|
|
- 'pic'=>$pic,
|
|
|
+ 'pic'=>getenv('APP_URL').$pic,
|
|
|
'dream_id'=>request('id'),
|
|
|
'created_at'=>date('Y-m-d H:i:s'),
|
|
|
'updated_at'=>date('Y-m-d H:i:s'),
|
| xqd
@@ -190,8 +190,8 @@ class InfoController extends Controller
|
|
|
$old_pics = array_column($old_data_pics,'pic');
|
|
|
if (!empty($old_pics)) {
|
|
|
foreach ($old_pics as $old_pic){
|
|
|
- if (is_file('.'.$old_pic)) {
|
|
|
- unlink('.'.$old_pic);
|
|
|
+ if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
|
|
|
+ unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
|
|
|
}
|
|
|
BaseAttachmentModel::where('url',$old_pic)->delete();
|
|
|
}
|