PHP code example of ledc / shan-song

1. Go to this page and download the library: Download ledc/shan-song library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ledc / shan-song example snippets


use Ledc\ShanSong\Config;
use Ledc\ShanSong\Merchant;

//更多配置项,可以查看 配置管理类的属性 Ledc\ShanSong\Config
$config = [
    'shopId' => '',
    'clientId' => '',
    'appSecret' => '',
    'testShopId' => '',
    'debug' => true,
    'enabled' => true,
];

$merchant = new Merchant(new Config($config));

/** @var \Ledc\ShanSong\Merchant $merchant */
// 查询开通城市
$merchant->openCitiesLists();

// 分页查询商户店铺
$merchant->queryAllStores();

// 查询城市可指定的交通工具
$merchant->optionalTravelWay();

// 订单计费
$merchant->orderCalculate();

// 提交订单
$merchant->orderPlace();

// 订单加价
$merchant->addition();

// 查询订单详情
$merchant->orderInfo();

// 查询闪送员位置信息
$merchant->courierInfo();

// 查询订单续重加价金额
$merchant->calculateOrderAddWeightFee();

// 支付订单续重费用
$merchant->payAddWeightFee();

// 订单预取消
$merchant->preAbortOrder();

// 订单取消
$merchant->abortOrder();

// 确认物品送回
$merchant->confirmGoodsReturn();

// 店铺操作(新增店铺、修改店铺)
$merchant->storeOperation();

// 查询账号额度
$merchant->getUserAccount();

// 修改收件人手机号
$merchant->updateToMobile();

// 批量新增店铺
$merchant->addStores();

// 更多...