1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// 指定删除在志愿要问
require_once ("../manager_include.inc");
ErrorLogger::doOutput("Compass...ajax_delete_news.php....Start.", 0);
//获取参数
$newsId = ParamUtil::getRequestNumber("newsId", 0);
$result = array();
//参数检查
if(empty($newsId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//判断在线答疑是否存在
$param = array();
$param['id'] = $newsId;
$param['delete_flg'] = false;
$tmpList = NewsDat::getList($param,'id','desc', 0, 1);
if(empty($tmpList)) {
$result["message"] = "数据不存在!";
responseNG($result);
}
//删除数据以及对应的回答数据
foreach($tmpList as $newsDat) {
$newsDat->delete_flg = true;
$newsDat->save();
}
//组装返回数据
$result["message"] = "删除成功!";
responseOK($result);
ErrorLogger::doOutput("Compass...ajax_delete_news.php....End.", 0);
//返回结果
responseOK($result);
function responseNG($result) {
$result = array("status"=>"NG", "result"=>$result);
print json_encode($result);
exit;
}
function responseOK($result) {
$result = array("status"=>"OK", "result"=>$result);
print json_encode($result);
exit;
}
?>