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; }
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; }
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; }
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'); } }
/** * @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'); }
/** * @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'); }
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)); } }
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(); }
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(); }
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' => '写入数据库失败。'))); } } }
/** * @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'); }
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' => '写入数据库失败。'))); } } }
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); } }
public function index() { $uid = is_login(); $user['user'] = query_user(array('nickname', 'avatar64'), $uid); $this->assign('user', $user); $this->display(T('Mob@UserMenu/index')); }
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'); } }
function getById($id) { $shop = $this->find($id); if ($shop) { $shop['user'] = query_user(array('nickname', 'space_url', 'avatar64', 'avatar128', 'avatar32'), $shop['uid']); } return $shop; }
public function getdetail($map) { $data = $this->alias('a')->field('a.title,a.uid,a.content,a.policy,a.identity,a.sTime,a.eTime,b.nickname')->join('__MEMBER__ b on a.uid = b.uid', 'left')->where($map)->find(); if ($data) { $data['avatar'] = query_user('avatar64', $data['uid']); } return $data; }
public function lists($dynamic_id = '') { $dynamic = M('Mob/GroupDynamic')->getDynamic($dynamic_id); $user = query_user(array('avatar128', 'avatar64', 'nickname', 'uid', 'space_mob_url'), $dynamic['uid']); $this->assign('dynamic', $dynamic); $this->assign('user', $user); $this->display('Widget/dynamic'); }
/** * 获取指定游戏的相关信息 * * @param array $map * 查询条件 * @return array 指定游戏的相关信息 */ private function _getMemberInfo($map, $field = "*") { $member = $this->where($map)->field($field)->find(); $memberinfo = query_user(array('avatar', 'username', 'real_name'), $member['uid']); $member = array_merge($member, $memberinfo); S('team_member_info_' . $member['id'], $member, 86400); return $member; }
public function getSupportedUser($app, $table, $row, $user_fields = array('nickname', 'space_url', 'avatar128'), $num = 10) { $supported = $this->where(array('appname' => $app, 'table' => $table, 'row' => $row))->findPage($num); foreach ($supported['data'] as &$v) { $v['user'] = query_user($user_fields, $v['uid']); } unset($v); return $supported; }
private function change_avatar() { $aUid = session('temp_login_uid'); if (empty($aUid)) { $this->error(L('_ERROR_PARAM_')); } $this->assign('user', query_user(array('avatar128'))); $this->assign('uid', $aUid); }
/** * 获取支持用户 * @param $map * @return array|null * @author 郑钟良<*****@*****.**> */ public function getSupportUsers($map) { $uids = $this->where($map)->field('uid')->order('id asc')->limit(10)->select(); $users = array(); foreach ($uids as $val) { $users[] = query_user(array('uid', 'nickname', 'space_url'), $val['uid']); } return $users; }
protected function user_info() { $user_info = query_user(array('avatar128', 'nickname', 'uid', 'mobile')); $broker = D('broker')->alias('a')->where(array('a.uid' => is_login()))->field('a.identity,a.pid,b.nickname as pid_name')->join('__BROKER__ c on a.pid = c.id', 'left')->join('__MEMBER__ b on c.uid = b.uid', 'left')->find(); $user_info['identity'] = $broker['identity']; $user_info['pid'] = $broker['pid']; $user_info['pid_name'] = $broker['pid_name']; session('user_info', $user_info); return $user_info; }
public function index($uid = null) { //调用API获取基本信息 $user = query_user(array('nickname', 'email', 'mobile', 'last_login_time', 'last_login_ip', 'score', 'reg_time', 'title', 'avatar256', 'rank_link'), $uid); //显示页面 $this->defaultTabHash('index'); $this->assign('user', $user); $this->assign('call', $this->getCall($uid)); $this->display('basic'); }
protected function _initialize() { /* 读取站点配置 */ $config = api('Config/lists'); C($config); //添加配置 if (!C('WEB_SITE_CLOSE') && $_SESSION[C('USER_AUTH_KEY')] != 1) { $this->error('站点已经关闭,请稍后访问~', '', 1000); } $a = D('Member')->need_login(); $field = array('uid', 'username', 'nickname', 'name', 'email', 'space_url', 'reg_time', 'last_login_time', 'signature', 'avatar32', 'avatar64', 'avatar128', 'avatar256'); $userinfo = query_user($field, $_SESSION['cs_home']['user_auth']['uid']); $roleauth = getmroleauth(); checkscore($_SESSION['cs_home']['user_auth']['uid']); $mymail['status'] = 1; $mymail['is_read'] = 0; $mymail['to_uid'] = $_SESSION['cs_home']['user_auth']['uid']; $mymailcount = M('Message')->where($mymail)->count(); $userinfo['mymailcount'] = empty($mymailcount) ? '' : $mymailcount; $isadmin = is_admin($_SESSION['cs_home']['user_auth']['uid']); $this->assign('isadmin', $isadmin); $this->assign('user_auth', session('user_auth')); $this->assign('uid', getnowUid()); $this->assign('userinfo', $userinfo); $this->assign('roleauth', $roleauth); //得到会员组权限 $cname = strtolower(CONTROLLER_NAME); $aname = strtolower(ACTION_NAME); $this->assign('aname', $aname); $this->assign('cname', $cname); $cate = new CategoryApi(); $clist = $cate->get_catelist(0); $clistnum = $cate->get_editcnum(); $this->assign('clist', $clist); $nosigncate = M('Cate')->where(array('status' => 1, 'type' => 1))->select(); $m = D('cate'); $catelist = $m->field('*,CONCAT(spid,id) as path2')->where(array('type' => 1, 'status' => 1))->order('path2')->select(); $t = new tree(); $catelistarr = $t->unlimitCategoryFormat($catelist); $catehtml = $t->treeFormat($catelistarr); $this->assign('catehtml', $catehtml); $this->assign('nosigncate', $nosigncate); $this->assign('clistnum', $clistnum); $nav = D('nav')->where(array('status' => 1))->order('sort desc')->select(); foreach ($nav as $key => $vo) { $nav[$key]['url'] = navurl($vo['id'], $vo['type']); $nav[$key]['active'] = navactive($vo['id'], $vo['type']); if ($vo['win']) { $nav[$key]['target'] = '_blank'; } else { $nav[$key]['target'] = '_self'; } } $this->assign('nav', $nav); }
/** * 获取数据详情 * @param unknown $id * @return Ambigous <mixed, \Think\mixed, object> */ public function getAtlas($id) { $id = intval($id); $atlas = S('atlas_' . $id); if (empty($atlas)) { $atlas = D('Atlas')->where(array('status' => 1, 'id' => $id))->find(); $atlas['user'] = query_user(array('avatar128', 'avatar64', 'nickname', 'uid', 'space_url', 'icons_html'), $atlas['uid']); S('atlas_' . $id, $atlas, 300); } return $atlas; }
/** * fetchRepost 渲染转发轻博客 * @param $weibo * @return string * @author:xjw129xjt(肖骏涛) xjt@ourstu.com */ public function fetchRepost($weibo) { $weibo_data = unserialize($weibo['data']); $weibo_data['attach_ids'] = explode(',', $weibo_data['attach_ids']); $source_weibo = M('Mob/Weibo')->getWeiboDetail($weibo_data['sourceId']); $source_weibo['user'] = query_user(array('uid', 'nickname', 'avatar32', 'space_url', 'rank_link', 'title'), $source_weibo['uid']); $param['weibo'] = $weibo; $param['weibo']['source_weibo'] = $source_weibo; $this->assign($param); return $this->fetch(T('Application://Mob@Type/fetchrepost')); }
function getList($map = '', $num = 10, $order = 'create_time desc') { $rec = $this->where($map)->order($order)->findPage($num); foreach ($rec['data'] as $key => $v) { $rec['data'][$key]['user'] = query_user(array('nickname', 'space_url', 'avatar64'), $v['send_uid']); $rec['data'][$key]['rec_user'] = query_user(array('nickname', 'space_url', 'avatar64'), $v['rec_uid']); $rec['data'][$key]['s_info'] = D('Info')->getById($v['s_info_id']); $rec['data'][$key]['info'] = D('Info')->getById($v['info_id']); } return $rec; }
public function getLZLReplyList($to_f_reply_id, $order, $page = 1, $limit = 3) { $list = M('GroupLzlReply')->where('status=1 and to_f_reply_id=' . $to_f_reply_id)->order($order)->select(); foreach ($list as $k => &$v) { $v['userInfo'] = query_user(array('avatar128', 'nickname', 'uid', 'space_url'), $v['uid']); $v['content'] = parse_weibo_mobile_content($v['content']); } unset($v); $list = getPage($list, $limit, $page); return $list; }
public function getFollowing($uid, $page, $fields, &$totalCount) { $map['who_follow'] = $uid; $fans = $this->where($map)->field('follow_who')->order('create_time desc')->page($page, 10)->select(); $totalCount = $this->where($map)->field('follow_who')->order('create_time desc')->count(); foreach ($fans as &$user) { $user['user'] = query_user($fields, $user['follow_who']); } unset($user); return $fans; }