79 lines
2.2 KiB
PHP
79 lines
2.2 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\Basics;
|
|
|
|
use TuzhiEasyWeChat\Kernel\BaseClient;
|
|
use TuzhiEasyWeChat\Kernel\Exceptions\InvalidArgumentException;
|
|
|
|
/**
|
|
* Class Client.
|
|
*
|
|
* @author mingyoung <mingyoungcheung@gmail.com>
|
|
*/
|
|
class Client extends BaseClient
|
|
{
|
|
/**
|
|
* 获取店铺基本信息
|
|
*
|
|
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
|
*
|
|
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
*/
|
|
public function getInfo()
|
|
{
|
|
|
|
return $this->httpGet('channels/ec/basics/info/get');
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取地址行政编码
|
|
* 通过该接口可获取地址行政编码信息,最多获取4级地址的行政编码
|
|
*
|
|
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
|
*
|
|
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
*/
|
|
public function getAddressCode($addr_code=0)
|
|
{
|
|
$params = [
|
|
'addr_code' => $addr_code
|
|
];
|
|
|
|
return $this->httpPostJson('channels/ec/basics/addresscode/get', $params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 上传图片
|
|
* 可通过该接口上传图片
|
|
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
|
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
*/
|
|
public function imgUpload($img_url='',$resp_type=1)
|
|
{
|
|
$query = [
|
|
'upload_type' => 1,//上传类型。0:二进制流;1:图片url(不支持301/302跳转),该参数为 URL 参数
|
|
'resp_type'=>$resp_type
|
|
];
|
|
$form = [];
|
|
$form['img_url'] = $img_url;
|
|
|
|
return $this->httpPostJson('channels/ec/basics/img/upload',$form,$query);
|
|
}
|
|
|
|
|
|
}
|