WechatShop
微信小店接口PHP封装
官方文档
微信小店api文档地址:https://mp.weixin.qq.com/wiki/8/703923b7349a607f13fb3100163837f0.html
Install
Via Composer
{ "require": { "chiho/wechatshop": "1.0.0" } }
目录
商品管理接口 增加商品 删除商品 修改商品 查询商品 获取指定状态的所有商品 商品上下架 获取指定分类的所有子分类 获取指定分类的所有SKU 获取指定分类的所有属性 库存管理接口 增加库存 减少库存 邮费模板管理接口 增加邮费模板 删除邮费模板 修改邮费模板 获取指定ID的邮费模板 获取所有邮费模板 分组管理接口 增加分组 删除分组 修改分组属性 修改分组商品 获取所有分组 根据分组ID获取分组信息 货架管理接口 增加货架 删除货架 修改货架 获取所有货架 根据货架ID获取货架信息 订单管理接口 根据订单ID获取订单详情 根据订单状态/创建时间获取订单详情 设置订单发货信息 关闭订单 功能接口 上传图片商品管理接口
增加商品
$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.
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。