| xqd
@@ -45,7 +45,7 @@ class SettingsController extends Controller
|
|
|
$data['category'] = 'banner';
|
|
|
$data['key'] = '0';
|
|
|
$data['pid'] = '0';
|
|
|
- $data['value'] = $pic[0];
|
|
|
+ $data['value'] = getenv('APP_URL').$pic[0];
|
|
|
$id = $this->repository->create($data);
|
|
|
if($id) {
|
|
|
$url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
|
| xqd
@@ -80,9 +80,9 @@ class SettingsController extends Controller
|
|
|
$old_pics = $data2->value;
|
|
|
$pic = (array) request('value');
|
|
|
if (!empty($pic)) {
|
|
|
- $data['value'] = $pic[0];
|
|
|
- if (is_file('.'.$old_pics)) {
|
|
|
- unlink('.'.$old_pics);
|
|
|
+ $data['value'] = getenv('APP_URL').$pic[0];
|
|
|
+ if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pics))) {
|
|
|
+ unlink('.'.str_replace(getenv('APP_URL'),'',$old_pics));
|
|
|
}
|
|
|
}
|
|
|
$ok = $this->repository->update(request('id'),$data);
|
| xqd
@@ -101,8 +101,8 @@ class SettingsController extends Controller
|
|
|
$old_pics = $data2->value;
|
|
|
$bool = $this->repository->destroy($request->id);
|
|
|
if($bool) {
|
|
|
- if (is_file('.'.$old_pics)) {
|
|
|
- unlink('.'.$old_pics);
|
|
|
+ if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pics))) {
|
|
|
+ unlink('.'.str_replace(getenv('APP_URL'),'',$old_pics));
|
|
|
}
|
|
|
return $this->showMessage('操作成功');
|
|
|
}else {
|