예제 #1
0
             $data['article'] = $article;
         }
         render('article.edit', $data);
     } else {
         $result = $categoryService->getAll();
         $data = array('category_data' => $result);
         render('article.edit', $data);
     }
 } else {
     if ($method == 'publish') {
         if (v('cid') && v('type') && v('title') && v('content') && v('abstract')) {
             if (v('id')) {
                 // 文章更新
                 $id = v('id');
                 if ($service->update($id, v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                     if ($service->publish($id)) {
                         // 静态化文章,及更新列表
                         $service->staticArticle($id);
                         $category = $categoryService->findById(v('cid'));
                         $service->staticArticleList($category);
                         $service->staticIndex();
                     }
                 }
             } else {
                 if ($service->save(v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                     $id = last_id();
                     if ($service->publish($id)) {
                         // 静态化文章,及更新列表
                         $service->staticArticle($id);
                         $category = $categoryService->findById(v('cid'));
                         $service->staticArticleList($category);