Code Monkey home page Code Monkey logo

meituan-sdk's Introduction

meituan-sdk

美团 SDK

安装

composer require hanson/meituan-sdk:dev-master

文档

实例化

$meituan = new Meituan([
    'developer_id' => '',
    'sign_key' => '',
    'debug' => true, // 输出日志
    'log' => [
        'name' => 'meituan',
        'file' => storage_path('logs/meituan.log'),
        'level'      => 'debug',
        'permission' => 0777,
    ]
]);

获取授权链接

// 获取授权链接
$url = $meituan->store->getAuthorizeUrl([
    'businessId' => 2, // 2 为外卖
    'ePoiId' => 'your-ePoiId',
    'callbackUrl' => 'http://example.com/callback',
]);

获取授权门店

$response = $meituan->store->callback();

if (empty($response)) {
    return false;
}

$authToken = $response['appAuthToken'];

// 获取门店信息
$info = $meituan->createAuthorizer($authToken)->waimai->poi->queryPoiInfo($response['ePoiId']);

解绑门店链接

return $meituan->store->getUnbindUrl(2);

获取门店的实例

$meituan = $meituan->createAuthorizer('token');

其他实例

// 获取门店实例
$meituan = $meituan->createAuthorizer('token');

// 订单实例
$order = $meituan->order;

// 菜品实例
$dish = $meituan->dish;

// 门店实例
$poi = $meituan->poi;

// 团购券实例
$coupon = $meituan->coupon;

具体API

具体API可参考美团文档,只需要传业务级别的参数即可

QQ图片20170922125319.png

如此 API 即为

$order->queryById('order-id');

meituan-sdk's People

Contributors

hanson avatar chenhaizano avatar mingyoung avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.