本文整理汇总了PHP中query_user函数的典型用法代码示例。如果您正苦于以下问题:PHP query_user函数的具体用法?PHP query_user怎么用?PHP query_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($data)
{
$tpl_section = $data['tpl'];
$info = $data['info'];
$tpl_section = $this->handle($tpl_section, '{$[title]}', op_t($info['title']));
$tpl_section = $this->handle($tpl_section, '{$[cTime]}', friendlyDate($info['create_time']));
$tpl_section = $this->handle($tpl_section, '{$[cTimeD]}', date('n j', $info['create_time']));
$tpl_section = $this->handle($tpl_section, '{$[url]}', U('Cat/Index/info', array('info_id' => $info['id'])));
/*用户标签*/
$user = query_user(array('nickname', 'avatar32', 'avatar64', 'avatar128', 'avatar256', 'space_url'), $info['uid']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar32]}', $user['avatar32']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar64]}', $user['avatar64']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar128]}', $user['avatar128']);
$tpl_section = $this->handle($tpl_section, '{$[user_avatar256]}', $user['avatar256']);
$tpl_section = $this->handle($tpl_section, '{$[user_nickname]}', $user['nickname']);
$tpl_section = $this->handle($tpl_section, '{$[user_space_url]}', $user['space_url']);
$tpl_section = $this->handle($tpl_section, '{$[user_uid]}', $user['uid']);
/*用户标签end*/
$tpl_section = $this->handle($tpl_section, '{$[fav_btn]}', R('FavBtn/render', array(array('info' => $info)), 'Widget'));
$entity = D('cat_entity')->find($info['entity_id']);
if ($entity['can_over']) {
$tpl_section = $this->handle($tpl_section, '{$[over_time]}', date('Y-m-d', $info['over_time']));
} else {
$tpl_section = $this->handle($tpl_section, '{$[over_time]}', '');
}
return $tpl_section;
}
示例2: getHot
public function getHot($hour = 1, $num = 10, $page = 1)
{
$map['create_time'] = array('gt', time() - $hour * 60 * 60);
$map['status'] = 1;
$weiboModel = D('Weibo');
$all_topic = $this->where(array('status' => 1), array(array('read_count' => array('neq', 0))))->select();
foreach ($all_topic as $key => &$v) {
$map['content'] = array('like', "%#{$v['name']}#%");
$v['weibos'] = $weiboModel->where($map)->count();
if ($v['weibos'] == 0) {
unset($all_topic[$key]);
}
$v['user'] = query_user(array('space_link'), $v['uadmin']);
}
unset($v);
$all_topic = $this->arraySortByKey($all_topic, 'weibos', false);
$i = 0;
foreach ($all_topic as &$v) {
$v['top_num'] = ++$i;
}
unset($v);
$pager = new Page(count($all_topic), $num);
// dump($all_topic);exit;
$list['data'] = array_slice($all_topic, ($page - 1) * $num, $num);
$list['html'] = $pager->show();
return $list;
}
示例3: getCurrentTitleInfo
public function getCurrentTitleInfo($uid)
{
$user_info = query_user(array('score'), $uid);
$score = $user_info['score'];
$data['current'] = $this->getTitleByScore($score);
//根据积分查询对应等级
$config = $this->getTitleConfig();
foreach ($config as $max => $title) {
if ($score > $max) {
$data['before_level_need'] = $max;
}
if ($score <= $max) {
$data['next'] = $title;
$data['upgrade_require'] = $max;
break;
}
}
if (empty($data['next'])) {
//查询无结果,返回最高等级
$keys = array_keys($config);
$max_key = $keys[count($config) - 1];
$data['next'] = $config[$max_key];
}
$data['left'] = $data['upgrade_require'] - $score;
$data['percent'] = number_format((1 - $data['left'] / ($data['upgrade_require'] - $data['before_level_need'])) * 100, 1);
return $data;
}
示例4: show
public function show($data)
{
$data['entity'] = M('store_entity')->find($data['info']['entity_id']);
$data['data'] = M('Data')->getByInfoId($data['info']['id']);
$data['user'] = query_user(array('nickname', 'space_url', 'avatar64', 'avatar128'), $data['info']['uid']);
$data['user']['info_count'] = M('Goods')->where('uid=' . $data['info']['uid'])->count();
$map['info_id'] = $data['info']['id'];
$data['mid'] = is_login();
$items = M('store_item')->where('good_id=' . $data['info']['id'])->select();
$ids = getSubByKey($items, 'order_id');
$ids_uni = array_unique($ids);
$m_com['id'] = array('in', implode(',', $ids_uni));
$data['info']['com'] = M('Order')->where($m_com)->findPage(10);
foreach ($data['info']['com']['data'] as $k => &$v) {
$data['info']['com']['data'][$k]['user'] = query_user(array('nickname', 'space_url', 'avatar64'), $v['uid']);
$v['response_time_format'] = $v['response_time'] ? friendlyDate($v['response_time']) : '系统自动';
}
$this->assign($data);
if ($data['entity']['name'] == 'shop') {
$this->display('Widget/DefaultInfoTpl/shop');
} elseif ($data['entity']['name'] == 'good') {
$data['shop'] = M('Store/StoreShop')->getById($data['info']['shop_id']);
$this->assign($data);
$this->display('Widget/DefaultInfoTpl/good');
} else {
$this->display('Widget/DefaultInfoTpl/tpl');
}
}
示例5: localComment
/**
* @param
* @param $uid int 评论给谁?
* @author caipeichao
*/
public function localComment($param)
{
$uid = $param['uid'];
$app = $param['app'];
$mod = $param['con'];
$row_id = $param['id'];
//获取参数
$p = $_REQUEST[C('VAR_PAGE')] ? $_REQUEST[C('VAR_PAGE')] : 1;
$count = 7;
//调用接口获取评论列表
$list = $this->getCommentList($app, $mod, $row_id, $p, $count);
$total_count = $this->getCommentCount($app, $mod, $row_id);
//增加用户信息
foreach ($list as &$e) {
$e['user'] = query_user(array('uid', 'avatar64', 'nickname', 'space_url'), $e['uid']);
}
unset($e);
$config = get_addon_config('LocalComment');
$can_guest_comment = $config['can_guest_comment'];
$this->assign('can_guest_comment', $can_guest_comment);
//显示页面
$loginuser = query_user(array('uid', 'avatar64', 'nickname', 'space_url'), $uid);
$this->assign('loginuser', $loginuser);
$this->assign('list', $list);
$this->assign('total_count', $total_count);
$this->assign('count', $count);
$this->assign('app', $app);
$this->assign('mod', $mod);
$info = D($app . '/' . $mod)->get_info($row_id);
$this->assign('info', $info);
$this->assign('row_id', $row_id);
$this->assign('uid', $uid);
$this->display('comment');
}
示例6: localComment
/**
* @param $path string 例如 Travel/detail/12
* @param $uid int 评论给谁?
* @author caipeichao
*/
public function localComment($param)
{
$path = $param['path'];
$uid = $param['uid'];
//获取参数
$p = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
$path = explode('/', $path);
$app = $path[0];
$mod = $path[1];
$row_id = $path[2];
$count = 10;
//调用接口获取评论列表
$list = $this->getCommentList($app, $mod, $row_id, $p, $count);
$total_count = $this->getCommentCount($app, $mod, $row_id);
//增加用户信息
foreach ($list as &$e) {
$e['user'] = query_user(array('uid', 'avatar64', 'nickname', 'space_url'), $e['uid']);
}
unset($e);
//显示页面
$this->assign('list', $list);
$this->assign('total_count', $total_count);
$this->assign('count', $count);
$this->assign('app', $app);
$this->assign('mod', $mod);
$this->assign('row_id', $row_id);
$this->assign('uid', $uid);
$this->display('comment');
}
示例7: getMember
public function getMember($order, $field, $row, $limit)
{
$map['status'] = 1;
if ($field != '') {
$field = 'space_url,nickname,avatar32,avatar64,username,score,' . $field;
} else {
$field = 'space_url,nickname,avatar32,avatar64,username,score';
}
$p = I(C('VAR_PAGE'));
if ($limit) {
$data = M('member')->where($map)->order($order)->limit($row)->select();
} else {
$data = M('member')->where($map)->order($order)->page(!empty($p) ? $p : 1, $row)->select();
}
$fiearr = explode(',', $field);
foreach ($data as $key => $vo) {
//clean_query_user_cache($vo['uid'], $fiearr);
$data[$key]['user'] = query_user($fiearr, $vo['uid']);
}
if ($data == null) {
$this->apiError("获取用户列表失败", null);
} else {
$this->apiSuccess("获取用户列表成功", null, array('data' => $data));
}
}
示例8: index
public function index()
{
$map = $this->setMap();
$map['status'] = 1;
$map['last_login_time'] = array('neq', 0);
$peoples = S('People_peoples_' . I('page', 0, 'intval') . '_' . serialize($map));
if (empty($peoples)) {
$peoples = M('Member')->where($map)->field('uid', 'reg_time', 'last_login_time')->order('last_login_time desc')->findPage(20);
$userConfigModel = M('Ucenter/UserConfig');
$titleModel = M('Ucenter/Title');
foreach ($peoples['data'] as &$v) {
$v = query_user(array('title', 'avatar128', 'nickname', 'uid', 'space_url', 'score', 'title', 'fans', 'following', 'rank_link'), $v['uid']);
$v['level'] = $titleModel->getCurrentTitleInfo($v['uid']);
//获取用户封面id
$where = getUserConfigMap('user_cover', '', $v['uid']);
$where['role_id'] = 0;
$model = $userConfigModel;
$cover = $model->findData($where);
$v['cover_id'] = $cover['value'];
$v['cover_path'] = getThumbImageById($cover['value'], 273, 80);
}
unset($v);
S('People_peoples_' . serialize($map), $peoples, 300);
}
$this->assign('tab', 'index');
$this->assign('lists', $peoples);
$this->display();
}
示例9: index
public function index($page = 1, $keywords = '')
{
$map = $this->setMap();
$map['status'] = 1;
$map['last_login_time'] = array('neq', 0);
$page = I('page', 1, 'intval');
$page < 1 && ($page = 1);
$cachedPage = 10;
$cachedId = 'People_peoples_' . $page . '_' . serialize($map);
$peoples = $page > $cachedPage || !empty($_REQUEST['keywords']) || !empty($_REQUEST['tag']) ? null : S($cachedId);
#$peoples = null;
if (empty($peoples)) {
$peoples = D('Member')->where($map)->field('uid,reg_time,last_login_time')->order('last_login_time desc')->findPage(20);
$userConfigModel = D('Ucenter/UserConfig');
$titleModel = D('Ucenter/Title');
foreach ($peoples['data'] as &$v) {
$v['user'] = query_user(array('title', 'avatar128', 'nickname', 'uid', 'space_url', 'icons_html', 'score', 'title', 'fans', 'following', 'rank_link', 'is_following'), $v['uid']);
$v['level'] = $titleModel->getCurrentTitleInfo($v['uid']);
//获取用户封面id
$where = getUserConfigMap('user_cover', '', $v['uid']);
$where['role_id'] = 0;
$model = $userConfigModel;
$cover = $model->where($where)->find();
$v['cover_id'] = $cover['value'];
$v['cover_path'] = getThumbImageById($cover['value'], 273, 80);
}
$page <= $cachedPage && S($cachedId, $peoples, 300);
}
#dump($peoples);exit;
$this->assign('tab', 'index');
$this->assign('lists', $peoples);
$this->display();
}
示例10: doSupport
public function doSupport()
{
if (!is_login()) {
exit(json_encode(array('status' => 0, 'info' => '请登陆后再点赞。')));
}
$appname = I('POST.appname');
$table = I('POST.table');
$row = I('POST.row');
$message_uid = I('POST.uid');
$support['appname'] = $appname;
$support['table'] = $table;
$support['row'] = $row;
$support['uid'] = is_login();
if (D('Support')->where($support)->count()) {
exit(json_encode(array('status' => 0, 'info' => '您已经赞过,不能再赞了。')));
} else {
$support['create_time'] = time();
if (D('Support')->where($support)->add($support)) {
$user = query_user(array('username'));
if (I('POST.jump') == 'no') {
$jump = $_SERVER['HTTP_REFERER'];
//如果设置了jump=no,则默认使用引用页
} else {
$jump = U($appname . '/Index/' . $table . 'Detail', array('id' => $row));
//否则按照约定规则组合消息跳转页面。
}
D('Message')->sendMessage($message_uid, $user['username'] . '给您点了个赞。', $title = '收到一个赞', $jump, is_login());
exit(json_encode(array('status' => 1, 'info' => '感谢您的支持。')));
} else {
exit(json_encode(array('status' => 0, 'info' => '写入数据库失败。')));
}
}
}
示例11: localComment
/**
* @param $path string 例如 Travel/detail/12
* @param $uid int 评论给谁?
* @author caipeichao
*/
public function localComment($param)
{
$path = $param['path'];
//获取参数
$aPath = explode('/', $path);
$app = $aPath[0];
$mod = $aPath[1];
$row_id = $aPath[2];
$count = modC($mod . '_LOCAL_COMMENT_COUNT', 10, $app);
//调用接口获取评论列表
$list = $this->getCommentList($app, $mod, $row_id, 1, $count);
$total_count = $this->getCommentCount($app, $mod, $row_id);
//增加用户信息
foreach ($list as &$e) {
$e['user'] = query_user(array('uid', 'avatar32', 'nickname', 'space_url'), $e['uid']);
}
unset($e);
$pageCount = ceil($total_count / $count);
$pageHtml = getPageHtml('local_comment_page', $pageCount, array('app' => $app, 'mod' => $mod, 'row_id' => $row_id), 1);
//显示页面
$can_guest = modC($mod . '_LOCAL_COMMENT_CAN_GUEST', 1, $app);
$this->assign('can_guest', $can_guest);
$this->assign('pageHtml', $pageHtml);
$this->assign('list', $list);
$this->assign('total_count', $total_count);
$this->assign('count', $count);
$this->assign('app', $app);
$this->assign('mod', $mod);
$this->assign('row_id', $row_id);
$this->assign($param);
$this->assign('myInfo', query_user(array('avatar32', 'nickname', 'uid', 'space_url'), is_login()));
$this->display('comment');
}
示例12: doSupport
public function doSupport()
{
if (!is_login()) {
exit(json_encode(array('status' => 0, 'info' => '请登陆后再点赞。')));
}
$appname = I('POST.appname');
$table = I('POST.table');
$row = I('POST.row');
$aJump = I('POST.jump');
$message_uid = intval(I('POST.uid'));
$support['appname'] = $appname;
$support['table'] = $table;
$support['row'] = $row;
$support['uid'] = is_login();
if (D('Support')->where($support)->count()) {
exit(json_encode(array('status' => 0, 'info' => '您已经赞过,不能再赞了。')));
} else {
$support['create_time'] = time();
if (D('Support')->where($support)->add($support)) {
$this->clearCache($support);
$user = query_user(array('nickname'), get_uid());
D('Message')->sendMessage($message_uid, $title = $user['nickname'] . '赞了您。', $user['nickname'] . '给您点了个赞。', $aJump, array('id' => $row));
exit(json_encode(array('status' => 1, 'info' => '感谢您的支持。')));
} else {
exit(json_encode(array('status' => 0, 'info' => '写入数据库失败。')));
}
}
}
示例13: getAvatar
public function getAvatar($uid = 0, $size = 256)
{
$avatar = D('avatar')->where(array('uid' => $uid, 'status' => 1, 'is_temp' => 0))->find();
if ($avatar) {
if ($avatar['driver'] == 'local') {
$avatar_path = "/Uploads/Avatar" . $avatar['path'];
return $this->getImageUrlByPath($avatar_path, $size);
} else {
$new_img = $avatar['path'];
$name = get_addon_class($avatar['driver']);
if (class_exists($name)) {
$class = new $name();
if (method_exists($class, 'thumb')) {
$new_img = $class->thumb($avatar['path'], $size, $size);
}
}
return $new_img;
}
} else {
//如果没有头像,返回默认头像
if ($uid == session('temp_login_uid') || $uid == is_login()) {
$role_id = session('temp_login_role_id') ? session('temp_login_role_id') : get_role_id();
} else {
$role_id = query_user('show_role', $uid);
}
return $this->getImageUrlByRoleId($role_id, $size);
}
}
示例14: index
public function index()
{
$uid = is_login();
$user['user'] = query_user(array('nickname', 'avatar64'), $uid);
$this->assign('user', $user);
$this->display(T('Mob@UserMenu/index'));
}
示例15: Rank
public function Rank($param)
{
$getranktime = $this->getConfig();
$set_ranktime = $getranktime['ranktime'];
$y = date("Y", time());
$m = date("m", time());
$d = date("d", time());
$start_time = mktime($set_ranktime, 0, 0, $m, $d, $y);
$this->assign("ss", $start_time);
$rank = S('check_rank');
if (empty($rank)) {
$rank = D('Check_info')->where('ctime>' . $start_time)->order('ctime asc')->limit(5)->select();
S('check_rank', $rank, 60);
}
if (time() <= $start_time) {
$this->assign("time", $set_ranktime);
$this->display('default');
} else {
foreach ($rank as &$v) {
$v['userInfo'] = query_user(array('avatar32', 'space_url', 'username', 'uid'), $v['uid']);
}
//dump($rank);exit;
$this->assign("rank", $rank);
$this->display('rank');
}
}