fetch(); } public function datas() { $page = empty($_GET["page"]) ? 1 : $_GET["page"]; $pagesize = empty($_GET["rows"]) ? 1 : $_GET["rows"]; if (empty($page) || $page < 1) { $page = 1; } if (empty($pagesize) || $pagesize < 1) { $pagesize = 30; } $info = DB::table('remotereport')->page($page, $pagesize)->select(); $num = DB::table('remotereport')->count(); $data = array(); $data['total'] = $num; $data['rows'] = $info; echo json_encode($data); } /** * 编辑窗口 * @return type */ public function edit() { if (isset($_GET["id"])) { $id = $_GET["id"]; if ($id != null) { $remotereport = Db::table("remotereport")->where("id", $id)->find(); if (count($remotereport) > 0) { $this->assign("remotereport", $remotereport); } } } return $this->fetch('edit'); } public function save() { $a = DB::table('remotereport')->where('id', $_GET['id'])->update($_GET); SysLogs::log("remotereport", "U", 'id = ' . $_GET['id'] . " --> " . json_encode($_GET)); if ($a) { return 'success'; } else { return 'fail'; } } /** * 软删除记录 */ public function delete() { if (isset($_GET["ids"])) { $ids = $_GET["ids"]; if (!empty($ids)) { $idArr = explode(",", $ids); if (count($idArr) > 0) { Db::table("remotereport")->where("id", "in", $idArr)->update(['status' => 1]); SysLogs::log("remotereport", "U", 'id in ' . $ids . " --> status = 0"); } echo "delete_ok"; return; } } echo "fail"; } }