-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
681 additions
and
59 deletions.
There are no files selected for viewing
123 changes: 123 additions & 0 deletions
123
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveGoodsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
package cn.binarywang.wx.miniapp.api; | ||
|
||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo; | ||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult; | ||
import me.chanjar.weixin.common.error.WxErrorException; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* <pre> | ||
* 直播间商品相关操作接口 | ||
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/commodity-api.html | ||
* Created by lipengjun on 2020/6/29. | ||
* </pre> | ||
* | ||
* @author <a href="https://github.com/lipengjun92">lipengjun ([email protected])</a> | ||
*/ | ||
public interface WxMaLiveGoodsService { | ||
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add"; | ||
String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit"; | ||
String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit"; | ||
String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete"; | ||
String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update"; | ||
String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse"; | ||
String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved"; | ||
|
||
/** | ||
* 商品添加并提审 | ||
* <pre> | ||
* 调用此接口上传并提审需要直播的商品信息,审核通过后商品录入【小程序直播】商品库 | ||
* 注意:开发者必须保存【商品ID】与【审核单ID】,如果丢失,则无法调用其他相关接口 | ||
* 调用额度:500次/一天 | ||
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/add?access_token=ACCESS_TOKEN | ||
* </pre> | ||
* | ||
* @param goods 商品 | ||
* @return 返回auditId、goodsId | ||
* @throws WxErrorException . | ||
*/ | ||
WxMaLiveResult addGoods(WxMaLiveInfo.Goods goods) throws WxErrorException; | ||
|
||
/** | ||
* 撤回审核 | ||
* <pre> | ||
* 调用此接口,可撤回直播商品的提审申请,消耗的提审次数不返还 | ||
* 调用额度:500次/一天 | ||
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit?access_token=ACCESS_TOKEN | ||
* <pre> | ||
* @param auditId 审核单ID | ||
* @param goodsId 商品ID | ||
* @return 撤回审核是否成功 | ||
* @throws WxErrorException . | ||
*/ | ||
boolean resetAudit(Integer auditId, Integer goodsId) throws WxErrorException; | ||
|
||
/** | ||
* 重新提交审核 | ||
* <pre> | ||
* 调用此接口,可撤回直播商品的提审申请,消耗的提审次数不返还 | ||
* 调用额度:500次/一天(与接口'商品添加并提审'共用500次限制) | ||
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/audit?access_token=ACCESS_TOKEN | ||
* <pre> | ||
* @param goodsId 商品ID | ||
* @return 审核单ID | ||
* @throws WxErrorException . | ||
*/ | ||
String auditGoods(Integer goodsId) throws WxErrorException; | ||
|
||
/** | ||
* 删除商品 | ||
* <pre> | ||
* 调用此接口,可删除【小程序直播】商品库中的商品,删除后直播间上架的该商品也将被同步删除,不可恢复; | ||
* 调用额度:1000次/一天 | ||
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/delete?access_token=ACCESS_TOKEN | ||
* <pre> | ||
* @param goodsId 商品ID | ||
* @return 删除商品是否成功 | ||
* @throws WxErrorException . | ||
*/ | ||
boolean deleteGoods(Integer goodsId) throws WxErrorException; | ||
|
||
/** | ||
* 更新商品 | ||
* <pre> | ||
* 调用此接口可以更新商品信息,审核通过的商品仅允许更新价格类型与价格,审核中的商品不允许更新,未审核的商品允许更新所有字段, 只传入需要更新的字段。 | ||
* 调用额度:1000次/一天 | ||
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/update?access_token=ACCESS_TOKEN | ||
* </pre> | ||
* | ||
* @param goods 商品 | ||
* @return 更新商品是否成功 | ||
* @throws WxErrorException . | ||
*/ | ||
boolean updateGoods(WxMaLiveInfo.Goods goods) throws WxErrorException; | ||
|
||
/** | ||
* 获取商品状态 | ||
* <pre> | ||
* 调用此接口可获取商品的信息与审核状态 | ||
* 调用额度:1000次/一天 | ||
* http请求方式:POST https://api.weixin.qq.com/wxa/business/getgoodswarehouse?access_token=ACCESS_TOKEN | ||
* <pre> | ||
* @param goodsIds 商品ID集 | ||
* @return 商品状态信息 | ||
* @throws WxErrorException . | ||
*/ | ||
WxMaLiveResult getGoodsWareHouse(List<Integer> goodsIds) throws WxErrorException; | ||
|
||
/** | ||
* 获取商品列表 | ||
* <pre> | ||
* 调用此接口可获取商品列表 | ||
* 调用额度:10000次/一天 | ||
* http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved?access_token=ACCESS_TOKEN | ||
* <pre> | ||
* @param offset 分页条数起点 | ||
* @param limit 分页大小,默认30,不超过100 | ||
* @param status 商品状态,0:未审核。1:审核中,2:审核通过,3:审核驳回 | ||
* @return 商品列表 | ||
* @throws WxErrorException . | ||
*/ | ||
WxMaLiveResult getApprovedGoods(Integer offset, Integer limit, Integer status) throws WxErrorException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaMaterialService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cn.binarywang.wx.miniapp.api; | ||
|
||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | ||
import me.chanjar.weixin.common.error.WxErrorException; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* <pre> | ||
* 素材管理的相关接口 | ||
* 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html | ||
* Created by lipengjun on 2020/6/29. | ||
* </pre> | ||
* | ||
* @author <a href="https://github.com/lipengjun92">lipengjun ([email protected])</a> | ||
*/ | ||
public interface WxMaMaterialService { | ||
String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?type=%s"; | ||
/** | ||
* <pre> | ||
* 新增临时素材 | ||
* 小程序获取临时素材,用于直播间商品 | ||
* 素材管理接口对所有认证的订阅号和服务号开放。通过本接口,小程序可以新增临时素材(即上传临时多媒体文件),返回的mediaId用于直播间商品使用。 | ||
* 请注意: | ||
* 1、对于临时素材,每个素材(media_id)会在开发者上传或粉丝发送到微信服务器3天后自动删除(所以用户发送给开发者的素材,若开发者需要,应尽快下载到本地),以节省服务器资源。 | ||
* 2、media_id是可复用的。 | ||
* 3、素材的格式大小等要求与公众平台官网一致。具体是,图片大小不超过2M,支持png/jpeg/jpg/gif格式,语音大小不超过5M,长度不超过60秒,支持mp3/amr格式 | ||
* 4、需使用https调用本接口。 | ||
* 本接口即为原“上传多媒体文件”接口。 | ||
* 注意事项: | ||
* 上传的临时多媒体文件有格式和大小限制,如下: | ||
* 图片(image): 2M,支持PNG\JPEG\JPG\GIF格式 | ||
* 语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式 | ||
* 视频(video):10MB,支持MP4格式 | ||
* 缩略图(thumb):64KB,支持JPG格式 | ||
* 媒体文件在后台保存时间为3天,即3天后media_id失效。 | ||
* 详情请见: <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">新增临时素材</a> | ||
* 接口url格式:https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE | ||
* </pre> | ||
* | ||
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts} | ||
* @param file 文件对象 | ||
* @throws WxErrorException | ||
*/ | ||
WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.