作者 lyh

gx

@@ -22,28 +22,13 @@ class ServerInformationController extends BaseController @@ -22,28 +22,13 @@ class ServerInformationController extends BaseController
22 */ 22 */
23 public function lists($deleted = ServerInformation::DELETED_NORMAL) 23 public function lists($deleted = ServerInformation::DELETED_NORMAL)
24 { 24 {
25 - $request = $this->param;  
26 - $search = [];  
27 - $search_array = [  
28 - 'ip' => 'ip',  
29 - 'title' => 'title'  
30 - ];  
31 - foreach ($search_array as $key => $item) {  
32 - if (isset($request[$key]) && $request[$key]) {  
33 - $search[$item] = $request[$key];  
34 - }  
35 - }  
36 - $size = request()->input('size', $this->row);  
37 - $query = ServerInformation::query()->select(['id', 'title', 'ip']);  
38 - if ($search) {  
39 - foreach ($search as $key => $item) {  
40 - $query = $query->Where("{$key}", 'like', "%{$item}%");  
41 - } 25 + if(isset($this->map['title']) && !empty($this->map['title'])){
  26 + $this->map['title'] = ['like','%'.$this->map['title'],','];
42 } 27 }
43 - $data = $query->where('deleted', $deleted)  
44 - ->orderBy('id', 'desc')  
45 - ->paginate($size);  
46 - return $this->response('success', Code::SUCCESS, $data); 28 + $serverInformationModel = new ServerInformation();
  29 + $this->map['deleted'] = ServerInformation::DELETED_NORMAL;
  30 + $lists = $serverInformationModel->lists($this->map,$this->page,$this->row,$this->order);
  31 + $this->response('success', Code::SUCCESS, $lists);
47 32
48 } 33 }
49 34
@@ -184,20 +184,12 @@ class Project extends Base @@ -184,20 +184,12 @@ class Project extends Base
184 184
185 public function setNoticeFileAttribute($value) 185 public function setNoticeFileAttribute($value)
186 { 186 {
187 - foreach ($value as &$v) {  
188 - $v = Upload::url2path($v);  
189 - }  
190 $this->attributes['notice_file'] = Arr::a2s($value); 187 $this->attributes['notice_file'] = Arr::a2s($value);
191 } 188 }
192 189
193 public function getNoticeFileAttribute($value) 190 public function getNoticeFileAttribute($value)
194 { 191 {
195 $value = Arr::s2a($value); 192 $value = Arr::s2a($value);
196 - if(!empty($value)){  
197 - foreach ($value as &$v) {  
198 - $v = Upload::path2url($v);  
199 - }  
200 - }  
201 return $value; 193 return $value;
202 } 194 }
203 195