作者 lyh

gx

... ... @@ -22,28 +22,13 @@ class ServerInformationController extends BaseController
*/
public function lists($deleted = ServerInformation::DELETED_NORMAL)
{
$request = $this->param;
$search = [];
$search_array = [
'ip' => 'ip',
'title' => 'title'
];
foreach ($search_array as $key => $item) {
if (isset($request[$key]) && $request[$key]) {
$search[$item] = $request[$key];
}
}
$size = request()->input('size', $this->row);
$query = ServerInformation::query()->select(['id', 'title', 'ip']);
if ($search) {
foreach ($search as $key => $item) {
$query = $query->Where("{$key}", 'like', "%{$item}%");
}
if(isset($this->map['title']) && !empty($this->map['title'])){
$this->map['title'] = ['like','%'.$this->map['title'],','];
}
$data = $query->where('deleted', $deleted)
->orderBy('id', 'desc')
->paginate($size);
return $this->response('success', Code::SUCCESS, $data);
$serverInformationModel = new ServerInformation();
$this->map['deleted'] = ServerInformation::DELETED_NORMAL;
$lists = $serverInformationModel->lists($this->map,$this->page,$this->row,$this->order);
$this->response('success', Code::SUCCESS, $lists);
}
... ...
... ... @@ -184,20 +184,12 @@ class Project extends Base
public function setNoticeFileAttribute($value)
{
foreach ($value as &$v) {
$v = Upload::url2path($v);
}
$this->attributes['notice_file'] = Arr::a2s($value);
}
public function getNoticeFileAttribute($value)
{
$value = Arr::s2a($value);
if(!empty($value)){
foreach ($value as &$v) {
$v = Upload::path2url($v);
}
}
return $value;
}
... ...