當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArticleModel::deleteArticle方法代碼示例

本文整理匯總了PHP中ArticleModel::deleteArticle方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArticleModel::deleteArticle方法的具體用法?PHP ArticleModel::deleteArticle怎麽用?PHP ArticleModel::deleteArticle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ArticleModel的用法示例。


在下文中一共展示了ArticleModel::deleteArticle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

    if ($article['acc_id'] != $account['acc_id']) {
        return Helper::response(false, array(), 'Forbidden, article belongs to different account', 403);
    }
    $patched = ArticleModel::patchArticle($article['acc_id'], array('art_title' => $app->request->post('art_title', ''), 'art_body' => $app->request->post('art_body', '')));
    if (!$patched) {
        return Helper::response(false, array(), 'Application error', 500);
    }
    return Helper::response(true);
});
$app->post('/api-v1.0/article/delete/', function () use($app) {
    if (!($account = Helper::checkSecret())) {
        return;
    }
    $artId = $app->request->post('art_id');
    if (empty($artId)) {
        return Helper::response(false, array(), 'Bad request, art_id required', 400);
    }
    $article = ArticleModel::getArticle($artId);
    if (empty($article)) {
        return Helper::response(false, array(), 'Article not found', 404);
    }
    if ($article['acc_id'] != $account['acc_id']) {
        return Helper::response(false, array(), 'Forbidden, article belongs to different account', 403);
    }
    $deleted = ArticleModel::deleteArticle($article['art_id']);
    if (!$deleted) {
        return Helper::response(false, array(), 'Application error', 500);
    }
    FB::log($deleted);
    return Helper::response(true);
});
開發者ID:joodee,項目名稱:RESTfulSlim,代碼行數:31,代碼來源:article.php

示例2: deleteArticle

 public function deleteArticle()
 {
     $errors = $this->errors;
     //實例化Model
     $articleModel = new ArticleModel();
     $commentModel = new CommentModel();
     $collectModel = new CollectModel();
     $articleTagModel = new ArticleTagModel();
     $articleId = $_GET['articleId'];
     $articles = $articleModel->getArticleById($articleId);
     $tagIds = trim($articles['tagId'], ',');
     $articleTagModel->cutIncByTagIds($tagIds);
     $row = $articleModel->deleteArticle($articleId);
     //刪除文章
     $rows = $commentModel->delCommentByArticleId($articleId);
     //刪除文章評論
     $collectModel->deleteCollectByArticleId($articleId);
     if ($row) {
         $result['code'] = '0';
         $result['message'] = $errors['0'];
     } else {
         $result['code'] = '036';
         $result['message'] = $errors['036'];
     }
     echo json_encode($result);
     exit;
 }
開發者ID:Jnnock,項目名稱:myyyk,代碼行數:27,代碼來源:AdminCtrl.class.php


注:本文中的ArticleModel::deleteArticle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。