function grade() { $list = $this->grade->getGrade(); $gradetype = $this->grade->getGradeType(); $this->assign('gradetype', fieldtokey($gradetype, 'id')); $this->assign('list', $list); $this->display(); }
/** * 分类列表 * @param array * @param string * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-8-5 下午11:13:38 */ function catelist($_limit = 'count', $_where = array()) { $this->temp = $this->level = array(); if ($_limit == 'count') { $count = $this->cate->where($_where)->count(); return $count; } elseif ($_limit == 'all') { $list = $this->cate->where($_where)->order('id DESC')->select(); } else { $list = $this->cate->where($_where)->order('id DESC')->limit($_limit)->select(); } return $this->temp = fieldtokey($list); }
/** * 会员详情 * @param int|array $_uid 会员ID * @param string $_field 字段 * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-8-4 下午3:05:11 */ function getMemberInfo($_uid, $_field = '*') { $where = array(); if (is_array($_uid)) { $where['id'] = array('IN', implode(',', $_uid)); } else { $where['id'] = $_uid; } $info = $this->member->field($_field)->where($where)->select(); $info = fieldtokey($info); // echo $this->member->getlastsql(); return $info; }
/** * 返回评论 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-9 下午4:22:35 */ function comment($_limit = 'count', $_where = array(), $_order = 'id DESC') { if ($_limit == 'count') { $count = $this->comment->where($_where)->count(); return $count; } $list = $this->comment->where($_where)->order($_order)->limit($_limit)->select(); //把下标换成ID $list = fieldtokey($list); //评论下的回复 $cids = arr2to1($list); $reply = $this->_commentReply($cids); foreach ($reply as $k => $v) { $list[$v['reply_id']]['reply'][$v['id']] = $v; } return $list; }