Example #1
0
 /**
  * 删除资讯
  *
  * @return boolean
  */
 public function delAction()
 {
     $iNewsID = $this->getParam('id');
     if (!$iNewsID) {
         return $this->showMsg('非法操作!', false);
     }
     if (is_string($iNewsID) && strpos($iNewsID, ",") === false) {
         $iNewsID = array($iNewsID);
     } elseif (is_string($iNewsID) && strpos($iNewsID, ",")) {
         $iNewsID = explode(",", $iNewsID);
     } else {
         return $this->showMsg('非法操作!', false);
     }
     $fail_news = array();
     foreach ($iNewsID as $key => $value) {
         $iRet = Model_News::delData($value);
         if ($iRet != 1) {
             $fail_news[] = $value;
         }
     }
     if (empty($fail_news)) {
         return $this->showMsg('资讯删除成功!', true);
     }
     $ids = join(',', $fail_news);
     return $this->showMsg('资讯' . $ids . '删除失败!', false);
 }