public function index() { $id = intval($_GET['id']); $article = sp_sql_post($id, ''); $termid = $article['term_id']; $term_obj = D("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $article_id = $article['object_id']; $should_change_post_hits = sp_check_user_action("posts{$article_id}", 1, true); if ($should_change_post_hits) { $posts_model = M("Posts"); $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1"))); } $smeta = json_decode($article['smeta'], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }
public function index() { $id = intval($_GET['id']); $article = sp_sql_post($id, ''); $termid = $article['term_id']; $term_obj = M("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $article_id = $article['object_id']; $should_change_post_hits = sp_check_user_action("posts{$article_id}", 1, true); if ($should_change_post_hits) { $posts_model = M("Posts"); $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1"))); } $article_date = $article['post_modified']; $join = "" . C('DB_PREFIX') . 'posts as b on a.object_id =b.id'; $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id'; $rs = M("TermRelationships"); $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified asc")->find(); $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified desc")->find(); $this->assign("next", $next); $this->assign("prev", $prev); $smeta = json_decode($article['smeta'], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }
public function index() { $id = intval($_GET['id']); $result = sp_sql_goods('goods_id:' . $id . ";", ''); $goods = $result[0]; if (empty($goods['content'])) { if (!empty($goods['click_url'])) { header("Location: " . $goods['click_url']); } } $termid = $goods['term_id']; $term_obj = D("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $goods_id = $goods['goods_id']; $should_change_goods_hits = sp_check_user_action("goods{$goods_id}", 1, true); if ($should_change_goods_hits) { $goods_model = M("goods"); $goods_model->save(array("id" => $goods_id, "goods_hits" => array("exp", "goods_hits+1"))); } //同类热卖 $list = sp_sql_goods('cid:' . $goods['term_id'] . ";limit:5;order:listorder DESC,total_num DESC;field:goods_id,goods_name,goods_price,click_url,pic_url;", ''); $this->assign('list', $list); $smeta = json_decode($goods['smeta'], true); $content_data = sp_content_page($goods['goods_body']); $goods['goods_body'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($goods); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("goods_id", $goods_id); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "goods"); $this->display(":{$tplname}"); }
public function index() { $article_id = intval($_GET['id']); $article = sp_sql_post($article_id, ''); $termid = $article['term_id']; $term_obj = D("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $smeta = json_decode($article[smeta], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }
public function index() { $id = intval($_GET['id']); $article = sp_sql_post($id, ''); if (empty($article)) { header('HTTP/1.1 404 Not Found'); header('Status:404 Not Found'); if (sp_template_file_exists(MODULE_NAME . "/404")) { $this->display(":404"); } return; } $termid = $article['term_id']; $term_obj = M("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $article_id = $article['object_id']; $posts_model = M("Posts"); $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1"))); $article_date = $article['post_modified']; $join = "" . C('DB_PREFIX') . 'posts as b on a.object_id =b.id'; $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id'; $rs = M("TermRelationships"); $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified asc")->find(); $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified desc")->find(); $this->assign("next", $next); $this->assign("prev", $prev); $smeta = json_decode($article['smeta'], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; $this->assign("page", $content_data['page']); $this->assign($article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $this->assign("region", $article['post_region']); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }
public function content() { $id = $_GET['id']; $article = sp_sql_content($id, ''); if (empty($article)) { header('HTTP/1.1 404 Not Found'); header('Status:404 Not Found'); if (sp_template_file_exists(MODULE_NAME . "/404")) { $this->display(":404"); } return; } $termid = $article['term_id']; $term_obj = M("Terms"); $term = $term_obj->where("term_id='{$termid}'")->find(); $str_like_list = D('like')->getLikeByUUID($id, true); $article_id = $article['object_id']; $dbContent = D("content"); $dbContent->saveByUUID($id, array("post_hits" => array("exp", "post_hits+1"))); $article_date = $article['post_modified']; $join = "" . C('DB_PREFIX') . 'content as b on a.object_id =b.id'; $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id'; $rs = M("TermRelationships"); $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'a.term_id' => $termid))->order("post_modified asc")->find(); $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'a.term_id' => $termid))->order("post_modified desc")->find(); $this->assign("next", $next); $this->assign("prev", $prev); $smeta = json_decode($article['smeta'], true); $content_data = sp_content_page($article['post_content']); $article['post_content'] = $content_data['content']; switch ($article['term_id']) { case 2: $article['content_type'] = '论文'; break; case 3: $article['content_type'] = '项目'; break; case 4: $article['content_type'] = '获奖'; break; case 5: $article['content_type'] = '专利'; break; } $this->assign("page", $content_data['page']); $this->assign("article", $article); $this->assign("smeta", $smeta); $this->assign("term", $term); $this->assign("article_id", $article_id); $this->assign("str_like_list", $str_like_list); $tplname = $term["one_tpl"]; $tplname = sp_get_apphome_tpl($tplname, "article"); $this->display(":{$tplname}"); }