/** * 文章添加处理 * to be removed */ public function addHandle() { $PostsLogic = new PostsLogic(); $post_data = $this->dataHandle(); if ($this->noverify() == false || I('post.post_status') == 'unverified') { $post_data['post_status'] = 'unverified'; } else { $post_data['post_status'] = 'publish'; } if ($post_id = $PostsLogic->relation(true)->add($post_data)) { //, 'Logic' cookie('post_add', null); if ($post_data['post_type'] == 'single') { $this->jsonReturn(1, "发布成功", U('Admin/Posts/index')); } elseif ($post_data['post_type'] == 'page') { $this->jsonReturn(1, "发布成功", U('Admin/Posts/page')); } else { $this->jsonReturn(1, "发布成功", U('Admin/Posts/' . $post_data['post_type'])); } } else { cookie('post_add', gzcompress(json_encode($post_data)), 3600000); //支持大约2.8万个字符 Ueditor计算方法,所有中文和英文数字都算一个字符计算 $this->jsonReturn(0, "发布失败"); } }