Exemplo n.º 1
0
function xt_taobao_s8pid()
{
    $app = xt_get_app_taobao();
    if (!empty($app) && isset($app['s8pid']) && !empty($app['s8pid'])) {
        return $app['s8pid'];
    }
    return '';
}
Exemplo n.º 2
0
function xt_share_fetch_taobao($url, $user_id, $user_name, $result)
{
    $app = xt_get_app_taobao();
    if (empty($app) || empty($app['appKey']) || empty($app['appSecret'])) {
        $result['code'] = 501;
        $result['msg'] = '暂不支持淘宝';
        return $result;
    }
    $id = _xt_share_fetch_taobao_id($url);
    if ($id == 0) {
        $result['code'] = 501;
        $result['msg'] = '宝贝的地址不正确';
        return $result;
    }
    $key = 'tb_' . $id;
    //检查是否已分享该商品
    if ($user_id > 0) {
        if (xt_check_share($key, $user_id)) {
            $result['code'] = 502;
            $result['msg'] = '您已分享该宝贝';
            return $result;
        }
    }
    $result = array();
    $goods = xt_taobao_item($id);
    if (is_wp_error($goods)) {
        $result['code'] = 500;
        $result['msg'] = $goods->get_error_message();
        return $result;
    }
    $goods = (array) $goods;
    if (empty($goods['detail_url']) || empty($goods['pic_url'])) {
        $result['code'] = 501;
        $result['msg'] = '获取淘宝商品信息失败,请重试';
        return $result;
    }
    //$goods['commission'] = 0;
    $result['code'] = 0;
    $result['msg'] = '';
    $result['result']['share_key'] = $key;
    $result['result']['user_id'] = $user_id;
    $result['result']['user_name'] = $user_name;
    $result['result']['cid'] = $goods['cid'];
    $result['result']['title'] = $goods['title'];
    $result['result']['price'] = $goods['price'];
    $result['result']['pic_url'] = $goods['pic_url'];
    $result['result']['url'] = $goods['detail_url'];
    $result['result']['location'] = isset($goods['location']) ? $goods['location']->state . ' ' . $goods['location']->city : '';
    $result['result']['nick'] = $goods['nick'];
    $result['result']['cat'] = $goods['cid'];
    $result['result']['from_type'] = 'taobao';
    $result['result']['data_type'] = 1;
    $result['result']['cache_data'] = serialize(array('item' => $goods, 'comment' => array('total' => 0, 'comments' => array())));
    return $result;
}
Exemplo n.º 3
0
function xt_report_taobao($start = 0, $end = 0)
{
    $xt_report_total = 0;
    $xt_report_insert = 0;
    $app = xt_get_app_taobao();
    if (empty($app) || empty($app['appKey']) || empty($app['appSecret']) || !$app['isValid']) {
        wp_die('暂不支持淘宝订单获取!');
    }
    if (empty($end)) {
        $_date = date('Ymd', current_time('timestamp'));
        $end = date('Ymd', strtotime($_date . '+1 day'));
    }
    if (empty($start)) {
        $start = date('Ymd', current_time('timestamp'));
    }
    while ($start <= $end) {
        _xt_report_taobao_page($start);
        $start = date('Ymd', strtotime($start . '+1 day'));
    }
}
Exemplo n.º 4
0
                h = parseInt((maxtime / 3600) % 24);
                m = parseInt((maxtime / 60) % 60);
                s = parseInt(maxtime % 60);
                msg = d + "天" + h + "小时" + m + "分" + s + "秒";
                fn(msg);
                --maxtime;
            } else {
                clearInterval(timer);
                fn("已失效!");
            }
        }, 1000);
    }
</script>
<?php 
$app_xt = xt_get_app_xt();
$app_taobao = xt_get_app_taobao();
$app_paipai = xt_get_app_paipai();
$app_yiqifa = xt_get_app_yiqifa();
$app_weibo = xt_get_app_weibo();
$app_qq = xt_get_app_qq();
$_loginurl = $_loginurl = xt_platform_authorize_url('[PLATFORM]', 'authoritySuccess', 'admin');
?>
<div id="dashboard-widgets-wrap">
    <?php 
if (IS_CLOUD) {
    if (strpos(home_url(), 'sinaapp.com') !== false) {
        ?>
            <div class="updated" style="color:red;font-weight: bold;font-size:15px;padding:10px 5px;">
                建议绑定自己的独立域名后,再到以下平台用独立域名申请APP,<a href="http://plugin.xintaonet.com/help/?id=126#X_Help-4" target="_blank">新浪SAE域名绑定</a>

            </div>
Exemplo n.º 5
0
function xt_platform_taobao_token()
{
    $app = xt_get_app_taobao();
    include_once XT_PLUGIN_DIR . '/xt-core/sdks/taobao/TopClient.php';
    //请求参数
    $postfields = array('grant_type' => 'authorization_code', 'client_id' => $app['appKey'], 'client_secret' => $app['appSecret'], 'code' => $_GET['code'], 'redirect_uri' => xt_platform_taobao_authorize_url());
    $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());
    }
    $access_token = $token['access_token'];
    include_once XT_PLUGIN_DIR . '/xt-core/sdks/taobao/RequestCheckUtil.php';
    include_once XT_PLUGIN_DIR . '/xt-core/sdks/taobao/request/UserBuyerGetRequest.php';
    $client->format = 'json';
    $client->appkey = $app['appKey'];
    $client->secretKey = $app['appSecret'];
    $req = new UserBuyerGetRequest();
    $req->setFields("nick,sex,buyer_credit,avatar,has_shop,vip_info");
    try {
        $resp = (array) $client->execute($req, $access_token);
    } catch (Exception $e) {
        wp_die($e->getMessage());
    }
    if (isset($resp['code'])) {
        wp_die($resp['msg']);
    }
    $user = (array) $resp['user'];
    return array('id' => $user['nick'], 'display_name' => $user['nick'], 'token' => $token, 'sex' => $user['sex'] == 'm' ? '男' : '女', 'avatar' => $user['avatar'], 'user' => $user);
}