예제 #1
0
 public function review()
 {
     $uid = intval($_GET['uid']);
     if ($uid == '') {
         parent::error404();
     }
     //分配根据GET传过来的uid用户的信息
     $objUser = M('user');
     $userMessage = $objUser->where('id=' . $uid)->field('id,username,face,introduce,point,exp')->find();
     $userMessage = deep_htmlspecialchars_decode($userMessage);
     if ($userMessage == '') {
         parent::error404();
     }
     $this->assign('userMessage', $userMessage);
     //分配该用户的评论
     $objComment = M('comment');
     import('ORG.Util.Page');
     //导入分页类
     $count = $objComment->where(array('comment_uid' => $uid))->count();
     $page = new page($count, 20);
     $page->setConfig('theme', '%upPage% %first% %prePage% %linkPage% %downPage%');
     $commentList = $objComment->where(array('comment_uid' => $uid))->field('aid,time,comment')->order('time desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     foreach ($commentList as $k1 => $v1) {
         $commentList[$k1]['url'] = '__APP__/List/detail/id/' . $v1['aid'] . '.html';
     }
     $commentList = deep_htmlspecialchars_decode($commentList);
     $show = $page->show();
     $this->assign('page', $show);
     $this->assign('commentList', $commentList);
     //分配Pagetitle
     $this->pageTitle = $userMessage['username'] . '的个人主页_支招网';
     $this->display();
 }
예제 #2
0
 public function mcStatus()
 {
     parent::isLogin();
     //登录判断
     $aid = intval($_GET['aid']);
     $cid = intval($_GET['cid']);
     if ($aid == '') {
         parent::error404();
     }
     if ($cid == '') {
         parent::error404();
     }
     $objComment = M('comment');
     $result = $objComment->where(array('id' => $cid))->setField('status', '1');
     if ($result) {
         redirect(U(APP_NAME . '/List/detail', array('id' => $aid)));
     } else {
         $this->error('系统繁忙,请稍后再试');
     }
 }
예제 #3
0
 public function checkUserName()
 {
     if (!IS_AJAX) {
         parent::error404();
     }
     $username = $this->_post('username');
     $result = M('user')->where(array('username' => $username))->getField('id');
     if ($result) {
         echo 1;
     } else {
         echo 0;
     }
 }
예제 #4
0
 public function handleBest()
 {
     $aid = intval($_GET['aid']);
     //文章ID
     if ($aid == '') {
         parent::error404();
     }
     $cid = intval($_GET['cid']);
     //该条评论的id
     if ($cid == '') {
         parent::error404();
     }
     $uid = intval($_GET['uid']);
     //该条评论的uid
     if ($uid == '') {
         parent::error404();
     }
     $auid = intval($_GET['auid']);
     //该条评论的uid
     if ($auid == '') {
         parent::error404();
     }
     $reward = intval($_GET['reward']);
     if ($reward == '') {
         parent::error404();
     }
     $objBest = M('best');
     $objAsk = M('ask');
     $objUser = M('user');
     $data = array();
     $data['aid'] = $aid;
     $data['cid'] = $cid;
     $data['uid'] = $uid;
     $data['article_uid'] = $auid;
     $data['time'] = time();
     $result = $objBest->data($data)->add();
     if ($result) {
         $objAsk->where('id=' . $aid)->setField(array('solve' => "1"));
         //设置该问题状态 为已采纳
         $objUser->where(array('id' => $auid))->setDec('point', $reward);
         //该篇文章的用户减分
         $objUser->where(array('id' => $uid))->setInc('point', $reward);
         //该条评论的用户加分
         $this->success('采纳为最佳支招成功..');
     } else {
         $this->error('采纳失败,请稍后再试');
     }
 }