2017 © Pedro Peláez
 

package wechatshop

Common interface for wechat shop

image

chiho/wechatshop

Common interface for wechat shop

  • Thursday, December 14, 2017
  • by Chiho
  • Repository
  • 1 Watchers
  • 4 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WechatShop

微信小店接口PHP封装, (*1)

官方文档

微信小店api文档地址:https://mp.weixin.qq.com/wiki/8/703923b7349a607f13fb3100163837f0.html, (*2)

Install

Via Composer, (*3)

{
    "require": {
        "chiho/wechatshop": "1.0.0"
    }
}

目录

商品管理接口

增加商品

$product = new CHWechatShopProduct();
$product->setName('name')->setCategoryId('cat_id')->setMainImage('imageUrl')->addImage('imageUrl')->addDetailText('text'));
CHWechatShop::productCreate($product);

删除商品

CHWechatShop::productRemove('product_id');

修改商品

$product = new CHWechatShopProduct();
$product->setName('name')->setCategoryId('cat_id')->setMainImage('imageUrl')->addImage('imageUrl')->addDetailText('text'));
CHWechatShop::productModify($product);

查询商品

CHWechatShop::getProductByStatus(CHWechatShopConst::PRODUCT_SHELVE);

获取指定状态的所有商品

CHWechatShop::getProduct('product_id');

商品上下架

CHWechatShop::productStatus('product_id', CHWechatShopConst::PRODUCT_SHELVE);

获取指定分类的所有子分类

CHWechatShop::getCategories('cat_id');

获取指定分类的库存信息

CHWechatShop::getCategorySKU('cat_id');

获取指定分类的所有属性

CHWechatShop::getCategoryProperty('cat_id');

库存管理接口

增加库存

CHWechatShop::addStock('product_id', 1);

减少库存

CHWechatShop::reduceStock('product_id', 1);

邮费模板管理接口

增加邮费模板

$templete = new CHWechatShopExpressTemplate();
$normalFee = new CHWechatShopExpressFee();
$customFee = new CHWechatShopExpressFee();
$normalFee->setFee(1, 100, 1, 200);
$customFee->setFee(2, 200, 2, 400)->setCity('中国', '广东省', '广州市');
$templete->setName('name')->setAssumer(CHWechatShopConst::BUYER_PAY_DELIVERY_FEE)->addFee(CHWechatShopConst::DELIVERY_TYPE_ID_EXPRESS, $normalFee, array($customFee));
CHWechatShop::expressTemplateCreate($templete);

修改邮费模板

$templete = new CHWechatShopExpressTemplate();
$normalFee = new CHWechatShopExpressFee();
$customFee = new CHWechatShopExpressFee();
$normalFee->setFee(1, 100, 1, 200);
$customFee->setFee(2, 200, 2, 400)->setCity('中国', '广东省', '广州市');
$templete->setName('name')->setAssumer(CHWechatShopConst::BUYER_PAY_DELIVERY_FEE)->addFee(CHWechatShopConst::DELIVERY_TYPE_ID_EXPRESS, $normalFee, array($customFee));
CHWechatShop::expressTemplateModify('templete_id', $templete);

获取邮费模板

CHWechatShop::getExpressTemplate('templete_id');

获取所有邮费模板

CHWechatShop::getAllExpressTemplate();

删除邮费模板

CHWechatShop::expressTemplateRemove('templete_id');

分组管理接口

增加分组

$group = new CHWechatShopGroup();
$group->setGroupName('name')->addProduct('product_id');
CHWechatShop::groupCreate($group);

删除分组

CHWechatShop::groupRemove('group_id');

修改分组属性

CHWechatShop::updateGroupName('group_id', 'name');

修改分组商品

$modify = new CHWechatShopGroupModify('product_id', CHWechatShopConst::GROUP_PRODUCT_ADD);
CHWechatShop::updateGroupProduct('group_id', array($modify));

获取所有分组

CHWechatShop::getAllGroup();

获取分组信息

CHWechatShop::getGroup('group_id');

货架管理接口

增加货架

$shelf = (new CHWechatShopShelf())->setShelfBanner('imageUrl')->setShelfName('name');
$shelf->addShelfData((new CHWechatShopShelfData1())->setProductCount(1)->setGroupId('group_id'));
CHWechatShop::shelfCreate($shelf);

删除货架

CHWechatShop::shelfRemove('shelf_id');

修改货架

$shelf = (new CHWechatShopShelf())->setShelfBanner('imageUrl')->setShelfName('name');
$shelf->addShelfData((new CHWechatShopShelfData1())->setProductCount(1)->setGroupId('group_id'));
CHWechatShop::shelfModify($shelf);

获取所有货架

CHWechatShop::getAllShelf();

获取货架信息

CHWechatShop::getShelf('shelf_id');

订单管理接口

获取订单详情

CHWechatShop::getOrder('order_id');

根据条件获取订单详情

CHWechatShop::getOrderByStatus(CHWechatShopConst::ORDER_STATUS_TO_SEND, 0, 1491795684);

设置订单发货信息

$delivery = new CHWechatShopDelivery();
$delivery->setOrderId('order_id')->setDeliveryTrackNo('track_no')->setDeliveryCompany(CHWechatShopConst::EXPRESS_ID_SHUNFENG);
CHWechatShop::setDelivery($delivery);

关闭订单

CHWechatShop::orderClose('order_id');

功能接口

上传图片

CHWechatShop::uploadImage('filePath', "imageName");

License

The MIT License (MIT). Please see License File for more information., (*4)

The Versions

14/12 2017

dev-master

9999999-dev https://github.com/ChiHoc/WechatShop

Common interface for wechat shop

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Chiho Chan

27/11 2017

1.0.0

1.0.0.0

Common interface for wechat shop

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Chiho Chan