Files

118 lines
3.5 KiB
PHP

<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace TuzhiEasyWeChat\Channels\merchant;
use TuzhiEasyWeChat\Kernel\BaseClient;
use TuzhiEasyWeChat\Kernel\Exceptions\InvalidArgumentException;
/**
* Class Client.
*
* @author mingyoung <mingyoungcheung@gmail.com>
*/
class AddressClient extends BaseClient
{
/**
* 获取地址列表
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
* @param $offset number 是 获取的偏移量
* @param $limit number 是 获取的个数
*
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getList($offset=0,$limit = 10)
{
$params = [
'offset' => $offset,
'limit'=>$limit
];
return $this->httpPostJson('channels/ec/merchant/address/list', $params);
}
/**
* 添加地址
* 可通过该接口添加地址
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
* @param $address_detail object AddressDetail 是 地址信息,具体信息请参考地址定义
*
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function add($address_detail)
{
$params = [
'address_detail'=>$address_detail
];
return $this->httpPostJson('channels/ec/merchant/address/add', $params);
}
/**
* 更新地址
* 可通过该接口更新地址
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
* @param $address_detail object AddressDetail 是 地址信息,具体信息请参考地址定义
*
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function update($address_detail)
{
$params = [
'address_detail'=>$address_detail
];
return $this->httpPostJson('channels/ec/merchant/address/update', $params);
}
/**
* 删除地址
* 可通过该接口删除地址
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
* @param $address_id String 是 地址id
*
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function del($address_id)
{
$params = [
'address_id' => $address_id
];
return $this->httpPostJson('channels/ec/merchant/address/delete', $params);
}
/**
* 获取商品
* 可通过指定商品ID获取商品具体信息
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
* @param $address_id String 是 地址id
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function detail($address_id)
{
$params = [
'address_id' => $address_id
];
return $this->httpPostJson('channels/ec/merchant/address/get', $params);
}
}