示例#1
0
function xt_report_paipai($start = 0, $end = 0)
{
    $xt_report_total = 0;
    $xt_report_insert = 0;
    $app = xt_get_app_paipai();
    if (empty($app) || !$app['isValid'] || empty($app['appKey']) || empty($app['appSecret'])) {
        wp_die('暂不支持拍拍订单获取!');
    }
    if (empty($end)) {
        $end = current_time('mysql');
    } else {
        $end = date('Y-m-d H:i:s', strtotime($end));
    }
    if (empty($start)) {
        $start = date('Y-m-d H:i:s', strtotime(current_time('mysql') . '-1 day'));
    } else {
        $start = date('Y-m-d H:i:s', strtotime($start));
    }
    _xt_report_paipai_page($start, $end);
}
示例#2
0
function xt_paipaike_items_search($args)
{
    $app = xt_get_app_paipai();
    if (empty($app) || empty($app['appKey']) || empty($app['appSecret'])) {
        return new WP_Error('系统错误', '尚未配置拍拍开放平台!');
    }
    if (empty($app['token']) || empty($app['uid'])) {
        return new WP_Error('系统错误', '尚未配置拍拍平台QQ号及ACCESS_TOKEN!');
    }
    if (empty($app['userId'])) {
        return new WP_Error('系统错误', '尚未配置拍拍客的推广ID!');
    }
    require_once XT_PLUGIN_DIR . '/xt-core/sdks/paipai/src/PaiPaiOpenApiOauth.php';
    $sdk = new PaiPaiOpenApiOauth($app['appKey'], $app['appSecret'], $app['token'], $app['uid']);
    $sdk->setDebugOn(false);
    $sdk->setMethod("get");
    $sdk->setCharset("utf-8");
    $sdk->setFormat('json');
    $sdk->setApiPath("/cps/cpsCommSearch.xhtml");
    //这个是用户需要调用的 接口函数
    $params =& $sdk->getParams();
    //注意,这里使用的是引用,故可以直接使用
    $params = _xt_paipai_search_params($args);
    $params["pureData"] = 1;
    $params['userId'] = $app['userId'];
    $params['outInfo'] = xt_outercode();
    $params['pageIndex'] = (intval($params['pageIndex']) - 1) * intval($params['pageSize']) + 1;
    if (intval($params['payType']) == 0) {
        unset($params['payType']);
    }
    if (intval($params['begPrice']) == 0) {
        unset($params['begPrice']);
    } else {
        $params['begPrice'] = intval($params['begPrice']) * 100;
    }
    if (intval($params['endPrice']) == 0) {
        unset($params['endPrice']);
    } else {
        $params['endPrice'] = intval($params['endPrice']) * 100;
    }
    if (intval($params['crMin']) == 0) {
        unset($params['crMin']);
    }
    if (intval($params['crMax']) == 0) {
        unset($params['crMax']);
    }
    if (intval($params['classId']) == 0 && empty($params['keyWord'])) {
        return new WP_Error('业务错误', 'keyWord 和 classId 参数至少有一个设值');
    }
    $resp = $sdk->invoke();
    if ($resp) {
        $resp = json_decode($resp);
    }
    if (isset($resp->CpsCommSearchResult)) {
        $resp = $resp->CpsCommSearchResult;
        if ($resp->errorCode > 0) {
            return xt_paipai_api_error($resp);
        } else {
            return array('items' => $resp->vecComm, 'total' => $resp->hitNum);
        }
    } else {
        return new WP_Error('系统错误', '未知');
    }
    return array('items' => array(), 'total' => 0);
}
示例#3
0
                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>
            <?php 
示例#4
0
function xt_share_fetch_paipai($url, $user_id, $user_name, $result)
{
    $app = xt_get_app_paipai();
    if (empty($app) || empty($app['appKey']) || empty($app['appSecret'])) {
        $result['code'] = 501;
        $result['msg'] = '暂不支持拍拍';
        return $result;
    }
    $id = _xt_share_fetch_paipai_id($url);
    if (!$id) {
        $result['code'] = 501;
        $result['msg'] = '宝贝的地址不正确';
        return $result;
    }
    $key = 'pp_' . $id;
    //检查是否已分享该商品
    if ($user_id > 0) {
        if (xt_check_share($key, $user_id)) {
            $result['code'] = 502;
            $result['msg'] = '您已分享该宝贝';
            return $result;
        }
    }
    $goods = xt_paipai_item($id);
    if (is_wp_error($goods)) {
        $result['code'] = 500;
        $result['msg'] = $goods->get_error_message();
        return $result;
    }
    $goods = (array) $goods;
    $result = array();
    //$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['classId'];
    $result['result']['title'] = $goods['itemName'];
    $result['result']['price'] = number_format($goods['itemPrice'] / 100, 2);
    $result['result']['pic_url'] = $goods['picLink'];
    $result['result']['location'] = $goods['regionInfo'];
    $result['result']['nick'] = $goods['sellerName'];
    $result['result']['cat'] = $goods['classId'];
    //    $resp = xt_paipaike_item($id);
    //    if (!is_wp_error($resp)) {
    //        $taoke = (array) $resp->cpsSearchCommData;
    //        if ($taoke['dwIsCpsFlag'] && $taoke['dwActiveFlag']) {
    //            if ($taoke['dwPrimaryCmm']) {
    //                $goods['commission'] = number_format($taoke['dwPrice'] * $taoke['dwPrimaryRate'] / (10000 * 100), 2);
    //            } else {
    //                $goods['commission'] = number_format($taoke['dwPrice'] * $taoke['dwClassRate'] / (10000 * 100), 2);
    //            }
    //        }
    //    }
    $result['result']['from_type'] = 'paipai';
    $result['result']['data_type'] = 1;
    $result['result']['cache_data'] = serialize(array('item' => _xt_share_fetch_paipai_convert($goods), 'comment' => array('total' => 0, 'comments' => array())));
    return $result;
}