Esempio n. 1
0
<?php

include 'init.php';
require_once SROOT . 'articleService.class.php';
require_once SROOT . 'categoryService.class.php';
$method = v('method');
if (!$method) {
    send_result(0, "request does not have method parame");
}
$service = new ArticleService();
$categoryService = new CategoryService();
if ($method == 'delete') {
    if (v('id') && isset($_REQUEST['status'])) {
        if ($_REQUEST['status'] == -1) {
            $flag = $service->delete(v('id'));
        } else {
            $flag = $service->trash(v('id'));
        }
        if ($flag) {
            // 静态化文章,及更新列表
            $service->staticArticle($id);
            $category = $categoryService->findById(v('cid'));
            $service->staticArticleList($category);
            $service->staticIndex();
        }
        forward('article_list.php?status=' . $_REQUEST['status']);
    } else {
        send_result(0, 'request does not have id ro status parame');
    }
} else {
    if ($method == 'draft') {