where('id', $appid)->find(); if (!$app_res) json(201, '应用不存在'); $add_res = Db::table('app_notice')->add(['adm' => $adm, 'content' => $content, 'appid' => $appid, 'time' => time()]); //die($add_res); if ($add_res) { if (defined('ADM_LOG') && ADM_LOG == 1) { Db::table('log')->add(['group' => 'adm', 'type' => 'notice_add', 'status' => 200, 'time' => time(), 'ip' => getip(), 'data' => json_encode($_POST)]); } //记录日志 json(200, '添加成功'); } else { if (defined('ADM_LOG') && ADM_LOG == 1) { Db::table('log')->add(['group' => 'adm', 'type' => 'notice_add', 'status' => 201, 'time' => time(), 'ip' => getip(), 'data' => json_encode($_POST)]); } //记录日志 json(201, '添加失败'); } } if ($act == 'del') { //删除通知 $id = isset($_POST['id']) && !empty($_POST['id']) ? intval($_POST['id']) : json(201, '请选择需要删除的数据'); $res = Db::table('app_notice')->where('id', $id)->del(); //false if ($res) { if (defined('ADM_LOG') && ADM_LOG == 1) { Db::table('log')->add(['group' => 'adm', 'type' => 'notice_del', 'status' => 200, 'time' => time(), 'ip' => getip(), 'data' => json_encode($_POST)]); } //记录日志 json(200, '删除成功'); } else { if (defined('ADM_LOG') && ADM_LOG == 1) { Db::table('log')->add(['group' => 'adm', 'type' => 'notice_del', 'status' => 201, 'time' => time(), 'ip' => getip(), 'data' => json_encode($_POST)]); } //记录日志 json(201, '删除失败'); } } ?>