示例#1
0
                 </p>
                 </div><!-- end of DIV task_block -->
             <?php 
     }
     ?>
             </div><!-- end of DIV task_show -->
         <?php 
     break;
     ?>
         <?php 
 case 'sina_repost':
     ?>
             <div id="task_show">
                 <?php 
     foreach ($res as $row) {
         $user_level_price = price_db_to_user(price_base_to_level($row['base_price'], $_SESSION['slevel']));
         $user_top_price = price_db_to_user(price_base_to_top($row['base_price']));
         ?>
                 <div class="task_block">
                     <p><?php 
         echo '<p class="repost_task_text">' . $row['text'] . '</p>';
         echo '<p class="repost_task_comment">by:<a href="http://weibo.com/u/' . $row['sina_uid'] . '" target="_blank">' . $row['screen_name'] . '</a>。<br />转发此微博,您可以获利' . $user_level_price . '元,最高可获利' . $user_top_price . '元<sup><a href="help.php#price">?</a></sup>。';
         if (isset($_SESSION['is_bind_weibo']) && $_SESSION['is_bind_weibo']) {
             echo '<a href="action/repost.php?id=' . $row['task_id'] . '">转发</a>';
         } else {
             echo '转发(不可用)<a href="help.php#task_invalid"><sup>?</sup></a>';
         }
         ?>
                     。<a href="action/repost.php?id=<?php 
         echo $row['task_id'];
         ?>
示例#2
0
function price_base_to_top($base_price, $top_level = 10)
{
    return price_base_to_level($base_price, $top_level);
}
示例#3
0
 $sina_wid = $sql_res['sina_wid'];
 $base_price = $sql_res['base_price'];
 $task_owner_name = $sql_res['screen_name'];
 $task_res = $c->repost($sina_wid);
 //	if_weiboapi_fail($task_res, __FILE__, __LINE__);
 // 没做成功,回滚task表中finish_amount数据
 if (isset($task_res['error_code'])) {
     echo '某处出了错误:' . $task_res['error'] . "。您未能完成任务,请<a href=\"{$_SERVER['HTTP_REFERER']}\">点此返回</a>";
     $sql = "update task set finish_amount = finish_amount - 1 where task_id = {$task_id} limit 1";
     $dbo->exeUpdate($sql);
     $dbo->close();
     exit;
 }
 // 做成功了,写数据库,写SESSION
 // 写do_task表
 $db_level_price = price_base_to_level($base_price, $_SESSION['slevel']);
 //	$sql = "insert do_task (task_id, user_id, status, repost_mid, time)values($task_id, {$_SESSION['uid']}, '11', {$task_res['retweeted_status']['mid']}, now())";
 //  此处应注意,retweeted_status['mid']是原微博的mid,而非转发产生的mid
 $sql = "insert do_task (task_id, user_id, status, task_type, owner_name, income, repost_mid, time)values({$task_id}, {$_SESSION['uid']}, 11, 1, '{$task_owner_name}', '{$db_level_price}', '{$task_res['mid']}', now())";
 $sql_num = $dbo->exeUpdate($sql);
 if (1 != $sql_num) {
     echo 'debug. 写数据库失败。file: ' . __FILE__ . '; line: ' . __LINE__;
     $dbo->close();
     exit;
 }
 $sql = "update user set task_taken=task_taken+1, task_finished=task_finished+1," . " total_money=total_money+{$db_level_price}, realtime_money=realtime_money+{$db_level_price}" . " where user_id = {$_SESSION['uid']} limit 1";
 // 写user表
 $sql_num = $dbo->exeUpdate($sql);
 if (1 != $sql_num) {
     echo 'debug. 写数据库出现错误。file: ' . __FILE__ . '; line: ' . __LINE__ . '. sql:' . $sql;
     $dbo->close();