| xqd
@@ -28,7 +28,7 @@ class InfoController extends Controller
|
|
|
function index(Request $reqeust) {
|
|
|
$search['keyword'] = $reqeust->input('keyword');
|
|
|
$query = $this->repository->pushCriteria(new MultiWhere($search));
|
|
|
-
|
|
|
+ $request = $reqeust->all();
|
|
|
if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
|
|
|
$query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
|
|
|
}
|
| 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
@@ -101,7 +101,6 @@ class InfoController extends Controller
|
|
|
*/
|
|
|
public function update(Request $reqeust) {
|
|
|
if($reqeust->method() == 'POST') {
|
|
|
-// dd($reqeust->all());
|
|
|
return $this->_updateSave();
|
|
|
}
|
|
|
$data = $this->repository->find($reqeust->get('id'));
|
| xqd
@@ -133,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
@@ -143,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
@@ -191,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();
|
|
|
}
|