Exemplo n.º 1
0
function xt_taobao_refreshtoken()
{
    $app = xt_taobao_is_session_ready();
    if ($app) {
        if (isset($app['token']['refresh_token']) && !empty($app['token']['refresh_token'])) {
            //请求参数
            $postfields = array('grant_type' => 'refresh_token', 'client_id' => $app['appKey'], 'client_secret' => $app['appSecret'], 'refresh_token' => $app['token']['refresh_token']);
            include_once XT_PLUGIN_DIR . '/xt-core/sdks/taobao/TopClient.php';
            $client = new TopClient();
            try {
                $token = json_decode($client->curl(XT_TAOBAO_TOKEN_URL, $postfields), true);
                $token['expires_in_date'] = date('Y-m-d H:i:s', current_time('timestamp') + $token['expires_in']);
            } catch (Exception $e) {
                wp_die($e->getMessage());
            }
            if (isset($token['expires_in']) && !empty($token['expires_in']) && isset($token['re_expires_in']) && !empty($token['re_expires_in'])) {
                $app['token'] = $token;
                $option_platform = get_option(XT_OPTION_PLATFORM);
                $option_platform['taobao'] = $app;
                update_option(XT_OPTION_PLATFORM, $option_platform);
            }
        }
    }
}
Exemplo n.º 2
0
            <th class="manage-column" style="display:none;width: 80px"><span>渠道</span></th>
        </tr>
    </tfoot>
    <tbody id="the-list" class="list:tag">
        <?php 
$_order_count = 0;
foreach ($_orders as $order) {
    xt_row_order($order, $_order_count);
    $_order_count++;
}
?>
    </tbody>
</table>
<div id="X_Fanxian-Order-Get-Box" style="display:none;">
    <?php 
if (xt_taobao_is_session_ready()) {
    $_currentDate = date('Y-m-d', time());
    ?>
        <p>手动获取订单时间段最多只能选择30天。并且只能获取最近3个月内的交易记录,已经获取了的交易记录将自动忽略。</p>
        <p id="X_Fanxian-Order-Get-Date" style="text-align:center;">
            <input type="text" value="<?php 
    echo date('Y-m-d', strtotime("-7 day"));
    ?>
" id="X_Fanxian-Order-StartDate">&nbsp;至&nbsp;
            <input type="text" value="<?php 
    echo $_currentDate;
    ?>
" id="X_Fanxian-Order-EndDate">
        </p>
        <p style="text-align:center;">
            <input id="X_Fanxian-Order-Get-Submit" type="button" class="button-primary" value="获取交易记录">