0]; $list=DB::table('s_devices'); if(!empty($searchInfo['name'])){ $where[]=['device_name','like','%'.$searchInfo['name'].'%']; } $count= $list->where($where)->count(); $list= $list->where($where)->skip(($page-1)*$pageSize) // 跳过前9999条记录 ->take($pageSize)->get(); return \Yz::Return(true, '查询成功', ['list'=>$list,'count'=>$count]); } //获取启用的设备列表 public function GetEnableList(){ $list=DB::table('s_devices')->where(['is_del'=>0,'status'=>1])->get(); return \Yz::Return(true, '查询成功', $list); } public function Save($data,$userid){ if(empty($data['id'])){ $data['adduser']=$userid; $data['is_del']=0; $id=DB::table('s_devices')->insertGetId($data); if($id){ return \Yz::Return(true, '添加成功', $id); }else{ return \Yz::Return(false, '添加失败'); } }else{ $res=DB::table('s_devices')->where('id',$data['id'])->update($data); if($res){ return \Yz::Return(true, '修改成功'); }else{ return \Yz::Return(false, '修改失败'); } } } public function Del($id){ $res=DB::table('s_devices')->where('id',$id)->update(['is_del'=>1]); if($res){ return \Yz::Return(true, '删除成功'); }else{ return \Yz::Return(false, '删除失败'); } } }