1 Star 0 Fork 1

Jsom / taobaosdk

forked from sixteener / taobaosdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Laravel集成阿里百川sdk和淘宝客sdk

阿里百川中包含了一些基础的sdk,如阿里云旺,电商sdk等,淘宝客sdk中主要是淘宝客基础api

安装

安装有两种方式:

① 直接编辑配置文件

将以下内容增加到 composer.json:

require: {
    "sixteener/taobaosdk": "~1.0"
}

然后运行 composer update

② 执行命令安装

运行命令:

composer require sixteener/taobaosdk:~1.0

使用

阿里百川sdk的使用方法

以阿里云旺taobao.openim.users.add (添加用户)为例

use Sixteener\TaoBaoSDK\BaiChuan\Top\TopClient;
use Sixteener\TaoBaoSDK\BaiChuan\Top\Request\OpenimUsersAddRequest;
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new OpenimUsersAddRequest;
$userinfos = new Userinfos;
$userinfos->nick="king";
$userinfos->icon_url="http://xxx.com/xxx";
$userinfos->email="uid@taobao.com";
$userinfos->mobile="18600000000";
$userinfos->taobaoid="tbnick123";
$userinfos->userid="imuser123";
$userinfos->password="xxxxxx";
$userinfos->remark="demo";
$userinfos->extra="{}";
$userinfos->career="demo";
$userinfos->vip="{}";
$userinfos->address="demo";
$userinfos->name="demo";
$userinfos->age="123";
$userinfos->gender="M";
$userinfos->wechat="demo";
$userinfos->qq="demo";
$userinfos->weibo="demo";
$req->setUserinfos(json_encode($userinfos));
$resp = $c->execute($req);

响应结果

{
    "openim_users_add_response":{
        "uid_succ":{
            "string":[
                "uid"
            ]
        },
        "uid_fail":{
            "string":[
                "uid"
            ]
        },
        "fail_msg":{
            "string":[
                "db error"
            ]
        }
    }
}

淘宝客sdk的使用方法

以taobao.tbk.item.info.get (淘宝客商品详情(简版))为例

use Sixteener\TaoBaoSDK\TBK\Top\TopClient;
use Sixteener\TaoBaoSDK\TBK\Top\Request\TbkItemInfoGetRequest;
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new TbkItemInfoGetRequest;
$req->setFields("num_iid,title,pict_url,small_images,reserve_price,zk_final_price,user_type,provcity,item_url");
$req->setPlatform("1");
$req->setNumIids("123,456");
$resp = $c->execute($req);

响应结果

{
    "tbk_item_info_get_response":{
        "results":{
            "n_tbk_item":[
                {
                    "num_iid":123,
                    "title":"连衣裙",
                    "pict_url":"http:\/\/gi4.md.alicdn.com\/bao\/uploaded\/i4\/xxx.jpg",
                    "small_images":{
                        "string":[
                            "http:\/\/gi4.md.alicdn.com\/bao\/uploaded\/i4\/xxx.jpg"
                        ]
                    },
                    "reserve_price":"102.00",
                    "zk_final_price":"88.00",
                    "user_type":1,
                    "provcity":"杭州",
                    "item_url":"http:\/\/detail.m.tmall.com\/item.htm?id=xxx",
                    "nick":"demo",
                    "seller_id":123,
                    "volume":1,
                    "cat_leaf_name":"内衣",
                    "cat_name":"女装"
                }
            ]
        }
    }
}

官方SDK / 手册

MIT License Copyright (c) 2017 sixteener Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A TaoBaoSDK package for laravel 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/alexleix/taobaosdk.git
git@gitee.com:alexleix/taobaosdk.git
alexleix
taobaosdk
taobaosdk
master

搜索帮助