本文整理汇总了PHP中getSubByKey函数的典型用法代码示例。如果您正苦于以下问题:PHP getSubByKey函数的具体用法?PHP getSubByKey怎么用?PHP getSubByKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSubByKey函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render1
public function render1($data)
{
$data['entity'] = M('store_entity')->find($data['info']['entity_id']);
$data['data'] = M('Data')->getByInfoId($data['info']['info_id']);
$data['user'] = M('User')->getUserInfo($data['info']['uid']);
$map['info_id'] = $data['info']['id'];
$m_com['condition'] = ORDER_CON_DONE;
$m_com['response_time'] = array('neq', 0);
$items = M('store_item')->where('good_id=' . $data['info']['info_id'])->findAll();
$ids = getSubByKey($items, 'order_id');
$ids_uni = array_unique($ids);
$m_com['order_id'] = array('in', implode(',', $ids_uni));
$data['info']['com'] = M('store_order')->where($m_com)->findPage(5);
foreach ($data['info']['com']['data'] as $k => $v) {
$data['info']['com']['data'][$k]['user'] = M('User')->getUserInfo($v['uid']);
}
$data['info']['data'] = M('Data')->getByInfoId($data['info']['info_id']);
$data['mid'] = $this->mid;
if ($data['entity']['name'] == 'shop') {
$content = $this->renderFile(dirname(__FILE__) . '/shop.html', $data);
} elseif ($data['entity']['name'] == 'good') {
$data['shop'] = M('Info')->getById($data['info']['shop_id']);
$content = $this->renderFile(dirname(__FILE__) . '/good.html', $data);
} else {
$content = $this->renderFile(dirname(__FILE__) . '/tpl.html', $data);
}
return $content;
}
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:28,代码来源:DefaultInfoTplWidget.class.php
示例2: appmessage
public function appmessage()
{
$db_prefix = C('DB_PREFIX');
$sql = "SELECT COUNT(appid) AS count,`appid`,`typename` FROM {$db_prefix}myop_myinvite WHERE `touid`={$this->mid} GROUP BY `appid`";
$res = M('')->query($sql);
$my_count = array();
foreach ($res as $v) {
$my_count[$v['appid']] = $v;
}
//$map['touid'] = $this->mid;
$res = M('myop_myinvite')->where($map)->order('appid DESC')->findPage('10');
unset($map);
// 将应用消息置为已读
$appids = getSubByKey($res['data'], 'id');
$map['touid'] = $this->mid;
$map['id'] = array('in', $appids);
M('myop_myinvite')->where($map)->setField('is_read', '1');
//修正邀请链接错误问题
foreach ($res['data'] as $k => $v) {
$myml = '';
$myml = $v['myml'];
$myml = str_ireplace(MYOP_URL, '', $myml);
$myml = str_ireplace('userapp.php', MYOP_URL . '/userapp.php', $myml);
$myml = preg_replace('/(invite[^\\"]*)/', '#', $myml);
$res['data'][$k]['myml'] = $myml;
}
$this->assign($res);
$this->setTitle(L('app_message'));
$this->display('appmessage');
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:30,代码来源:_MessageAction.class.php
示例3: getChannelList
/**
* 获取资源列表
* @param array $map 查询条件
* @return array 获取资源列表
*/
public function getChannelList($map)
{
// 获取资源分页结构
$data = $this->field('DISTINCT `feed_id`, `feed_channel_link_id`, `status`')->where($map)->order('`feed_channel_link_id` DESC')->findPage();
// 获取分享ID
$feedIds = getSubByKey($data['data'], 'feed_id');
// 获取分享分类频道信息
$cmap['c.feed_id'] = array('IN', $feedIds);
$categoryInfo = D()->table('`' . $this->tablePrefix . 'channel` AS c LEFT JOIN `' . $this->tablePrefix . 'channel_category` AS cc ON cc.channel_category_id = c.channel_category_id')->field('c.`feed_id`,c.`feed_channel_link_id`, c.`status`, cc.channel_category_id, cc.`title`')->where($cmap)->findAll();
$categoryInfos = array();
foreach ($categoryInfo as $val) {
$categoryInfos[$val['feed_id']][] = $val;
}
// 获取分享信息
$feedInfo = model('Feed')->getFeeds($feedIds);
$feedInfos = array();
foreach ($feedInfo as $val) {
$feedInfos[$val['feed_id']] = $val;
}
// 组装信息
foreach ($data['data'] as &$value) {
$value['uid'] = $feedInfos[$value['feed_id']]['user_info']['uid'];
$value['uname'] = $feedInfos[$value['feed_id']]['user_info']['uname'];
$value['content'] = $feedInfos[$value['feed_id']]['body'];
$value['categoryInfo'] = $categoryInfos[$value['feed_id']];
$value['app_row_id'] = $feedInfos[$value['feed_id']]['app_row_id'];
$value['app_row_table'] = $feedInfos[$value['feed_id']]['app_row_table'];
$value['app'] = $feedInfos[$value['feed_id']]['app'];
$value['type'] = $feedInfos[$value['feed_id']]['type'];
$value['is_repost'] = $feedInfos[$value['feed_id']]['is_repost'];
$value['digg_count'] = $feedInfos[$value['feed_id']]['digg_count'];
}
return $data;
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:39,代码来源:ChannelModel.class.php
示例4: render
/**
* 模板渲染
* @param array $data 相关数据
* @return string 图片内容渲染入口
*/
public function render($data)
{
// 设置频道模板
$template = empty($data['tpl']) ? 'hot' : t($data['tpl']);
// 配置参数
switch ($template) {
case 'hot':
$var['title'] = '推荐';
$var['list'] = $this->_getHostAlbum();
break;
case 'new':
$var['title'] = '最新上传的';
$var['list'] = $this->_getNewAlbum();
break;
case 'photo':
$var['albumId'] = intval($data['albumId']);
$var['uid'] = intval($data['uid']);
$var['list'] = $this->_getPhotoAlbum($var['albumId'], $var['uid']);
// 选中图片数目
$var['photoId'] = intval($data['photoId']);
$sort = getSubByKey($var['list'], 'id');
$var['checkNum'] = array_search($var['photoId'], $sort) + 1;
// 选择页数
$var['pageKey'] = ceil((array_search(intval($data['photoId']), $sort) + 1) / 9);
break;
}
// 如果数据为空
if (empty($var['list'])) {
return false;
}
$content = $this->renderFile(dirname(__FILE__) . "/" . $template . ".html", $var);
return $content;
}
开发者ID:yang7hua,项目名称:hunshe,代码行数:38,代码来源:AlbumListWidget.class.php
示例5: _getRelatedZhanggui
/**
* 获取用户的相关数据
*
* @param array $data
* 配置相关数据
* @return array 显示所需数据
*/
private function _getRelatedZhanggui($data)
{
// 用户ID
$var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid'];
// 显示相关人数
$var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4;
// 掌柜信息
$key = '_getRelatedZhanggui' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd');
$var['user'] = S($key);
if ($var['user'] === false || intval($_REQUEST['rel']) == 1) {
$sql = "SELECT uid FROM `ts_user_verified` WHERE usergroup_id=5 AND verified=1 order by rand() limit " . $var['limit'];
$list = M()->query($sql);
// dump($list);
$uids = getSubByKey($list, 'uid');
$userInfos = model('User')->getUserInfoByUids($uids);
$userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids);
foreach ($list as $v) {
$key = $v['uid'];
$arr[$key]['userInfo'] = $userInfos[$key];
$arr[$key]['followState'] = $userStates[$key];
$arr[$key]['info']['msg'] = '掌柜';
$arr[$key]['info']['extendMsg'] = '';
}
$var['user'] = $arr;
S($key, $var['user'], 86400);
// S ( 'now_'.$key, $var ['user'], 86400 );
}
// dump($var);
return $var;
}
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:37,代码来源:RelatedZhangguiWidget.class.php
示例6: searchRemark
/**
* 通过备注名搜索
*
* @param int $mid 用户id
* @param string $remark 备注名
* @return array
* @author Foreach <[email protected]>
**/
public function searchRemark($mid, $remark)
{
$rmap['mid'] = $mid;
$rmap['remark'] = array('LIKE', '%' . $remark . '%');
$ruid_arr = getSubByKey($this->where($rmap)->field('uid')->findAll(), 'uid');
return $ruid_arr;
}
开发者ID:medz,项目名称:thinksns-4,代码行数:15,代码来源:UserRemarkModel.class.php
示例7: _getRelatedDaren
/**
* 获取用户的相关数据
*
* @param array $data
* 配置相关数据
* @return array 显示所需数据
*/
private function _getRelatedDaren($data)
{
// 用户ID
$var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid'];
// 显示相关人数
$var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4;
// 收藏达人的信息
$key = '_getRelatedDaren' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd');
$var['user'] = S($key);
if ($var['user'] === false || intval($_REQUEST['rel']) == 1) {
$sql = "select * from \n\t\t\t(SELECT DISTINCT uid FROM `ts_user_data` WHERE `key`='collect_total_count' ORDER BY `value` DESC LIMIT 100) as t\n\t\t\torder by rand() limit " . $var['limit'];
$list = M()->query($sql);
$uids = getSubByKey($list, 'uid');
$userInfos = model('User')->getUserInfoByUids($uids);
$userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids);
foreach ($list as $v) {
$key = $v['uid'];
$arr[$key]['userInfo'] = $userInfos[$key];
$arr[$key]['followState'] = $userStates[$key];
$arr[$key]['info']['msg'] = '掌柜';
$arr[$key]['info']['extendMsg'] = '';
}
$var['user'] = $arr;
S($key, $var['user'], 86400);
}
return $var;
}
开发者ID:medz,项目名称:thinksns-4,代码行数:34,代码来源:RelatedDarenWidget.class.php
示例8: reply
public function reply()
{
if ($_POST) {
$d['attach_type'] = 'message_image';
$d['upload_type'] = 'image';
$info = model('Attach')->upload($d, $d);
$data['attach_ids'] = getSubByKey($info['info'], 'attach_id');
} else {
if (empty($this->data['id']) || empty($this->data['content'])) {
return false;
}
}
////隐私判断开始
$message['member'] = model('Message')->getMessageMembers(intval($this->data['id']), 'member_uid');
$message['to'] = array();
// 添加发送用户ID
foreach ($message['member'] as $v) {
$this->mid != $v['member_uid'] && ($message['to'][] = $v);
}
$UserPrivacy = model('UserPrivacy')->getPrivacy($this->mid, $message['to'][0]['user_info']['uid']);
if ($UserPrivacy['message'] != 0) {
return 0;
}
////隐私判断结束
return (int) model('Message')->replyMessage($this->data['id'], $this->data['content'], $this->mid, $data['attach_ids']);
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:26,代码来源:MessageApi.class.php
示例9: getUserList
public function getUserList($map = '', $show_dept = false, $show_user_group = false, $field = '*', $order = 'id ASC', $limit = 30)
{
$res = $this->where($map)->field($field)->order($order)->findPage($limit);
$uids = getSubByKey($res['data'], 'id');
//部门信息
if ($show_dept) {
$temp_dept = $this->getDepartmentByUser($uids);
//转换成array($uid => $dept)的格式
foreach ($temp_dept['data'] as $v) {
$dept[$v['uid']][] = $v;
}
unset($temp_dept);
//将部门信息添加至结果集
foreach ($res['data'] as $k => $v) {
$res['data'][$k]['department'] = isset($dept[$v['id']]) ? $dept[$v['id']] : array();
}
}
//用户组
if ($show_user_group) {
$temp_user_group = model('UserGroup')->getGroupByUser($uids);
//转换成array($uid => $user_group)的格式
foreach ($temp_user_group as $v) {
$user_group[$v['uid']][] = $v;
}
unset($temp_user_group);
//dump($res['data']);exit;
//将用户组信息添加至结果集
foreach ($res['data'] as $k => $v) {
$res['data'][$k]['user_group'] = isset($user_group[$v['id']]) ? $user_group[$v['id']] : array();
}
}
return $res;
}
开发者ID:laiello,项目名称:thinksns-2,代码行数:33,代码来源:User2Model.class.php
示例10: getWidget
public function getWidget($id = null, $pid = null)
{
if (isset($id)) {
if (is_array($id)) {
$map['id'] = array('in', $id);
} else {
$map['id'] = $id;
}
}
$data = $this->where($map)->findAll();
$field = getSubByKey($data, 'field');
$posterData = M('poster')->field($field)->where('id=' . $pid)->find();
foreach ($data as &$value) {
$value['data'] = stripslashes($value['data']);
$value['data'] = unserialize($value['data']);
if ($value['widget'] == 'CheckBox' || $value['widget'] == 'Radio') {
$poster = $posterData[$value['field']];
$poster = preg_replace("'([\r\n])[\\s]+'", "", $poster);
$poster = explode(',', $poster);
$value['data'] = preg_replace("'([\r\n])[\\s]+'", "", $value['data']);
$validData = array();
if (isset($pid)) {
foreach ($value['data'] as &$val) {
$val = str_replace("[selected]", "", $val);
if (in_array($val, $poster)) {
$val = $val . '[selected]';
}
}
}
} else {
$value['data'] = $posterData[$value['field']];
}
}
return $data;
}
开发者ID:lyhiving,项目名称:icampus,代码行数:35,代码来源:PosterWidgetModel.class.php
示例11: index
/**
* 频道首页页面
* @return void
*/
public function index()
{
// 添加样式
$this->appCssList[] = 'channel.css';
// 获取频道分类列表
$channelCategory = model('CategoryTree')->setTable('channel_category')->getCategoryList();
$this->assign('channelCategory', $channelCategory);
// 频道分类选中
$cid = intval($_GET['cid']);
$channelConf = model('Xdata')->get('channel_Admin:index');
if (empty($cid)) {
$cid = $channelConf['default_category'];
}
$this->assign('cid', $cid);
// 获取模板样式
$templete = t($_GET['tpl']);
if (empty($templete) || !in_array($templete, array('load', 'list'))) {
$categoryConf = model('CategoryTree')->setTable('channel_category')->getCatgoryConf($cid);
$templete = empty($categoryConf) ? $channelConf['show_type'] == 1 ? 'list' : 'load' : ($categoryConf['show_type'] == 1 ? 'list' : 'load');
}
$this->assign('tpl', $templete);
// 设置页面信息
$titleHash = model('CategoryTree')->setTable('channel_category')->getCategoryHash();
$title = empty($cid) ? '频道首页' : $titleHash[$cid];
$this->setTitle($title);
$this->setKeywords($title);
$this->setDescription(implode(',', getSubByKey($channelCategory, 'title')));
$this->display();
}
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:33,代码来源:IndexAction.class.php
示例12: doSearchTag
function doSearchTag($k)
{
global $ts;
$keyinfo = M('tag')->where("tag_name='{$k}'")->find();
if ($keyinfo && $k) {
$list = $this->where("tag_id=" . $keyinfo['tag_id'])->field('uid')->findPage();
$uids = getSubByKey($list['data'], 'uid');
/*
* 缓存用户的资料, 粉丝数, 关注数, Tag列表
*/
$user_model = D('User', 'home');
$user_count_model = model('UserCount');
$user_model->setUserObjectCache($uids);
$user_count_model->setUserFollowerCount($uids);
$user_count_model->setUserFollowingCount($uids);
$this->setUserTagObjectCache($uids);
foreach ($list['data'] as $k => $v) {
$list['data'][$k]['user'] = $user_model->getUserByIdentifier($v['uid']);
$list['data'][$k]['taglist'] = $this->getUserTagList($v['uid']);
$list['data'][$k]['following'] = $user_count_model->getUserFollowingCount($v['uid']);
$list['data'][$k]['follower'] = $user_count_model->getUserFollowerCount($v['uid']);
$list['data'][$k]['followState'] = getFollowState($ts['user']['uid'], $v['uid']);
}
} else {
$list['count'] = 0;
}
return $list;
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:28,代码来源:UserTagModel.class.php
示例13: adddel
function adddel($table, $field)
{
$sql = "SELECT * FROM {$this->db1}.`{$table}`";
$list1 = M()->query($sql);
$arr1 = getSubByKey($list1, $field);
// dump ( $arr1 );
$sql = "SELECT * FROM {$this->db2}.`{$table}`";
$list2 = M()->query($sql);
$arr2 = getSubByKey($list2, $field);
// dump ( $arr2 );
$add_arr = array_diff($arr1, $arr2);
// dump ( $add_arr );
$del_arr = array_diff($arr2, $arr1);
// dump ( $del_arr );
foreach ($list1 as $key => $value) {
unset($value['id']);
if (in_array($value[$field], $add_arr)) {
$fields = array_keys($value);
$fields = '`' . implode('`,`', $fields) . '`';
$val = "'" . implode("','", $value) . "'";
echo "INSERT INTO {$table} ({$fields}) VALUES ({$val});<br/>";
}
if (in_array($value[$field], $del_arr)) {
echo "DELETE FROM {$table} WHERE `{$field}`='{$value[$field]}';<br/>";
}
}
}
开发者ID:pondyond,项目名称:WeiPHP,代码行数:27,代码来源:ToolController.class.php
示例14: hasPopedom
/**
* 检查给定用户是否拥有给定节点的权限
*
* @param int $uid 用户ID(默认当前用户)
* @param string $node 节点, 格式为"APP_NAME/MOD_NAME/ACT_NAME"(默认当前节点)
* @param bool $has_admin_popedom 当没有设置admin节点权限时的是否默认拥有admin权限 ( true:有权限 false:没有权限 )
*/
public function hasPopedom($uid = null, $node = null, $has_admin_popedom = true)
{
global $ts;
$uid = isset($uid) ? intval($uid) : $_SESSION['mid'];
// 超级管理员拥有所有权限
if ($uid == $_SESSION['mid'] && $_SESSION['userInfo']['admin_level'] == '1') {
return true;
}
$node = isset($node) ? explode('/', $node) : array($ts['_app'], $ts['_mod'], $ts['_act']);
$app = $node[0];
$mod = $node[1];
$act = $node[2];
unset($node);
//获取有权限查看此节点的用户组ID
$prefix = C('DB_PREFIX');
$where = "n.app_name='{$app}' AND ( ( n.mod_name='{$mod}' AND ( n.act_name='{$act}' OR n.act_name='*' ) ) OR n.mod_name='*' )";
$sql = "SELECT p.user_group_id FROM {$prefix}node AS n INNER JOIN {$prefix}user_group_popedom AS p ON n.node_id = p.node_id WHERE {$where}";
$gid = M('')->query($sql);
$gid = getSubByKey($gid, 'user_group_id');
if (empty($gid)) {
return $has_admin_popedom ? true : $app != 'admin';
} else {
// 检查用户是否有权限
return model('UserGroup')->isUserInUserGroup($uid, $gid);
}
}
开发者ID:laiello,项目名称:thinksns-2,代码行数:33,代码来源:SystemPopedomService.class.php
示例15: lists
function lists()
{
$addon_list = D('Home/Addons')->getWeixinList(true);
foreach ($addon_list as $v) {
$all_ids[] = $v['id'];
$nameArr[$v['id']] = $v['title'];
}
$model = $this->getModel($this->table);
$map['mp_id'] = intval($_GET['mp_id']);
if (!empty($_GET['title'])) {
$title = I('get.title');
$where = "nickname like '%{$title}%'";
$uids = M('member')->where($where)->field('uid')->select();
$uids = getSubByKey($uids, 'uid');
$uids[] = 0;
$map['uid'] = array('in', $uids);
}
session('common_condition', $map);
$list_data = $this->_get_model_list($model);
foreach ($list_data['list_data'] as &$vo) {
$vo['addon_status'] = explode(',', $vo['addon_status']);
$vo['addon_status'] = array_diff($all_ids, $vo['addon_status']);
$vo['addon_status'] = $this->_idToName($vo['addon_status'], $nameArr);
}
$this->assign($list_data);
// dump($list_data);
$this->assign('add_url', U('add?model=' . $model['id'] . '&mp_id=' . $map['mp_id']));
$this->assign('search_url', U('lists?model=' . $model['id'] . '&mp_id=' . $map['mp_id']));
// $this->assign ( 'search_button', false );
$this->display('Think:lists');
}
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:31,代码来源:PublicLinkController.class.php
示例16: index
/**
* 帮助中心首页
* @return void
*/
public function index(){
// 添加样式
$this->appCssList[] = 'help.css';
// 获取帮助列表
$helpCategory = model('CategoryTree')->setTable('help_category')->getCategoryList();
$this->assign('helpCategory',$helpCategory);
// 帮助分类选中
$cid = intval($_GET['cid']);
$index = false;
if (empty($_GET['cid'])){
$index = true;
}
$categoryIds = getSubByKey($helpCategory,'help_category_id');
if (!in_array($cid,$categoryIds) && !empty($cid)){
$this->error('您请求的帮助页面已不存在');
return false;
}
$this->assign('isIndex',$index);
$this->assign('cid',$cid);
$masterCate = getMasterCategories();
$this->assign('masterCate',$masterCate);
$titleHash = model('CategoryTree')->setTable('help_category')->getCategoryHash();
$title = empty($cid) ? "帮助中心首页" : $titleHash[$cid];
$this->setTitle($title);
$this->setKeywords($title);
$this->setDescription(implode(',',getSubByKey($helpCategory,'title')));
$this->display();
}
开发者ID:CaliProject,项目名称:thinksns,代码行数:34,代码来源:IndexAction.class.php
示例17: lists
function lists()
{
//查询数据
$map['token'] = get_token();
$map['uid'] = $this->getUid();
$name = 'credit_data';
$page = I('p', 1, 'intval');
// 默认显示第一页数据
$row = 50;
$data = M($name)->where($map)->order('id DESC')->page($page, $row)->select();
// 获取相关的用户信息
$names = getSubByKey($data, 'credit_name');
$names = array_filter($names);
$names = array_unique($names);
if (!empty($names)) {
$cond['name'] = array('in', $names);
$credit_config = M('credit_config')->distinct(true)->where($cond)->field('name,title')->select();
foreach ($credit_config as $cc) {
$cnames[$cc['name']] = $cc;
}
foreach ($data as &$vo) {
$vo['title'] = $cnames[$vo['credit_name']]['title'];
}
}
$this->assign('list_data', $data);
$this->meta_title = '积分明细';
$this->assign('total', $this->getScore());
//$this->display ( T ( 'Addons://ScoreDetail@ScoreDetail/lists' ) );
$this->display();
}
开发者ID:cnspica,项目名称:weilian,代码行数:30,代码来源:ScoreDetailController.class.php
示例18: doInstallMadel
public function doInstallMadel()
{
$_GET['path_name'] = t($_GET['path_name']);
$info = $this->__getPluginInfo('Medal/' . t($_GET['path_name']));
if (!$info) {
$this->error('未找到安装信息');
} else {
// 检查是否已安装
$installed = model('Medal')->getInstalledMedal();
$installed = getSubByKey($installed, 'path_name');
if (in_array($_GET['path_name'], $installed)) {
$this->error('该勋章已安装');
}
$info['is_active'] = 1;
$info['ctime'] = time();
if ($medal_id = M('medal')->add($info)) {
// 为排序方便,设置 display_order = medal_id
M('medal')->where('`medal_id`=' . $medal_id)->setField('display_order', $medal_id);
$this->assign('jumpUrl', U('admin/Plugin/installMedal'));
$this->success('安装成功');
} else {
$this->error('安装失败');
}
}
}
开发者ID:laiello,项目名称:thinksns-2,代码行数:25,代码来源:PluginAction.class.php
示例19: dataProcess
private function dataProcess($userInfoList)
{
$fieldList = $this->data_field();
foreach ($userInfoList as $value) {
if ($value['type'] == 'info') {
$database[$value['module']] = unserialize($value['data']);
} else {
$data['profile']['list'][] = array_merge(array('module' => $value['module'], 'id' => $value['id']), unserialize($value['data']));
}
}
$data['profile']['completeness'] = round(count(array_unique(getSubByKey($data['profile']['list'], 'module'))) / 2, 2) * 100;
foreach ($fieldList as $key => $value) {
foreach ($value as $k => $v) {
$t = $database[$key][$k];
if ($t) {
$complete++;
}
$data[$key]['list'][] = array('field' => $k, 'name' => $v, 'value' => $t);
}
$data[$key]['completeness'] = round($complete / count($value), 2) * 100;
unset($complete);
}
unset($userInfoList);
unset($fieldList);
unset($database);
return $data;
}
开发者ID:laiello,项目名称:thinksns-2,代码行数:27,代码来源:UserProfileModel.class.php
示例20: _getRelatedDaren
/**
* 获取用户的相关数据
*
* @param array $data
* 配置相关数据
* @return array 显示所需数据
*/
private function _getRelatedDaren($data)
{
// 用户ID
$var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid'];
// 显示相关人数
$var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4;
if (!empty($data['weibaid'])) {
$weibaid = intval($data['weibaid']);
}
$var['weibaid'] = isset($data['weibaid']) ? intval($data['weibaid']) : 0;
// 收藏达人的信息
$key = '_getWeibaDaren' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd') . '_' . $weibaid;
$var['user'] = S($key);
if ($var['user'] === false || intval($_REQUEST['rel']) == 1) {
$uidlist = M('user_group_link')->where('user_group_id=7')->limit(1000)->select();
$map['follower_uid'] = array('in', getSubByKey($uidlist, 'uid'));
if ($data['weibaid']) {
$map['weiba_id'] = $weibaid;
}
$list = M('weiba_follow')->where($map)->group('follower_uid')->limit($var['limit'])->select();
$uids = getSubByKey($list, 'follower_uid');
$userInfos = model('User')->getUserInfoByUids($uids);
$userStates = model('Follow')->getFollowStateByFids($GLOBALS['ts']['mid'], $uids);
foreach ($list as $v) {
$key = $v['follower_uid'];
$arr[$key]['userInfo'] = $userInfos[$key];
$arr[$key]['followState'] = $userStates[$key];
$arr[$key]['info']['msg'] = '掌柜';
$arr[$key]['info']['extendMsg'] = '';
}
$var['user'] = $arr;
S($key, $var['user'], 86400);
}
return $var;
}
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:42,代码来源:WeibaDarenWidget.class.php
注:本文中的getSubByKey函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论