chiho / wechatshop
Common interface for wechat shop
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 5
Open Issues: 1
Type:package
Requires
- php: >=5.5.0
This package is not auto-updated.
Last update: 2021-10-16 12:44:25 UTC
README
微信小店接口PHP封装
官方文档
微信小店api文档地址:https://mp.weixin.qq.com/wiki/8/703923b7349a607f13fb3100163837f0.html
Install
Via Composer
{ "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.