function friends_by_id($uid, $cursor = 0, $count = 50) { $params = array(); $params['cursor'] = $cursor; $params['count'] = $count; $params['uid'] = $uid; return $this->oauth->get('friendships/friends', $params); }
if (1 != $num) { $msg = "向数据库插入数据出错。file:" . __FILE__ . ";line:" . __LINE__ . "sql:" . $sql; debug($msg); } $sql = "update user set bind_status = bind_status + 1 where user_id = '{$id}' limit 1"; $num = $dbo->exeUpdate($sql); if (1 != $num) { $msg = "向数据库插入数据出错。file:" . __FILE__ . ";line:" . __LINE__ . "sql:" . $sql; debug($msg); } //写session,跳转 $_SESSION['sid'] = $sid; $_SESSION['stoken'] = $token['access_token']; header("Location:task.php"); // 后台获取用户的已关注用户id列表,写入SESSION $friends = $c->friends_by_id($_SESSION['sid']); if_weiboapi_fail($friends, __FILE__, __LINE__); foreach ($friends['users'] as $friend) { $followed_id[] = $friend['id']; } $_SESSION['followed_id'] = $followed_id; $_SESSION['is_bind_weibo'] = TRUE; $_SESSION['slevel'] = $weibo_init_level; exit; } else { // 尚未注册。在用微博帐号注册。注:直接用微博注册者默认为普通会员,广告主需要先注册微动力。 $user_info = $c->show_user_by_id($sid); // fetch user basic message according to sid if_weiboapi_fail($user_info); $screen_name = $user_info['screen_name']; $name = $screen_name . '@sina';