repost_timeline() 공개 메소드

对应API:{@link http://open.weibo.com/wiki/2/statuses/repost_timeline statuses/repost_timeline}
public repost_timeline ( integer $sid, integer $page = 1, integer $count = 50, integer $since_id, integer $max_id, integer $filter_by_author ) : array
$sid integer 要获取转发微博列表的原创微博ID。
$page integer 返回结果的页码。
$count integer 单页返回的最大记录数,最多返回200条,默认50。可选。
$since_id integer 若指定此参数,则只返回ID比since_id大的记录(比since_id发表时间晚)。可选。
$max_id integer 若指定此参数,则返回ID小于或等于max_id的记录。可选。
$filter_by_author integer 作者筛选类型,0:全部、1:我关注的人、2:陌生人,默认为0。
리턴 array
$task_text = $sql_res['task_text'];
echo '<h3>任务mid: ' . $task_wid . ' </h3>';
echo '<h3>任务text: ' . $task_text . ' </h3>';
echo '<hr />';
// 从数据库do_task表中检索出一定时间之内做过该任务的人和他们做任务时产生的mid
$sql = "select user_id, repost_mid from do_task where task_id = {$task_id}";
// and time ... // attention
$sql_res = $dbo->getRs($sql);
foreach ($sql_res as $k) {
    $do_tasks[$k['user_id']] = $k['repost_mid'];
}
// 此时 $do_task 中存放的是 user_id 和 repost_mid 的键值对。
// 使用api查询任务微博的转发微博 statuses/repost_timeline/ids
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['stoken']);
echo '<h3>该任务微博目前的转发微博的mid:</h3>';
$repost_weibos = $c->repost_timeline($task_wid);
foreach ($repost_weibos['reposts'] as $weibo) {
    echo $weibo['mid'] . ' -- ' . $weibo['text'] . ' (<sub>' . $weibo['retweeted_status']['text'] . '</sub>)<br />';
    $real_weibo_mids[] = $weibo['mid'];
}
echo '<hr />';
echo '<h3>在该任务上出问题的用户</h3>';
if (0 === count($do_tasks)) {
    echo '<p>该任务目前没有人做</p>';
    exit;
}
if (0 === count($real_weibo_mids)) {
    $fail_tasks = $do_tasks;
} else {
    $fail_tasks = array_diff($do_tasks, $real_weibo_mids);
}
예제 #2
0
$sql = "select user_id, repost_mid from do_task where task_id = '{$task_id}' and task_type = 1";
// and time ... // attention
$sql_res = $dbo->getRs($sql);
foreach ($sql_res as $k) {
    $do_tasks[$k['user_id']] = $k['repost_mid'];
}
// 此时 $do_task 中存放的是 user_id 和 repost_mid 的键值对。
// 使用api查询任务微博的转发微博 statuses/repost_timeline/ids
$sql_res = $dbo->getRow('select sina_token from user_info_sina where sina_token is not null and unix_timestamp(now()) < unix_timestamp(token_update_at)+token_expires_in limit 1');
//$c = new SaeTClientV2( WB_AKEY, WB_SKEY, $_SESSION['stoken'] );
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $sql_res['sina_token']);
/*
echo "\n该任务微博目前的转发微博的mid:\n";
echo "--------------------------\n";
*/
$repost_statuses = $c->repost_timeline($task_wid);
if_weiboapi_fail($repost_statuses, __FILE__, __LINE__);
foreach ($repost_statuses['reposts'] as $status) {
    //echo $status['mid'].' -- '.$status['text'].' ('.$status['retweeted_status']['text'].")\n";
    $real_status_mids[] = $status['mid'];
}
echo "\n" . '在该任务上出问题的用户' . "\n";
echo "--------------------------\n";
if (0 === count($do_tasks)) {
    echo 'no body did the task' . "\n";
    exit;
}
if (0 === count($real_status_mids)) {
    $fail_tasks = $do_tasks;
} else {
    $fail_tasks = array_diff($do_tasks, $real_status_mids);