/** * 退出 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-18 下午4:57:43 */ function logout() { unset($_SESSION['uid']); unset($_SESSION['userinfo']); $this->assign('type', 'logout'); $content = $this->fetch('edit'); ejson('退出成功!', 1, array('html' => $content)); }
/** * 评论点赞 * @param array * @param string * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-10-23 上午12:01:49 */ function praise() { $comid = intval($_REQUEST['comid']); $m = M('SourcComment'); $field = intval($_REQUEST['good']) ? 'good_num' : 'bad_num'; $reid = $m->where(array('id' => $comid))->setInc($field); if ($reid === false) { ejson('失败', 0); } else { $num = $m->where(array('id' => $comid))->getField($field); ejson('成功', 1, array('num' => $num)); } }