/**
  * 更新单文章操作
  * @param HttpRequest $request
  */
 public function update(HttpRequest $request)
 {
     $id = $request->getParameter("id", "intval");
     $data = $request->getParameter("data");
     $data["update_time"] = time();
     parent::update($data, $request);
 }
 /**
  * 更新友情链接操作
  * @param HttpRequest $request
  */
 public function update(HttpRequest $request)
 {
     $data = $request->getParameter("data");
     parent::update($data, $request);
 }
 /**
  * 更新媒体管理员角色操作
  * @param HttpRequest $request
  */
 public function update(HttpRequest $request)
 {
     $data = $request->getParameter('data');
     $data['permission'] = cn_json_encode($data['permission']);
     parent::update($data, $request);
 }
 /**
  * 更新文章操作
  * @param HttpRequest $request
  */
 public function update(HttpRequest $request)
 {
     $data = $request->getParameter("data");
     //如果有标签则先插入标签
     $tag_bak = $request->getParameter('tag_bak', 'trim');
     if (trim($data['tags']) != $tag_bak) {
         $tagService = Beans::get('article.tags.service');
         $tags = explode(',', $data['tags']);
         $tagIds = array();
         foreach ($tags as $value) {
             //1.首先查看标签是否存在,如果存在则直接取其ID
             $item = $tagService->getItem("name='{$value}'", 'id');
             if ($item) {
                 $tagIds[] = $item['id'];
                 //不存在则加入新标签
             } else {
                 $id = $tagService->add(array('name' => $value));
                 if ($id > 0) {
                     $tagIds[] = $id;
                 }
             }
         }
         $data['tags'] = implode(',', $tagIds);
         //不更改标签
     } else {
         unset($data['tags']);
     }
     $data['update_time'] = time();
     parent::update($data, $request);
 }