PHP code example of fpy / tuangou

1. Go to this page and download the library: Download fpy/tuangou library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fpy / tuangou example snippets


use Fpy\TuanGou\Session;
$session = new Session($appKey, $appSecret);
//session换取接口
$session->getToken($authCode,$redirectUrl=null);

//session刷新接口
$session->refreshToken($refreshToken);

//session范围查询接口
$session->sessionQuery($session);

//session适用店铺查询接口
$session->getScope($bid,$session);

use Fpy\TuanGou\TuanGou;
$tuangou = new TuanGou($appKey, $appSecret);

//输码验券校验接口
$tuangou->prepare($receiptCode, $openShopUuid, $session);

//扫码验券校验接口
$tuangou->scanPrepare($receiptCode, $openShopUuid, $session);

//验券接口
$tuangou->consume($requestId, $code, $count, $openShopUuid, $session, $shopAccount, $shopAccountName);

//查询已验券信息接口
$tuangou->getConsumed($code, $openShopUuid, $session);

//验券记录
$tuangou->consumeHistory($date, $openShopUuid, $session, $type=0, $bizType=null, $pageIndex=1, $pageSize=10);

//撤销验券接口(超过10分钟不能退券)
$tuangou->reverseConsume($appDealId, $code, $openShopUuid, $session, $shopAccount, $shopAccountName)

//获取团购信息接口

$tuangou->queryShopDeal($openShopUuid, $session, $pageIndex=1, $pageSize=10);