mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-04 20:57:47 +08:00
🎨 #1753 小程序直播部分接口代码优化重构,对照官方文档补充新增参数
This commit is contained in:
parent
19b033c41f
commit
ef0b34bb92
@ -1,6 +1,8 @@
|
||||
package me.chanjar.weixin.cp.constant;
|
||||
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业微信api地址常量类
|
||||
@ -9,6 +11,7 @@ package me.chanjar.weixin.cp.constant;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class WxCpApiPathConsts {
|
||||
public static final String DEFAULT_CP_BASE_URL = "https://qyapi.weixin.qq.com";
|
||||
|
||||
@ -26,6 +29,7 @@ public final class WxCpApiPathConsts {
|
||||
* 消息推送相关接口
|
||||
* https://work.weixin.qq.com/api/doc/90000/90135/90235
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class Message {
|
||||
/**
|
||||
* 发送应用消息
|
||||
@ -38,18 +42,21 @@ public final class WxCpApiPathConsts {
|
||||
public static final String LINKEDCORP_MESSAGE_SEND = "/cgi-bin/linkedcorp/message/send";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Agent {
|
||||
public static final String AGENT_GET = "/cgi-bin/agent/get?agentid=%d";
|
||||
public static final String AGENT_SET = "/cgi-bin/agent/set";
|
||||
public static final String AGENT_LIST = "/cgi-bin/agent/list";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class OAuth2 {
|
||||
public static final String GET_USER_INFO = "/cgi-bin/user/getuserinfo?code=%s&agentid=%d";
|
||||
public static final String GET_USER_DETAIL = "/cgi-bin/user/getuserdetail";
|
||||
public static final String URL_OAUTH2_AUTHORIZE = "https://open.weixin.qq.com/connect/oauth2/authorize";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Chat {
|
||||
public static final String APPCHAT_CREATE = "/cgi-bin/appchat/create";
|
||||
public static final String APPCHAT_UPDATE = "/cgi-bin/appchat/update";
|
||||
@ -57,6 +64,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String APPCHAT_SEND = "/cgi-bin/appchat/send";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Department {
|
||||
public static final String DEPARTMENT_CREATE = "/cgi-bin/department/create";
|
||||
public static final String DEPARTMENT_UPDATE = "/cgi-bin/department/update";
|
||||
@ -64,6 +72,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String DEPARTMENT_LIST = "/cgi-bin/department/list";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Media {
|
||||
public static final String MEDIA_GET = "/cgi-bin/media/get";
|
||||
public static final String MEDIA_UPLOAD = "/cgi-bin/media/upload?type=";
|
||||
@ -71,12 +80,14 @@ public final class WxCpApiPathConsts {
|
||||
public static final String JSSDK_MEDIA_GET = "/cgi-bin/media/get/jssdk";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Menu {
|
||||
public static final String MENU_CREATE = "/cgi-bin/menu/create?agentid=%d";
|
||||
public static final String MENU_DELETE = "/cgi-bin/menu/delete?agentid=%d";
|
||||
public static final String MENU_GET = "/cgi-bin/menu/get?agentid=%d";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Oa {
|
||||
public static final String GET_CHECKIN_DATA = "/cgi-bin/checkin/getcheckindata";
|
||||
public static final String GET_CHECKIN_OPTION = "/cgi-bin/checkin/getcheckinoption";
|
||||
@ -87,6 +98,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String APPLY_EVENT = "/cgi-bin/oa/applyevent";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Tag {
|
||||
public static final String TAG_CREATE = "/cgi-bin/tag/create";
|
||||
public static final String TAG_UPDATE = "/cgi-bin/tag/update";
|
||||
@ -97,10 +109,12 @@ public final class WxCpApiPathConsts {
|
||||
public static final String TAG_DEL_TAG_USERS = "/cgi-bin/tag/deltagusers";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class TaskCard {
|
||||
public static final String UPDATE_TASK_CARD = "/cgi-bin/message/update_taskcard";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class Tp {
|
||||
public static final String JSCODE_TO_SESSION = "/cgi-bin/service/miniprogram/jscode2session";
|
||||
public static final String GET_CORP_TOKEN = "/cgi-bin/service/get_corp_token";
|
||||
@ -111,6 +125,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String GET_AUTH_INFO = "/cgi-bin/service/get_auth_info";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class User {
|
||||
public static final String USER_AUTHENTICATE = "/cgi-bin/user/authsucc?userid=";
|
||||
public static final String USER_CREATE = "/cgi-bin/user/create";
|
||||
@ -127,6 +142,7 @@ public final class WxCpApiPathConsts {
|
||||
public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
|
||||
}
|
||||
|
||||
@UtilityClass
|
||||
public static class ExternalContact {
|
||||
@Deprecated
|
||||
public static final String GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.chanjar.weixin.cp.constant;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 企业微信常量
|
||||
@ -8,11 +10,13 @@ package me.chanjar.weixin.cp.constant;
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
@UtilityClass
|
||||
public class WxCpConsts {
|
||||
/**
|
||||
* 企业微信端推送过来的事件类型.
|
||||
* 参考文档:https://work.weixin.qq.com/api/doc#12974
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class EventType {
|
||||
/**
|
||||
* 成员关注事件.
|
||||
@ -105,6 +109,7 @@ public class WxCpConsts {
|
||||
/**
|
||||
* 企业外部联系人变更事件的CHANGE_TYPE
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class ExternalContactChangeType {
|
||||
/**
|
||||
* 新增外部联系人
|
||||
@ -128,6 +133,7 @@ public class WxCpConsts {
|
||||
/**
|
||||
* 企业微信通讯录变更事件.
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class ContactChangeType {
|
||||
/**
|
||||
* 新增成员事件.
|
||||
@ -169,6 +175,7 @@ public class WxCpConsts {
|
||||
/**
|
||||
* 互联企业发送应用消息的消息类型.
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class LinkedCorpMsgType {
|
||||
/**
|
||||
* 文本消息.
|
||||
@ -213,6 +220,7 @@ public class WxCpConsts {
|
||||
/**
|
||||
* 群机器人的消息类型.
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class GroupRobotMsgType {
|
||||
/**
|
||||
* 文本消息.
|
||||
@ -238,6 +246,7 @@ public class WxCpConsts {
|
||||
/**
|
||||
* 应用推送消息的消息类型.
|
||||
*/
|
||||
@UtilityClass
|
||||
public static class AppChatMsgType {
|
||||
/**
|
||||
* 文本消息.
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.util.List;
|
||||
@ -37,7 +37,7 @@ public interface WxMaLiveGoodsService {
|
||||
* @return 返回auditId、goodsId
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxMaLiveResult addGoods(WxMaLiveInfo.Goods goods) throws WxErrorException;
|
||||
WxMaLiveResult addGoods(WxMaLiveGoodInfo goods) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 撤回审核
|
||||
@ -91,7 +91,7 @@ public interface WxMaLiveGoodsService {
|
||||
* @return 更新商品是否成功
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
boolean updateGoods(WxMaLiveInfo.Goods goods) throws WxErrorException;
|
||||
boolean updateGoods(WxMaLiveGoodInfo goods) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取商品状态
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.binarywang.wx.miniapp.api;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
|
||||
import java.util.List;
|
||||
@ -31,7 +31,7 @@ public interface WxMaLiveService {
|
||||
* @return .
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
Integer createRoom(WxMaLiveInfo.RoomInfo roomInfo) throws WxErrorException;
|
||||
Integer createRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取直播房间列表.(分页)
|
||||
|
@ -2,16 +2,14 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaLiveGoodsService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import me.chanjar.weixin.common.enums.WxType;
|
||||
import me.chanjar.weixin.common.error.WxError;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.util.json.GsonParser;
|
||||
|
||||
@ -32,15 +30,9 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public WxMaLiveResult addGoods(WxMaLiveInfo.Goods goods) throws WxErrorException {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("goodsInfo", goods);
|
||||
String responseContent = this.wxMaService.post(ADD_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaLiveResult.fromJson(jsonObject.toString());
|
||||
public WxMaLiveResult addGoods(WxMaLiveGoodInfo goods) throws WxErrorException {
|
||||
return WxMaLiveResult.fromJson(this.wxMaService.post(ADD_GOODS,
|
||||
WxMaGsonBuilder.create().toJson(ImmutableMap.of("goodsInfo", goods))));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,11 +40,7 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
Map<String, Integer> map = new HashMap<>(4);
|
||||
map.put("auditId", auditId);
|
||||
map.put("goodsId", goodsId);
|
||||
String responseContent = this.wxMaService.post(RESET_AUDIT_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
this.wxMaService.post(RESET_AUDIT_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,9 +50,6 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
map.put("goodsId", goodsId);
|
||||
String responseContent = this.wxMaService.post(AUDIT_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return jsonObject.get("auditId").getAsString();
|
||||
}
|
||||
|
||||
@ -72,23 +57,15 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
public boolean deleteGoods(Integer goodsId) throws WxErrorException {
|
||||
Map<String, Integer> map = new HashMap<>(2);
|
||||
map.put("goodsId", goodsId);
|
||||
String responseContent = this.wxMaService.post(DELETE_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
this.wxMaService.post(DELETE_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateGoods(WxMaLiveInfo.Goods goods) throws WxErrorException {
|
||||
public boolean updateGoods(WxMaLiveGoodInfo goods) throws WxErrorException {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("goodsInfo", goods);
|
||||
String responseContent = this.wxMaService.post(UPDATE_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
this.wxMaService.post(UPDATE_GOODS, WxMaGsonBuilder.create().toJson(map));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -97,11 +74,7 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("goods_ids", goodsIds);
|
||||
String responseContent = this.wxMaService.post(GET_GOODS_WARE_HOUSE, WxMaGsonBuilder.create().toJson(map));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
return WxMaLiveResult.fromJson(jsonObject.toString());
|
||||
return WxMaLiveResult.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,9 +82,6 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
|
||||
ImmutableMap<String, ? extends Serializable> params = ImmutableMap.of("status", status, "offset", offset, "limit", limit);
|
||||
String responseContent = wxMaService.get(GET_APPROVED_GOODS, Joiner.on("&").withKeyValueSeparator("=").join(params));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
|
||||
}
|
||||
JsonArray goodsArr = jsonObject.getAsJsonArray("goods");
|
||||
if (goodsArr.size() > 0) {
|
||||
for (int i = 0; i < goodsArr.size(); i++) {
|
||||
|
@ -2,8 +2,8 @@ package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaLiveService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo;
|
||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -31,7 +31,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
|
||||
private final WxMaService wxMaService;
|
||||
|
||||
@Override
|
||||
public Integer createRoom(WxMaLiveInfo.RoomInfo roomInfo) throws WxErrorException {
|
||||
public Integer createRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException {
|
||||
String responseContent = this.wxMaService.post(CREATE_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));
|
||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||
if (jsonObject.get("errcode").getAsInt() != 0) {
|
||||
|
@ -1,60 +0,0 @@
|
||||
package cn.binarywang.wx.miniapp.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直播接口入参
|
||||
*
|
||||
* @author yjwang
|
||||
* @date 2020/4/5
|
||||
*/
|
||||
@Data
|
||||
public class WxMaLiveInfo implements Serializable {
|
||||
private static final long serialVersionUID = 7285263767524755887L;
|
||||
|
||||
/**
|
||||
* 直播列表
|
||||
*/
|
||||
@Data
|
||||
public static class RoomInfo implements Serializable {
|
||||
private static final long serialVersionUID = 7745775280267417154L;
|
||||
private String name;
|
||||
private Integer roomid;
|
||||
private String coverImg;
|
||||
private String shareImg;
|
||||
private Integer liveStatus;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private String anchorName;
|
||||
private String anchorWechat;
|
||||
private String anchorImg;
|
||||
private Integer type;
|
||||
private Integer screenType;
|
||||
private Integer closeLike;
|
||||
private Integer closeGoods;
|
||||
private Integer closeComment;
|
||||
private List<Goods> goods;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@Data
|
||||
public static class Goods implements Serializable {
|
||||
private static final long serialVersionUID = 5769245932149287574L;
|
||||
private Integer goodsId;
|
||||
private String coverImgUrl;
|
||||
private String url;
|
||||
private Integer priceType;
|
||||
private String price;
|
||||
private String price2;
|
||||
private String name;
|
||||
/**
|
||||
* 1, 2:表示是为api添加商品,否则是在MP添加商品
|
||||
*/
|
||||
private String thirdPartyTag;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.binarywang.wx.miniapp.bean.live;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 直播商品信息
|
||||
*/
|
||||
@Data
|
||||
public class WxMaLiveGoodInfo implements Serializable {
|
||||
private static final long serialVersionUID = 5769245932149287574L;
|
||||
private Integer goodsId;
|
||||
private String coverImgUrl;
|
||||
private String url;
|
||||
private Integer priceType;
|
||||
private String price;
|
||||
private String price2;
|
||||
private String name;
|
||||
/**
|
||||
* 1, 2:表示是为api添加商品,否则是在MP添加商品
|
||||
*/
|
||||
private String thirdPartyTag;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.binarywang.wx.miniapp.bean;
|
||||
package cn.binarywang.wx.miniapp.bean.live;
|
||||
|
||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
@ -18,8 +18,6 @@ import java.util.List;
|
||||
@Data
|
||||
public class WxMaLiveResult implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer errcode;
|
||||
private String errmsg;
|
||||
private Integer total;
|
||||
private Integer auditId;
|
||||
private Integer goodsId;
|
@ -0,0 +1,86 @@
|
||||
package cn.binarywang.wx.miniapp.bean.live;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 直播间信息
|
||||
*/
|
||||
@Data
|
||||
public class WxMaLiveRoomInfo implements Serializable {
|
||||
private static final long serialVersionUID = 7745775280267417154L;
|
||||
|
||||
/**
|
||||
* 直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符
|
||||
**/
|
||||
private String name;
|
||||
/**
|
||||
* 背景图,填入mediaID(mediaID获取后,三天内有效);图片mediaID的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html;直播间背景图,图片规则:建议像素1080*1920,大小不超过2M
|
||||
**/
|
||||
private String coverImg;
|
||||
/**
|
||||
* 直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)
|
||||
**/
|
||||
private Long startTime;
|
||||
/**
|
||||
* 直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)
|
||||
**/
|
||||
private Long endTime;
|
||||
/**
|
||||
* 主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符
|
||||
**/
|
||||
private String anchorName;
|
||||
/**
|
||||
* 主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证, 小程序二维码链接:https://res.wx.qq.com/op_res/BbVNeczA1XudfjVqCVoKgfuWe7e3aUhokktRVOqf_F0IqS6kYR--atCpVNUUC3zr
|
||||
**/
|
||||
private String anchorWechat;
|
||||
/**
|
||||
* 主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证, 小程序二维码链接:https://res.wx.qq.com/op_res/BbVNeczA1XudfjVqCVoKgfuWe7e3aUhokktRVOqf_F0IqS6kYR--atCpVNUUC3zr
|
||||
**/
|
||||
private String subAnchorWechat;
|
||||
/**
|
||||
* 分享图,填入mediaID(mediaID获取后,三天内有效);图片mediaID的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html;直播间分享图,图片规则:建议像素800*640,大小不超过1M;
|
||||
**/
|
||||
private String shareImg;
|
||||
/**
|
||||
* 购物直播频道封面图,填入mediaID(mediaID获取后,三天内有效);图片mediaID的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html; 购物直播频道封面图,图片规则:建议像素800*800,大小不超过100KB;
|
||||
**/
|
||||
private String feedsImg;
|
||||
/**
|
||||
* 是否开启官方收录 【1: 开启,0:关闭】,默认开启收录
|
||||
**/
|
||||
private Integer isFeedsPublic;
|
||||
/**
|
||||
* 直播间类型 【1: 推流,0:手机直播】
|
||||
**/
|
||||
private Integer type;
|
||||
/**
|
||||
* 横屏、竖屏 【1:横屏,0:竖屏】(横屏:视频宽高比为16:9、4:3、1.85:1 ;竖屏:视频宽高比为9:16、2:3)
|
||||
**/
|
||||
private Integer screenType;
|
||||
/**
|
||||
* 是否关闭点赞 【0:开启,1:关闭】(若关闭,直播开始后不允许开启)
|
||||
**/
|
||||
private Integer closeLike;
|
||||
/**
|
||||
* 是否关闭货架 【0:开启,1:关闭】(若关闭,直播开始后不允许开启)
|
||||
**/
|
||||
private Integer closeGoods;
|
||||
/**
|
||||
* 是否关闭评论 【0:开启,1:关闭】(若关闭,直播开始后不允许开启)
|
||||
**/
|
||||
private Integer closeComment;
|
||||
/**
|
||||
* 是否关闭回放 【0:开启,1:关闭】默认关闭回放
|
||||
**/
|
||||
private Integer closeReplay;
|
||||
/**
|
||||
* 是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)
|
||||
**/
|
||||
private Integer loseShare;
|
||||
/**
|
||||
* closeKf Number 否 是否关闭客服 【0:开启,1:关闭】 默认关闭客服
|
||||
**/
|
||||
private Integer closeKf;
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
@ -31,7 +31,7 @@ public class WxMaLiveGoodsServiceImplTest {
|
||||
//上传临时素材
|
||||
WxMediaUploadResult mediaUpload = this.wxService.getMediaService().uploadMedia("image", new File("E:\\1.png"));
|
||||
|
||||
WxMaLiveInfo.Goods goods = new WxMaLiveInfo.Goods();
|
||||
WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo();
|
||||
goods.setCoverImgUrl(mediaUpload.getMediaId());
|
||||
goods.setName("宫廷奢华真丝四件套");
|
||||
goods.setPrice("1599");
|
||||
@ -64,7 +64,7 @@ public class WxMaLiveGoodsServiceImplTest {
|
||||
@Test
|
||||
public void updateGoods() throws Exception {
|
||||
|
||||
WxMaLiveInfo.Goods goods = new WxMaLiveInfo.Goods();
|
||||
WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo();
|
||||
goods.setGoodsId(8);
|
||||
goods.setName("宫廷奢华真丝四件套");
|
||||
goods.setCoverImgUrl("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuUQE0WPVfqdnLV61JDhluXOac7PiaoZeticFpcR7wvicC0aXUC2VXkl7r1gN0QSKosv2satn6oCFeiaQ/0");
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.binarywang.wx.miniapp.api.impl;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveInfo;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
|
||||
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo;
|
||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||
@ -33,7 +33,7 @@ public class WxMaLiveServiceImplTest {
|
||||
//上传临时素材
|
||||
WxMediaUploadResult mediaUpload = this.wxService.getMediaService().uploadMedia("image", new File("E:\\1.png"));
|
||||
|
||||
WxMaLiveInfo.RoomInfo roomInfo = new WxMaLiveInfo.RoomInfo();
|
||||
WxMaLiveRoomInfo roomInfo = new WxMaLiveRoomInfo();
|
||||
roomInfo.setName("订阅通知直播间");
|
||||
roomInfo.setCoverImg(mediaUpload.getMediaId());
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
Loading…
Reference in New Issue
Block a user