本文整理汇总了PHP中SaeTClientV2::repost_timeline方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::repost_timeline方法的具体用法?PHP SaeTClientV2::repost_timeline怎么用?PHP SaeTClientV2::repost_timeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeTClientV2
的用法示例。
在下文中一共展示了SaeTClientV2::repost_timeline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$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:
$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);