本文整理汇总了PHP中member::getMemberById方法的典型用法代码示例。如果您正苦于以下问题:PHP member::getMemberById方法的具体用法?PHP member::getMemberById怎么用?PHP member::getMemberById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类member
的用法示例。
在下文中一共展示了member::getMemberById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOftenById
public function getOftenById($member_id, $source = "", $con = "")
{
if (empty($member_id)) {
return false;
}
$cond = '';
if ($source) {
$cond = " AND source='" . $source . "' ";
}
$sql = "SELECT * FROM " . DB_PREFIX . "visit WHERE 1 " . $cond . " AND user_id=" . $member_id . " ORDER BY num DESC" . $con;
$q = $this->db->query($sql);
$member_id = $action_id = $team_id = $topic_id = '';
$member_space = $action_space = $team_space = $topic_space = '';
$info = array();
while ($row = $this->db->fetch_array($q)) {
switch ($row['source']) {
case 'user':
$member_id .= $member_space . $row['cid'];
$member_space = ",";
break;
case 'action':
$action_id .= $action_space . $row['cid'];
$action_space = ",";
break;
case 'team':
$team_id .= $team_space . $row['cid'];
$team_space = ",";
break;
case 'topic':
$topic_id .= $topic_space . $row['cid'];
$topic_space = ",";
break;
default:
break;
}
$info[] = array('id' => $row['id'], 'source' => $row['source'], 'cid' => $row['cid'], 'visit_time' => $row['visit_time']);
}
$member_info = $action_info = $team_info = $topic_info = array();
if (!empty($member_id)) {
include_once ROOT_PATH . 'lib/class/member.class.php';
$obj_member = new member();
$data = $obj_member->getMemberById($member_id);
$member_info = $data[0];
}
if (!empty($action_id)) {
include_once ROOT_PATH . 'lib/class/activity.class.php';
$obj_activity = new activityCLass();
$data = $obj_activity->show($action_id);
$action_info = $data['data'];
}
if (!empty($team_id)) {
include_once ROOT_PATH . 'lib/class/team.class.php';
$obj_team = new team();
$data = $obj_team->get_team_by_id($team_id);
$team_info = $data[0];
}
if (!empty($topic_id)) {
include_once ROOT_PATH . 'lib/class/team.class.php';
$obj_team = new team();
$data = $obj_team->get_topic_by_id($topic_id);
$topic_info = $data[0];
}
//
foreach ($info as $k => $v) {
switch ($v['source']) {
case 'user':
if (empty($member_info[$v['cid']])) {
unset($info[$k]);
} else {
$info[$k]['data'] = $member_info[$v['cid']];
}
break;
case 'action':
if (empty($action_info[$v['cid']])) {
unset($info[$k]);
} else {
$info[$k]['data'] = $action_info[$v['cid']];
}
break;
case 'team':
if (empty($team_info[$v['cid']])) {
unset($info[$k]);
} else {
$info[$k]['data'] = $team_info[$v['cid']];
}
break;
case 'topic':
if (empty($topic_info[$v['cid']])) {
unset($info[$k]);
} else {
$info[$k]['data'] = $topic_info[$v['cid']];
}
break;
default:
break;
}
}
return $info;
}
示例2: get_read
public function get_read()
{
$count = intval($this->input['count']) ? intval($this->input['count']) : 0;
$page = intval($this->input['pp'] ? $this->input['pp'] : 0);
$end = "";
$offset = $page * $count;
$user_id = intval($this->input['user_id']);
$type = trim($this->input['type']);
if (!$user_id) {
return;
}
//获得已读信息,-1获取该用户全部的已读信息,否则按照类型获取已读信息
$extra = '';
if ($type > 0) {
$extra = " AND type = '" . $type . "'";
}
if ($type != 0) {
$extra .= " AND member_id=" . $user_id;
}
$sql = "SELECT * FROM " . DB_PREFIX . "notify WHERE is_read = 1" . $extra;
$q = $this->db->query($sql);
$info = array();
$from_id = array();
while ($row = $this->db->fetch_array($q)) {
$from_id[] = $row['from_id'];
// $row['content'] = unserialize($row['content']);
$info[] = $row;
}
$from_id = array_unique($from_id);
$user_id = implode(',', $from_id);
include_once ROOT_PATH . 'lib/class/member.class.php';
$member_obj = new member();
$member = $member_obj->getMemberById($user_id);
$member = $member[0];
if (empty($member)) {
$member = array();
}
//得到全部信息,并且标注已读和未读
$this->setXmlNode('notifys', 'notify');
foreach ($info as $k => $v) {
$v['content'] = unserialize($v['content']);
$v['from'] = array('from_name' => $member[$v['from_id']]['nick_name'], 'from_avatar' => $member[$v['from_id']]['avatar']);
$this->addItem($v);
}
$this->output();
}
示例3: show
public function show($cond)
{
$sql = "SELECT * FROM " . DB_PREFIX . "recommend WHERE 1 " . $cond;
$q = $this->db->query($sql);
$info = array();
$id_array = array();
while ($row = $this->db->fetch_array($q)) {
$id_array[$row['source']][] = $row['cid'];
$info[] = $row;
}
// hg_pre($id_array);
$user = array();
if (!empty($id_array['user'])) {
include_once ROOT_PATH . 'lib/class/member.class.php';
$obj_member = new member();
$data = $obj_member->getMemberById(implode(',', $id_array['user']));
$user = $data[0];
// hg_pre($user);
}
$action = array();
if (!empty($id_array['action'])) {
include_once ROOT_PATH . 'lib/class/activity.class.php';
$obj_activity = new activityCLass();
$data = $obj_activity->show(implode(',', $id_array['action']));
$action = $data['data'];
$team_id = $space = '';
foreach ($action as $k => $v) {
$team_id .= $space . $v['team_id'];
$space = ',';
}
if ($team_id) {
include_once ROOT_PATH . 'lib/class/team.class.php';
$obj_team = new team();
$team_tmp = $obj_team->get_team_by_id($team_id);
$team_tmp = $team_tmp[0];
foreach ($action as $k => $v) {
$action[$k]['team_name'] = $team_tmp[$v['team_id']]['team_name'];
}
}
}
$team = array();
if (!empty($id_array['team'])) {
include_once ROOT_PATH . 'lib/class/team.class.php';
$obj_team = new team();
$data = $obj_team->get_team_by_id(implode(',', $id_array['team']));
$team = $data[0];
}
$topic = array();
if (!empty($id_array['topic'])) {
include_once ROOT_PATH . 'lib/class/team.class.php';
$obj_team = new team();
$data = $obj_team->get_topic_by_id(implode(',', $id_array['topic']));
$topic = $data[0];
}
$sql = "SELECT * FROM " . DB_PREFIX . "column WHERE 1";
$q = $this->db->query($sql);
$column = array();
while ($row = $this->db->fetch_array($q)) {
$column[$row['id']] = $row['name'];
}
$ret = array();
foreach ($info as $k => $v) {
$tmp = ${$v}['source'];
$ret[$k] = array('id' => $v['id'], 'cid' => $v['cid'], 'title' => $v['title'], 'source' => $v['source'], 'column_id' => $column[$v['column_id']], 'pubtime' => $v['pubtime'], 'data' => $tmp[$v['cid']]);
}
return $ret;
}
示例4: black_list
}
$data = array('type' => $type, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'unit_name' => $unit_name, 'contact_person' => $contact_person, 'contact_way' => $contact_way, 'application_note' => $application_note, 'app_name' => $this->user['display_name']);
$result = $this->team->create_team_apply($data);
$this->addItem($result);
$this->output();
}
/**
* 加入黑名单|取消黑名单操作
*/
public function black_list()
{
$team_id = intval($this->input['team_id']);
//检测对应的小组是否存在
$team_info = $this->team->detail($team_id, 1);
if (!$team_info) {
$this->errorOutput(TEAM_NO_EXISTS);
}
$type = isset($this->input['op_type']) ? intval($this->input['op_type']) : -1;
if ($type < 0) {
$this->errorOutput(PARAM_WRONG);
}
$user_id = intval($this->input['user_id']);
$member = new member();
$member_info = $member->getMemberById($user_id);
if (!$member_info) {
$this->errorOutput(PARAM_WRONG);
}
if ($team_info['creater_id'] == $user_id) {
$this->errorOutput(PARAM_WRONG);
}
$data = array('team_id' => $team_id, 'user_id' => $user_id);
if ($type == 1) {
//获取用户类型
$user_type = $this->team->check_user_type($user_id, $team_id);
//关注用户
if ($user_type['level'] == 2) {
//删除关注
$option = new option();
$option->drop_relation($data['user_id'], 'team', $data['team_id'], 'attention');
}
$data['join_time'] = TIMENOW;
$result = $this->team->join_black_list($data);
$result['join_time'] = $data['join_time'];
示例5: setAlbumCate
$this->addItem(true);
$this->output();
}
/**
* 设置相册属于哪个分类
*/
public function setAlbumCate()
{
if (!isset($this->input['cate_id']) || !$this->input['cate_id']) {
$this->errorOutput(NO_CATE_ID);
}
if (!isset($this->input['id']) || !$this->input['id']) {
$this->errorOutput(NO_ID);
}
$id = $this->input['id'];
$cond = " WHERE id={$id}";
$params['cate_id'] = $this->input['cate_id'];
include CUR_CONF_PATH . 'lib/Core.class.php';
$obj = new Core();
$datas = $obj->update('albums', $params, $cond);
$this->addItem($datas);
$this->output();
}
/**
* 获取会员信息
* @param Int|String $user_id
*/
private function getMemberInfo($user_id)
{
if ($this->input['latest']) {
//新会员
include_once ROOT_PATH . 'lib/class/members.class.php';