sdk of dianping/tuangou.
北极星开放平台,美团api接口SDK
- PHP >= 5.6
$ composer require fpy/tuangou
只有团购的api,以及自用型应用、工具型应用授权,新版接口不推荐使用app_shop_id,因此本sdk只使用open_shop_uuid
商家通过接入授权UI,可获取到对应的auth_code,通过此接口获取此次发起授权的session。
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);
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.