public function action_pinlun() { $articleid = $this->params['id']; $typeid = $this->params['typeid']; $action = $this->params['action']; $page = $this->params['page']; $table_arr = array('1' => 'line', '2' => 'hotel', '3' => 'car', '5' => 'spot', '8' => 'visa', '13' => 'tuan'); $module = $table_arr[$typeid]; $row = ORM::factory($module)->where("id={$articleid}")->find()->as_array(); $row['score'] = Model_Comment::getScore($articleid, $typeid); $row['commentnum'] = Model_Comment::getPinLunCount($articleid, $typeid); $page = $page ? $page : 1; $pagesize = 10; $offset = ($page - 1) * $pagesize; $sql = "select * from sline_comment where articleid='{$articleid}' and typeid='{$typeid}' limit {$offset},{$pagesize}"; $pl = DB::query(1, $sql)->execute()->as_array(); foreach ($pl as $key => $v) { $score = $pl[$key]['score1'] * 20; $memberinfo = Common::getMemberInfo($v['memberid']); $pl[$key]['memberico'] = $memberinfo['litpic'] ? $memberinfo['litpic'] : Common::getDefaultImage(); $pl[$key]['membername'] = $memberinfo['nickname']; $pl[$key]['membercore'] = $score . '%'; } if ($action == 'ajax') { echo json_encode($pl); exit; } $this->assign('pinlunlist', $pl); $this->assign('info', $row); $this->assign('typeid', $typeid); $this->display('public/pinlun'); }
public function action_show() { $id = $this->params['id']; $tel = Common::getSysPara('cfg_phone'); //详细信息 $row = ORM::factory('tuan')->where("id={$id}")->find()->as_array(); $row['picturelist'] = Model_Tuan::handlePicture($row['piclist']); $row['score'] = Model_Comment::getScore($row['id'], 13); $this->assign('tuan', $row); $this->assign('phone', $tel); $this->display('tuan/show'); }