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 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($uid = null, $tab = 'weibo') { if (empty($uid)) { $uid = is_login(); } else { $uid = $uid; } $user_info = query_user(array('avatar64', 'nickname', 'uid', 'space_url', 'space_mob_url', 'icons_html', 'score', 'title', 'fans', 'following', 'weibocount', 'rank_link', 'signature'), $uid); //获取用户封面id $map = getUserConfigMap('user_cover', '', $uid); $map['role_id'] = 0; $model = D('Ucenter/UserConfig'); $cover = $model->findData($map); $user_info['cover_id'] = $cover['value']; if (empty($cover['value'])) { $user_info['cover_path'] = ""; } else { $user_info['cover_path'] = getThumbImageById($cover['value'], 1140, 230); } $user_info['tags'] = D('Ucenter/UserTagLink')->getUserTag($uid); switch ($tab) { case 'weibo': $weibo = $this->_myWeibo($uid); $this->assign("weibo", $weibo); $this->assign("uid", $uid); break; case 'news': $blog = $this->_myBlog($uid); $this->assign("blog", $blog); $this->assign("uid", $uid); break; case 'userhead': $userhead = $this->_userHead($uid); $this->assign("userhead", $userhead); break; case 'userdata': $userdata = $this->_userData($uid); $profile_group_list = $this->_profile_group_list($uid); foreach ($profile_group_list as &$val) { $val['info_list'] = $this->_info_list($val['id'], $uid); } // dump($profile_group_list);exit; $this->assign('profile_group_list', $profile_group_list); $this->assign("userdata", $userdata); break; case 'focus': $following = $this->_myFocus($uid); $this->assign("following", $following); break; } $this->setTopTitle('个人中心'); // dump($user_info); $this->assign("uid", $uid); $this->assign('user_info', $user_info); $this->display(); }
private function userInfo($uid = null) { $user_info = query_user(array('avatar128', 'nickname', 'uid', 'space_url', 'score', 'title', 'fans', 'following', 'weibocount', 'rank_link', 'signature'), $uid); //获取用户封面id $map = getUserConfigMap('user_cover', '', $uid); $map['role_id'] = 0; $model = D('Ucenter/UserConfig'); $cover = $model->findData($map); $user_info['cover_id'] = $cover['value']; $user_info['cover_path'] = getThumbImageById($cover['value'], 1140, 230); $user_info['tags'] = D('Ucenter/UserTagLink')->getUserTag($uid); $this->assign('user_info', $user_info); return $user_info; }
/** * 获取用户插件信息 * @return mixed * @author 郑钟良<*****@*****.**> */ function getUserConfig() { $UserConfig = S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role()); if (!$UserConfig) { $map = getUserConfigMap(USER_CONFIG_MARK_NAME, USER_CONFIG_MARK_MODEL); $skin = M('UserConfig')->where($map)->getField('value'); if (!$skin) { $UserConfig = getAddonConfig(); $UserConfig['skin'] = $UserConfig['defaultSkin']; } else { $UserConfig['skin'] = $skin; } S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role(), $UserConfig, 600); } return $UserConfig; }
/** * 保存个人换肤设置 */ public function save() { $aSkin = I('post.skin', '', 'op_t'); $aSet_default = I('post.set_default', 0, 'intval'); $msg['status'] = 0; $map = getUserConfigMap(USER_CONFIG_MARK_NAME, USER_CONFIG_MARK_MODEL); $UserConfigModel = M('UserConfig'); $exit = $UserConfigModel->where($map)->count(); if ($aSet_default) { //设为默认 if ($exit) { //0为不存在了,1为存在 $result = $UserConfigModel->where($map)->delete(); } else { $result = 1; } $msg['defaultSkin'] = getAddonConfig(); $msg['defaultSkin'] = $msg['defaultSkin']['defaultSkin']; } else { if ($aSkin == '' || $aSkin == null) { $msg['info'] = '未选择皮肤'; $this->ajaxReturn($msg); } $map_change = $map; //$map_change是判断配置信息是否修改时的查询条件 $map_change['value'] = $aSkin; if ($exit) { $changed = $UserConfigModel->where($map_change)->count(); if ($changed) { //0为修改了,1为未修改 $result = 1; } else { $result = $UserConfigModel->where($map)->setField('value', $aSkin); } } else { $result = $UserConfigModel->add($map_change); } } if ($result) { S('SKIN_USER_CONFIG_' . is_login() . '_' . get_login_role(), null); $msg['status'] = 1; $msg['info'] = '设置成功'; } else { $msg['info'] = '设置失败'; } $this->ajaxReturn($msg); }
/** * 用户修改封面 * @author 郑钟良<*****@*****.**> */ public function changeCover() { if (!is_login()) { $this->error(L('_ERROR_NEED_LOGIN_') . L('_EXCLAMATION_')); } if (IS_POST) { $aCoverId = I('post.cover_id', 0, 'intval'); $result['status'] = 0; if ($aCoverId <= 0) { $result['info'] = L('_ERROR_ILLEGAL_OPERATE_') . L('_EXCLAMATION_'); $this->ajaxReturn($result); } $data = getUserConfigMap('user_cover'); $data['role_id'] = 0; $model = M('Ucenter/UserConfig'); $already_data = $model->findData($data); if (!$already_data) { $data['value'] = $aCoverId; $res = $model->addData($data); } else { if ($already_data['value'] == $aCoverId) { $result['info'] = L('_ALTER_NOT_') . L('_EXCLAMATION_'); $this->ajaxReturn($result); } else { $res = $model->saveValue($data, $aCoverId); } } if ($res) { $result['status'] = 1; $result['path_1140'] = getThumbImageById($aCoverId, 1140, 230); $result['path_273'] = getThumbImageById($aCoverId, 273, 70); } else { $result['info'] = L('_FAIL_OPERATE_') . L('_EXCLAMATION_'); } $this->ajaxReturn($result); } else { //获取用户封面id $map = getUserConfigMap('user_cover'); $map['role_id'] = 0; $model = M('Ucenter/UserConfig'); $cover = $model->findData($map); $my_cover['cover_id'] = $cover['value']; $my_cover['cover_path'] = getThumbImageById($cover['value'], 348, 70); $this->assign('my_cover', $my_cover); $this->display('_change_cover'); } }
/** * 用户修改封面 * @author 郑钟良<*****@*****.**> */ public function changeCover() { if (!is_login()) { $this->error('需要登录!'); } if (IS_POST) { $aCoverId = I('post.cover_id', 0, 'intval'); $result['status'] = 0; if ($aCoverId <= 0) { $result['info'] = '非法操作!'; $this->ajaxReturn($result); } $data = getUserConfigMap('user_cover'); $data['role_id'] = 0; $model = D('Ucenter/UserConfig'); $already_data = $model->findData($data); if (!$already_data) { $data['value'] = $aCoverId; $res = $model->addData($data); } else { if ($already_data['value'] == $aCoverId) { $result['info'] = '没有修改!'; $this->ajaxReturn($result); } else { $res = $model->saveValue($data, $aCoverId); } } if ($res) { $result['status'] = 1; $result['path_1140'] = getThumbImageById($aCoverId, 1140, 230); $result['path_273'] = getThumbImageById($aCoverId, 273, 70); } else { $result['info'] = '操作失败!'; } $this->ajaxReturn($result); } else { //获取用户封面id $map = getUserConfigMap('user_cover'); $map['role_id'] = 0; $model = D('Ucenter/UserConfig'); $cover = $model->findData($map); $my_cover['cover_id'] = $cover['value']; $my_cover['cover_path'] = getThumbImageById($cover['value'], 348, 70); $this->assign('my_cover', $my_cover); $this->display('_change_cover'); } }