Giter Club home page Giter Club logo

alibaba's Introduction

阿里巴巴开放平台SDK

更新时间: 2020-04-07 15:00:21

Installing

$ composer require javareact/alibaba_open -vvv

Usage

场景: 拉取阿里巴巴商家的采购数据,同步到erp上,采用的是多用户模式

        $obj = new \jubull\alibaba\AlibabaClient(['page'=>1]);
        $obj->setAppkey('你的appkey');
        $obj->setAppsecret('你的秘钥');
        $obj->setAccessToken('自己想办法去获取token,如果设置的是多用户单用户的直接复制,应用管理中的token');//如果是单用户模式,无需添加此参数
        $res =$obj->order->setApi('com.alibaba.trade:alibaba.trade.getBuyerOrderList-1')->get(); //api 就是阿里巴巴文档中的
        var_dump($res);

项目中可以继承他:

<?php


namespace App\Services\AliOpen;


class AliOpen extends \jubull\alibaba\AlibabaClient
{
    public function __construct($params = array())
    {
        $this->setAppkey('39376**');
        $this->setAppsecret('0RsvFZYV**');
        $this->access_token = '06410386-242c-41f6-8a20-5e7e0d2b6229';
        parent::__construct($params);
    }
}

获取订单列表的例子

        $get_data =( new  \jubull\alibaba\AlibabaClient([     //这边的AliOpen ,是你设置appkey的对象
            'page'=>1,
            'pageSize'=>100,
        ]))
            ->order
            ->setApi('com.alibaba.trade:alibaba.trade.getBuyerOrderList-1')
            ->get();

获取订单详情的例子

        $get_data = (new  \jubull\alibaba\AlibabaClient([
            'webSite'=>1688,
            'orderId'=>$this->app->order_id,
        ]))
            ->order
            ->setApi('com.alibaba.trade:alibaba.trade.get.buyerView-1')
            ->get();

关注商品的例子

        $get_data = (new  \jubull\alibaba\AlibabaClient())
            ->product
            ->productFollow(new \jubull\alibaba\entity\ProductFollowParams('532137286888'))//建议使用此种方法传参
            ->get();

跨境场景下接口获取商品详情

$get_data = (new \jubull\alibaba\AlibabaClient())
    ->setAppkey('you appkey')
    ->setAppsecret('you Appsecret')
    ->setAccessToken('you TOKEN')
    ->product
    ->getCrossProductInfo(new \jubull\alibaba\entity\CrossProductInfoParam('615890334160')) //商品ID
    ->post();

更新日志:

License

MIT

alibaba's People

Contributors

jubull 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.