初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
<?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\Window;
|
||||
|
||||
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
|
||||
*
|
||||
* @param $appid string 否 用于指定查询某个店铺来源的商品
|
||||
* @param $branch_id number 否 用于指定查询属于某个分店ID下的商品
|
||||
* @param $page_size number 是 单页商品数(不超过200)
|
||||
* @param $page_index number 否 页面下标,下标从1开始,默认为1
|
||||
* @param $last_buffer string 否 由上次请求返回,顺序翻页时需要传入, 会从上次返回的结果往后翻一页(填了该值后page_index不生效)
|
||||
* @param $need_total_num number 否 是否需要返回满足筛选条件的商品总数
|
||||
*
|
||||
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function getList($page_size=10,$page_index='',$last_buffer='',$appid='',$branch_id = '',$need_total_num = '')
|
||||
{
|
||||
$params = [
|
||||
'page_size' => $page_size
|
||||
];
|
||||
if($page_index){
|
||||
$params['page_index'] = $page_index;
|
||||
}
|
||||
|
||||
if($last_buffer){
|
||||
$params['last_buffer'] = $last_buffer;
|
||||
}
|
||||
if($appid){
|
||||
$params['appid'] = $appid;
|
||||
}
|
||||
if($branch_id){
|
||||
$params['branch_id'] = $branch_id;
|
||||
}
|
||||
if($page_index){
|
||||
$params['page_index'] = $page_index;
|
||||
}
|
||||
|
||||
if($need_total_num){
|
||||
$params['need_total_num'] = $need_total_num;
|
||||
}
|
||||
|
||||
return $this->httpPostJson('channels/ec/window/product/list/get', $params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上架商品到橱窗
|
||||
* 通过该接口可将商品上架到橱窗。
|
||||
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
||||
* @param $product_id string(uint64) 是 橱窗商品ID
|
||||
* @param $appid string 是 商品来源店铺的appid
|
||||
* @param $is_hide_for_window bool 否 是否需要在个人橱窗页隐藏 (默认为false)
|
||||
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function addProduct($product_id,$appid,$is_hide_for_window=false)
|
||||
{
|
||||
$params = [
|
||||
'product_id' => $product_id,
|
||||
'appid' => $appid,
|
||||
'is_hide_for_window' => $is_hide_for_window
|
||||
];
|
||||
|
||||
return $this->httpPostJson('channels/ec/window/product/add', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取橱窗商品详情
|
||||
* 通过该接口可获取橱窗商品详情。
|
||||
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
||||
*
|
||||
* @param $product_id string(uint64) 是 橱窗商品ID
|
||||
* @param $appid string 是 商品来源店铺的appid
|
||||
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function getProduct($product_id,$appid)
|
||||
{
|
||||
$params = [
|
||||
'product_id' => $product_id,
|
||||
'appid' => $appid
|
||||
];
|
||||
|
||||
return $this->httpPostJson('channels/ec/window/product/get', $params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下架橱窗商品
|
||||
* 通过该接口可将橱窗商品进行下架。
|
||||
* @return \Psr\Http\Message\ResponseInterface|\TuzhiEasyWeChat\Kernel\Support\Collection|array|object|string
|
||||
* @param $product_id string(uint64) 是 橱窗商品ID
|
||||
* @param $appid string 是 商品来源店铺的appid
|
||||
* @throws \TuzhiEasyWeChat\Kernel\Exceptions\InvalidConfigException
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
*/
|
||||
public function offProduct($product_id,$appid)
|
||||
{
|
||||
$params = [
|
||||
'product_id' => $product_id,
|
||||
'appid'=>$appid
|
||||
];
|
||||
|
||||
return $this->httpPostJson('channels/ec/window/product/off', $params);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user