Esempio n. 1
0
 /**
  * 添加文章
  */
 public function add_art()
 {
     if (IS_POST) {
         $title = trim($_POST['title']);
         $classid = $_POST['classid'];
         $keywords = trim($_POST['keywords']);
         $description = trim($_POST['description']);
         $fengmian = trim($_POST['fengmian']);
         $is_tj = $_POST['is_tj'];
         $content = trim($_POST['content']);
         $click = trim($_POST['click']);
         $uid = $_POST['uid'];
         $status = $_POST['status'];
         $parr = $this->getprovcity($uid);
         $p_id = $parr['p_id'];
         $c_id = $parr['c_id'];
         if (empty($title)) {
             $this->error("标题不能为空!");
             exit;
         }
         $M = new ArticleModel();
         if ($M->check_art($title)) {
             $this->error("标题已经存在!");
             exit;
         }
         if (empty($classid)) {
             $this->error("请选择分类");
             exit;
         }
         if (!empty($fengmian)) {
             $fmimg = "/Uploads/product/" . $fengmian;
         }
         $data = array("title" => $title, "classid" => $classid, "keywords" => $keywords, "description" => $description, "fmimg" => $fmimg, "is_tj" => $is_tj, "content" => $content, "addtime" => time(), "click" => $click, "uid" => $uid, "adduid" => $_SESSION['my_info']['a_id'], "p_id" => $p_id, "c_id" => $c_id, "status" => $status);
         $rs = $M->add($data);
         if ($rs) {
             $this->success("操作成功!", U("Article/index"));
         } else {
             $this->error("操作失败!");
         }
         exit;
     }
     parent::_initalize();
     $this->assign("systemConfig", $this->systemConfig);
     #文章分类
     $this->assign("artlist", $this->getartclass());
     #会员列表
     $this->assign("ulist", $this->getumemlist());
     $this->display();
 }