chaincszzz/duoduoke

多多进宝SDK

dev-master 2019-05-31 03:04 UTC

This package is not auto-updated.

Last update: 2024-09-28 04:15:32 UTC


README

拼多多非官方SDK,主要实现了多多客权限包中的API接口。该SDK正在用于实际项目的开发中,基本功能已经完成,后续补充会及时更新。

require

  • PHP > 5.4.0

安装

composer require chaincszzz/duoduoke

文件

  • Dkutil.php 主要提供一些工具类
  • Base.php 核心参数签名。验证签名,请求多多API
  • Dk.php API的类文件
  • Type.php 定义多多客API type

用法

建议通过创建单例模式来创建Dk对象,例如:

<?php
 
 use duoduoke\Dk;
 
 class Dkinst {
     protected static $dk = NULL;
     
     public static function Init() {
         if (self::$dk) {
             return self::$dk;
         }
         
         $client_id     = "哆哆客id";
         $client_secret = "多多客秘钥";
         self::$dk      = new Dk($client_id, $client_secret);
         
         return self::$dk;
     }
     
     public function __clone() {
         // TODO: Implement __clone() method.
     }
 }

在具体业务中调用

include "Dkinst.php";
$dk = Dkinst::Init();

$dk->goods_basic_info_get();

提示

  • Dk.php中存在许多ext参数,这是一个可选参数数组
  • 调用API后返回的是一个数组

联系

wechat:thinkpapapa