public function getAll() { $typeId = intval($_GET['typeId']); empty($typeId) && ($typeId = 2); $db_prefix = C('DB_PREFIX'); if ($typeId == 2) { $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")->where("follow.uid={$this->mid}")->order('follow.follow_id DESC')->findPage(15); } else { if ($typeId == 3) { $follow = M('')->field('follow.uid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.uid=user.uid")->where("follow.fid={$this->mid}")->order('follow.follow_id DESC')->findPage(15); } else { //目前没有好的方案高效的显示互粉的列表人. //默认显示互粉 // $follow = M('')->field('follow.fid AS fuid,user.uname AS funame') // ->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid") // ->where("follow.uid={$this->mid} AND follow.fid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid})") // ->order('follow.follow_id DESC') // ->findPage(15); //$follow = M('User')->field('uid AS fuid,uname AS funame')->where("uid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid}) AND uid IN (SELECT fid FROM {$db_prefix}user_follow WHERE uid={$this->mid})")->findPage(15); //$follow = M('')->query("SELECT follow.fid AS fuid,user.uname AS funame FROM {$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid WHERE follow.uid={$this->mid} AND follow.type={$typeId}"); } } foreach ($follow['data'] as $k => $v) { $out[$k]['fUid'] = $v['fuid']; $out[$k]['friendUserName'] = getShort($v['funame'], '3', '…'); $out[$k]['friendHeadPic'] = getUserFace($v['fuid']); } exit(json_encode($out)); }
public function replaceRelatedUser() { $related_user = unserialize($_SESSION['_widget_related_user']); if (empty($related_user)) { echo '0'; } else { $html = ''; $limit = min(intval($_POST['limit']), count($related_user)); for ($i = 1; $i <= $limit; $i++) { $shifted_user = array_shift($related_user); $html .= '<li id="related_user_' . $shifted_user['uid'] . '">'; $html .= '<div class="userPic">'; $html .= '<a title="" href="' . U("home/Space/index", array("uid" => $shifted_user['uid'])) . '">'; $html .= '<img src="' . getUserFace($shifted_user['uid'], 'm') . '" card="1">'; $html .= '</a>'; $html .= '</div>'; $html .= '<div class="interest_info">'; $html .= '<p><a href="' . U("home/Space/index", array("uid" => $shifted_user['uid'])) . '">' . getUserName($shifted_user['uid']) . '</a></p>'; $html .= '<p><a href="javascript:void(0);" class="guanzhu" onclick="subscribe(' . $shifted_user['uid'] . ')">加关注</a></p>'; $html .= '<p class="cGray2">' . $shifted_user['reason'] . '</p>'; $html .= '</div>'; $html .= '</li>'; } $_SESSION['_widget_related_user'] = serialize($related_user); echo $html; } }
public function doFollowRelatedUser() { $_POST['uid'] = intval($_POST['uid']); if (0 == $_POST['uid']) { echo 0; } else { D('Follow', 'weibo')->dofollow($this->mid, $_POST['uid']); $related_user = unserialize($_SESSION['related_user']); if (empty($related_user)) { echo ''; return; } else { $shifted_user = array_shift($related_user); $_SESSION['related_user'] = serialize($related_user); $html = ''; $html .= '<li id="related_user_' . $shifted_user . '">'; $html .= '<span class="userPic"><a title="" href="' . U("home/Space/index", array("uid" => $shifted_user)) . '">'; $html .= '<img src="' . getUserFace($shifted_user, 's') . '" card="1">'; $html .= '</a></span>'; $html .= '<div class="name"><a href="' . U("home/Space/index", array("uid" => $shifted_user)) . '">' . getUserName($shifted_user) . '</a></div>'; $html .= '<div><a href="javascript:void(0);" class="cGray2" onclick="subscribe(' . $shifted_user . ');">加关注</a></div>'; $html .= '</li>'; echo $html; } } }
function doaddcomment($uid, $post, $api = false) { $data['uid'] = $uid; $data['reply_comment_id'] = intval($post['reply_comment_id']); $data['weibo_id'] = intval($post['weibo_id']); $data['content'] = $post['content']; $data['ctime'] = time(); $miniInfo = D('Weibo')->where('weibo_id=' . $data['weibo_id'])->find(); if ($data['reply_comment_id']) { $replyInfo = $this->where('comment_id=' . $data['reply_comment_id'])->find(); $data['reply_uid'] = $replyInfo['uid']; } else { $data['reply_uid'] = $miniInfo['uid']; $notify['reply_type'] = 'weibo'; } if ($comment_id = $this->addcomment($data)) { //微博回复积分操作 if ($data['uid'] != $data['reply_uid']) { X('Credit')->setUserCredit($data['uid'], 'reply_weibo')->setUserCredit($data['reply_uid'], 'replied_weibo'); } $data['comment'] = $miniInfo['comment'] + 1; $return['data'] = $data; $return['html'] = '<div class="position_list" id="comment_list_c_' . $comment_id . '"> <a href="' . U('home/space/index', array('uid' => $this->mid)) . '" class="pic"> <img class="pic30" src="' . getUserFace($uid, 's') . '" /></a> <p class="list_c"><a href="#">' . getUserName($uid) . '</a> ' . getUserGroupIcon($uid) . ' : ' . formatComment($data['content'], true) . ' (刚刚)</p> <div class="alR clear"><a href="javascript:void(0)" onclick="ui.confirm(this,\'确认要删除此评论?\')" callback="delComment(' . $comment_id . ')">删除</a> <a href="javascript:void(0)" onclick="reply(\'' . getUserName($uid) . '\',' . $data['weibo_id'] . ')">回复</a></div> </div>'; if ($post['transpond'] != 0) { if ($miniInfo['transpond_id'] != 0) { $transpondData['content'] = $data['content'] . " //@" . getUserName($miniInfo['uid']) . ":" . $miniInfo['content']; $transpondData['transpond_id'] = $miniInfo['transpond_id']; $transpondInfo = M('weibo')->where('weibo_id=' . $miniInfo['transpond_id'])->find(); $transpondData['transpond_uid'] = $transpondInfo['uid']; } else { $transpondData['content'] = $data['content']; $transpondData['transpond_id'] = $miniInfo['weibo_id']; $transpondData['transpond_uid'] = $miniInfo['uid']; } $id = D('Weibo', 'weibo')->doSaveWeibo($uid, $transpondData, $post['from']); if ($id) { //当转发的微博uid 与 回复人的uid不一致时发布@到我 if ($transpondData['transpond_uid'] != $data['reply_uid']) { D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid']); } else { D('Weibo', 'weibo')->notifyToAtme($id, $transpondData['content'], $transpondData['transpond_uid'], false); } } } //添加统计 Model('UserCount')->addCount($data['reply_uid'], 'comment'); if ($api) { return true; } else { return json_encode($return); } } else { return '0'; } }
function write() { $uid = intval($_GET["uid"]); if ($uid) { $toUserFace = getUserFace($uid); $toUserName = getUserName($uid); $this->assign("toUserFace", $toUserFace); $this->assign("toUserName", $toUserName); } $this->display(); }
private function __formatMessageDetail($message) { unset($message['deleted_by']); $message['from_uname'] = getUserName($message['from_uid']); //$message['to_uname'] = getUserName($message['to_uid']); $message['from_face'] = getUserFace($message['from_uid']); //$message['to_face'] = getUserFace($message['to_uid']); $message['timestmap'] = $message['mtime']; $message['ctime'] = date('Y-m-d H:i', $message['mtime']); return $message; }
private function __formatMessageList($message) { foreach ($message as $k => $v) { $message[$k]['from_uname'] = getUserName($v['from_uid']); $message[$k]['to_uname'] = getUserName($v['to_uid']); $message[$k]['from_face'] = getUserFace($v['from_uid']); $message[$k]['to_face'] = getUserFace($v['to_uid']); $message[$k]['timestmap'] = $v['ctime']; $message[$k]['ctime'] = date('Y-m-d H:i', $v['ctime']); } return $message; }
function get_other_comment() { $aid = intval($_POST["aid"]); $map["appid"] = $aid; $map["type"] = "mini"; $comms = D("Comment")->where($map)->findAll(); $num = count($comms); $comms2 = array_slice($comms, 1, $num - 2); for ($i = 0; $i < $num - 2; $i++) { $comms2[$i]["face"] = getUserFace($comms2[$i]["uid"]); $comms2[$i]['cTime'] = friendlyDate($comms2[$i]['cTime']); } echo json_encode($comms2); }
public function getAll() { $typeId = intval($_GET['typeId']); //$limitstart = //$friends = $this->api->friend_getIdName($this->mid,$gid,intval($_GET["pageSize"])); $db_prefix = C('DB_PREFIX'); if ($typeId == 2) { $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')->table("{$db_prefix}weibo_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")->where("follow.uid={$this->mid}")->order('follow.follow_id DESC')->findPage(15); } elseif ($typeId == 3) { $follow = M('')->field('follow.uid AS fuid,user.uname AS funame')->table("{$db_prefix}weibo_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.uid=user.uid")->where("follow.fid={$this->mid}")->order('follow.follow_id DESC')->findPage(15); } else { //默认显示互粉 $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')->table("{$db_prefix}weibo_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")->where("follow.uid={$this->mid} AND follow.fid IN (SELECT uid FROM {$db_prefix}weibo_follow WHERE fid={$this->mid})")->order('follow.follow_id DESC')->findPage(15); } //$follow = M('')->query("SELECT follow.fid AS fuid,user.uname AS funame FROM {$db_prefix}weibo_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid WHERE follow.uid={$this->mid} AND follow.type={$typeId}"); foreach ($follow['data'] as $k => $v) { $out[$k]['fUid'] = $v['fuid']; $out[$k]['friendUserName'] = $v['funame']; $out[$k]['friendHeadPic'] = getUserFace($v['fuid']); } echo json_encode($out); }
public function getOneApi($id, $value, $uid = 0) { if (!$value && is_numeric($id)) { if (($value = object_cache_get("weibo_{$id}")) === false) { $value = $this->where('weibo_id="' . $id . '" AND isdel=0')->find(); } } if (!$value) { return false; } $value['uname'] = getUserName($value['uid']); $value['face'] = getUserFace($value['uid']); if ($value['type'] == 1 && $value['transpond_id'] == 0) { $value['type_data'] = unserialize($value['type_data']); $value['type_data']['picurl'] = SITE_URL . '/data/uploads/' . $value['type_data']['picurl']; $value['type_data']['thumbmiddleurl'] = SITE_URL . '/data/uploads/' . $value['type_data']['thumbmiddleurl']; $value['type_data']['thumburl'] = SITE_URL . '/data/uploads/' . $value['type_data']['thumburl']; } $value['transpond_data'] = $value['transpond_id'] > 0 ? $this->getOneApi($value['transpond_id']) : ''; $value['timestamp'] = $value['ctime']; $value['ctime'] = date('Y-m-d H:i', $value['ctime']); $value['from_data'] = unserialize($value['from_data']); $value['content'] = keyWordFilter($value['content']); if (isset($value['favorited'])) { $value['favorited'] = intval($value['favorited']); } else { $value['favorited'] = (int) D('Favorite', 'weibo')->isFavorited($id, $uid); } return $value; }
function doComment() { $this->check_login(); //解析URL $parse_url = parse_url($_POST['type']); $parse_str = parse_str($parse_url['query'], $option); $type = $option['m'] . ',' . $option['a']; $result = trim($type, ','); //组装数据 $replace = str_replace("\n", " ", $_POST['info']); $data['info'] = htmlspecialchars(ReplaceKeywords(trim(strip_tags($replace)))); //评论替换 $data['pid'] = $_POST['pid']; //$data['type']=$result; $data['type'] = "item,index"; $data['uid'] = $_COOKIE['user']['id']; $data['uname'] = $_COOKIE['user']['name']; $user_rel = $this->user_mod->field('id,name')->where("id='{$data['uid']}'")->find(); $user_rel['face'] = getUserFace($data['uid']); $data['status'] = 1; $data['add_time'] = time(); if (M('UserComments')->add($data)) { $arr = array('id' => $data['pid'], 'comments' => $this->user_comments_mod->where('pid=' . $data['pid'] . ' and type="item,index"')->count()); $this->items_mod->save($arr); $this->ajaxReturn($user_rel); } else { echo 0; } }
function searchUser($key, $mid, $since_id, $max_id, $count = 20, $page = 1) { $key = t($key); if (!$key) { return false; } $limit = ($page - 1) * $count . ',' . $count; $map = 'uid>0'; if ($since_id) { $map .= " AND uid > {$since_id}"; } elseif ($max_id) { $map .= " AND uid < {$max_id}"; } $list = $this->table(C('DB_PREFIX') . 'user')->where($map . " AND uname LIKE '%{$key}%'")->limit($limit)->findall(); foreach ($list as $k => $v) { $list[$k]['mini'] = M('weibo')->where('uid=' . $v['uid'] . ' AND type=0')->order('weibo_id DESC')->find(); $list[$k]['followed_count'] = M('weibo_follow')->where('uid=' . $v['uid'])->count(); $list[$k]['followers_count'] = M('weibo_follow')->where('fid=' . $v['uid'])->count(); $list[$k]['is_followed'] = getFollowState($mid, $v['uid']); $list[$k]['area'] = $v['location']; $list[$k]['face'] = getUserFace($v['uid']); } return $list; }
echo $comments["info"]; ?> </span></p></div><?php } } } else { echo ""; } } if (isset($val['user'])) { ?> <div class="clearfix comm_share"><div class="avatar"><a href="<?php echo u('uc/index', array('uid' => $val['user']['id'])); ?> "><img src="<?php echo getUserFace($val['user']['id']); ?> " class="tipuser" uid='<?php echo $val['user']['id']; ?> ' width="32px" height="32px"/></a></div><p><a href="<?php echo u('uc/index', array('uid' => $val['user']['id'])); ?> "><em><?php echo $val["user"]["name"]; ?> :</em></a>分享 <span><?php if ($val["remark_status"] == 1) { echo $val["remark"]; }
function saveThumb() { //头像大方快的宽高 $targ_w = 120; $targ_h = 120; //头像小方块的宽高 $small_w = 50; $small_h = 50; //图像质量 $jpeg_quality = 80; $src_arr = explode("?", $_POST['bigImage']); $src = $src_arr[0]; $src = str_ireplace(SITE_URL, '.', $src); //获取图片的扩展名。来选择使用什么函数 if ($arr = @getimagesize($src)) { $ext = image_type_to_extension($arr[2], false); } else { $this->error('对不起,GD库不存在或远程图片不存在'); } $func = $ext != 'jpg' ? 'imagecreatefrom' . $ext : 'imagecreatefromjpeg'; $img_r = call_user_func($func, $src); //开始切割大方块头像 $dst_r = ImageCreateTrueColor($targ_w, $targ_h); $x = $targ_h / $_POST['txt_Zoom']; imagecopyresampled($dst_r, $img_r, 0, 0, $_POST['txt_left'] / $_POST['txt_Zoom'], $_POST['txt_top'] / $_POST['txt_Zoom'], $targ_w, $targ_h, $x, $x); $path = SITE_PATH . "data/thumb/"; $filename = $path . 'xxx_s.jpg'; $face_path = getFacePath($this->mid); mkdir($face_path, 0777, true); $middle_name = $face_path . $this->mid . "_middle_face.jpg"; //中图 imagejpeg($dst_r, $middle_name); //生成中图 imagedestroy($dst_r); imagedestroy($img_r); $small_name = $face_path . $this->mid . "_small_face.jpg"; //小图 vendor("yu_image"); $img = new yu_image(); $img->param($middle_name)->thumb($small_name, $small_w, $small_h, 0); //缩出小图 //添加一条动态 $body_data["src"] = getUserFace($this->mid); $this->api->feed_publish("head", $title_data, $body_data); setScore($this->mid, 'update_face'); $this->redirect("/Home/index"); }
function doaddShare() { $type['typeId'] = 10; $type['typeName'] = '用户'; $type['alias'] = 'user'; $info = h($_REQUEST['info']); $aimId = intval($_REQUEST['aimId']); $data['username'] = getUserName($aimId); $data['userface'] = getUserFace($aimId); //$data['city'] = getUserCity($aimId); //为了兼容其它应用而使用uid $data['uid'] = $aimId; //主人的心情 $bq_config = D('MiniConfig')->getConfig('mini'); $bq_emotion = D('Smile')->getSmile($bq_config['smiletype']); $the_mini = D("Mini")->getOneMini($aimId, $bq_emotion, $bq_config['smiletype']); $data['mini'] = $the_mini['content']; $result = $this->api->share_addShare($type, $aimId, $data, $info); echo $result; }
/** * 把用户姓名和头像赋值给模板 * */ private function __assignNameAndFace($uid) { if ($uid && $uid != $this->mid) { $toUserName = getUserName($uid); $toUserFace = getUserFace($uid); $this->assign('toUserName', $toUserName); $this->assign('toUserFace', $toUserFace); } }
public function face($get) { if ($get['type'] !== 'face') { $uc_uid = $get['uid']; $uc_user_ref = ts_get_ucenter_user_ref('', $uc_uid); $user = M('user')->where("uid={$uc_user_ref['uid']}")->find(); if ($user) { echo $user['uid']; /*cookie('LOGGED_USER',jiami('thinksns.'.$user['uid']),(3600*2))*/ } } else { $data = 'http://dev.thinksns.com/ts/2.0/public/themes/classic2'; $face = str_replace('THEME_URL', $data, getUserFace($get['uid'])); $data = 'http://dev.thinksns.com/ts/2.0'; $face = str_replace('SITE_URL', $data, $face); echo $face; } }
function getOneApi($id, $info) { if (!$info) { $info = $this->where('weibo_id=' . $id)->find(); } if (!$info) { return false; } $info['uname'] = getUserName($info['uid']); $info['face'] = getUserFace($info['uid']); if ($info['type'] == 1 && $info['transpond_id'] == 0) { $info['type_data'] = unserialize($info['type_data']); $info['type_data']['picurl'] = SITE_URL . '/data/uploads/' . $info['type_data']['picurl']; $info['type_data']['thumbmiddleurl'] = SITE_URL . '/data/uploads/' . $info['type_data']['thumbmiddleurl']; $info['type_data']['thumburl'] = SITE_URL . '/data/uploads/' . $info['type_data']['thumburl']; } $info['transpond_data'] = $info['transpond_id'] != 0 ? $this->getOneApi($info['transpond_id']) : ''; $info['timestamp'] = $info['ctime']; $info['ctime'] = date('Y-m-d H:i', $info['ctime']); $info['from_data'] = unserialize($info['from_data']); return $info; }
function getUserInfo($uid, $uname, $mid, $status = false) { $data = array(); $uid = intval($uid); $user = null; if ($uid > 0) { $user = D('User', 'home')->getUserByIdentifier($uid, 'uid'); } else { if (!empty($uname)) { $user = D('User', 'home')->getUserByIdentifier($uname, 'uname'); } } if (!$user) { return false; } if ($uid != $mid) { $isBlack = D('UserPrivacy', 'home')->isInBlackList($uid, $mid); $data['isInBlackList'] = $isBlack ? 1 : 0; } $data['uid'] = $user['uid']; $data['uname'] = $user['uname']; $data['province'] = $user['province']; $data['city'] = $user['city']; $data['location'] = $user['location']; $data['face'] = getUserFace($user['uid']); $data['space'] = $user['domain'] ? U('home/Space/index', array('uid' => $user['domain'])) : U('home/Space/index', array('uid' => $user['uid'])); $data['sex'] = getSex($user['sex']); $data['weibo_count'] = model('UserCount')->getUserWeiboCount($user['uid']); $data['favorite_count'] = (int) M('weibo_favorite')->where('uid=' . $user['uid'])->count(); $data['followers_count'] = model('UserCount')->getUserFollowerCount($user['uid']); $data['followed_count'] = model('UserCount')->getUserFollowingCount($user['uid']); $data['is_followed'] = getFollowState($mid, $user['uid']); $data['is_verified'] = intval(M('user_verified')->getField('verified', "uid={$uid}")); if ($status) { $status = M('weibo')->where('uid=' . $user['uid'])->order('weibo_id DESC')->find(); $data['status'] = $status ? D('Weibo', 'weibo')->getOneApi('', $status) : ''; } return $data; }
private function replace($data) { foreach ($data as $key => &$value) { $value['face'] = getUserFace($value['uid']); $value['cTime'] = friendlyDate($value['cTime']); $value['comment'] = $this->replaceContent($value['comment'], 'mini'); //TODO 表情多应用化 $value['isDelete'] = $this->mid == $value['uid'] || $this->mid == $this->uid ? true : false; //悄悄话 } return $data; }
public function render($data) { $var['small_avatar'] = getUserFace($this->mid); $content = $this->renderFile(dirname(__FILE__) . '/default.html', $var); return $content; }
/** * _internalReplay * 获取剩余的回复 * @param mixed $id * @access public * @return void */ public function _internalReplay($id, $time = null, $uid) { $comment = D('Comment'); $data = $comment->getComment(APP_NAME, $id, true, null, $time); if (!$data) { return false; } //去除第一个 array_shift($data); //处理附带判断 foreach ($data as &$value) { $value['cTime'] = friendlyDate($value['cTime']); //追加时间 $value['face'] = getUserFace($value['uid']); //追加头像 $value['isDelete'] = $value['uid'] == $this->uid && !empty($this->uid) || $uid == $this->uid ? true : false; } // $html = W( "OddReplay",array( 'replay'=>$data) ,true); return $data; }
public function getAllFriends() { $gid = intval($_GET["type"]); $friends = $this->api->friend_getIdName($this->mid, $gid, intval($_GET["pageSize"])); foreach ($friends["data"] as $k => $v) { $out[$k]["fUid"] = $v["fuid"]; $out[$k]["friendUserName"] = $v["fusername"]; $out[$k]["friendHeadPic"] = getUserFace($v["fuid"]); } echo json_encode($out); }
/** * 微吧消息提示 */ public function commInfo() { $uid = empty($this->user_id) ? $this->mid : $this->user_id; $uid || $this->returnData('', '请先登录', 0); //评论消息数 $commList = M('comment')->field('uid')->where(array('to_uid' => $uid, 'app' => 'weiba', 'table' => 'feed', 'is_read' => 0))->order('ctime DESC')->select(); $commNum = count($commList); $lastUser = getUserFace($commList[0]['uid']); $rtnData['count'] = $commNum; $rtnData['last_user'] = $lastUser; $msg = $commList ? 'ok' : 'no'; $code = $commList ? 1 : 0; return $this->returnData($rtnData, $msg, $code); }
function hasUserFace($uid) { return getUserFace($uid, 'm') != THEME_URL . "/images/user_pic_middle.gif"; }
public function set_face() { //暂时先这么写,应该加到API接口里面去。 $path = SITE_PATH . "/data/thumb/"; $filename = $path . 'xxx_s.jpg'; $face_path = getFacePath($this->mid); $middle_name = $face_path . "/" . $this->mid . "_middle_face.jpg"; //中图 imagejpeg($dst_r, $middle_name); //生成中图 imagedestroy($dst_r); imagedestroy($img_r); $small_name = $face_path . "/" . $this->mid . "_small_face.jpg"; //小图 vendor("yu_image"); $img = new yu_image(); $img->param($middle_name)->thumb($small_name, $small_w, $small_h, 0); //缩出小图 //添加一条动态 $body_data["src"] = getUserFace($this->mid); $this->api->feed_publish("head", $title_data, $body_data); }
echo u('item/index', array('id' => $val['items_id'])); ?> " target="_blank" title="<?php echo $val['title']; ?> "><img src="<?php echo $val["img"]; ?> " alt="<?php echo $val["title"]; ?> " style="width:120px;" /></a></div><div class="user"><a href="<?php echo u('uc/index', array('uid' => $val['uid'])); ?> "><img src="<?php echo getUserFace($val['uid']); ?> " class="tipuser" uid='<?php echo $val['uid']; ?> ' width="30px" height="30px"/></a><span class="name ofh"><a href="<?php echo u('uc/index', array('uid' => $val['uid'])); ?> " title="<?php echo $val['uname']; ?> " target="_blank"><?php echo $val['uname']; ?> </a></span><span class="baobeiNum"><?php echo $val['time'];
public function getFriends2() { //是否需要检查聊天num $is_chat_num = intval($_REQUEST["chat_num"]); if ($is_chat_num > 0) { $sql_f = "select fromUserId as uid from __TABLE__ where toUserId={$this->mid} and flagNew=1"; $chats = D("Chat")->query($sql_f); foreach ($chats as $key => $v) { $chat_ids[] = $v["uid"]; } $chat_nums = array_count_values($chat_ids); } //在线好友 $friends = $this->api->friend_get($this->mid); $map["uid"] = array("IN", $friends); $map["activeTime"] = array("GT", time() - 15 * 60); $daoOnline = D("UserOnline"); $onlineFris = $daoOnline->where($map)->findAll(); //echo $daoOnline->getLastSql(); //不输出离线用户的num // if($is_chat_num>0){ // $onlineFris = $onlineFris?$onlineFris:array(); // $onlineFris = array_merge($onlineFris,$chats); // } foreach ($onlineFris as $key => $v) { $onlineFris[$key]["mini"] = getShortMini(getUserMini($v["uid"]), 8); $onlineFris[$key]["head"] = getUserFace($v["uid"]); if ($is_chat_num > 0) { $onlineFris[$key]["chat_num"] = $chat_nums[$v["uid"]]; $onlineFris[$key]["uname"] = $onlineFris[$key]["uname"] ? $onlineFris[$key]["uname"] : getUserName($v["uid"]); } } //dump($onlineFris); echo json_encode($onlineFris); }
function completeface() { $face = getUserFace($_COOKIE['user']['id'], 'all'); $this->assign('face', $face); $this->display(); }
function _sendMessage($type, $aimId, $mid, $username, $data, $info, $fri_ids, $url, $result) { if (isset($data['content'])) { unset($data['content']); } $body_data = $data; if (!empty($aimId)) { $body_data['aimId'] = $aimId; } $body_data['typeId'] = $type['typeId']; $body_data['toUid'] = $mid; $body_data['toUserName'] = $username; $body_data['info'] = $info; $body_data['id'] = $result; $title_data['id'] = $result; if ($type['typeId'] == 10) { $body_data['username'] = getUserName($data['uid']); $userface = getUserFace($data['uid']); $body_data['userface'] = str_replace(SITE_URL, '{WR}', $userface); } $appid = TS_D('App')->getChoiceId('share'); TS_D('Feed')->publish("share_" . $type['alias'], $title_data, $body_data, $appid); $notifyDao = TS_D('Notify'); $notifyDao->setAppId($appid); $title_data['type'] = $type['typeName']; if (empty($url)) { $url = $this->_getURL($type['typeId'], $aimId, $data); } if (empty($url)) { $url = SITE_URL . '/apps/share/index.php?s=/Index/content/id/' . $result; } if (!empty($fri_ids)) { $notifyDao->send($fri_ids, "share_notice", $title_data, $body_data, $url); } $uid = $this->_getUid($data, $type); if (!empty($uid) && $uid != $mid) { $notifyDao->send($uid, "share_notice2", $title_data, $body_data, $url); } if ($type['typeId'] == 10) { $uid = $aimId; $notifyDao->send($uid, "share_notice3", $title_data, $body_data, $url); } }