mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	🎨 #2785【小程序】获取直播间分享二维码接口优化,支持分享路径和海报
This commit is contained in:
		| @ -84,7 +84,7 @@ public interface WxMaLiveService { | ||||
|    * @return . | ||||
|    * @throws WxErrorException . | ||||
|    */ | ||||
|   String getSharedCode(Integer roomId, String params) throws WxErrorException; | ||||
|   WxMaLiveSharedCode getSharedCode(Integer roomId, String params) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 获取直播房间列表.(分页) | ||||
|  | ||||
| @ -87,7 +87,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService { | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public String getSharedCode(Integer roomId, String params) throws WxErrorException { | ||||
|   public WxMaLiveSharedCode getSharedCode(Integer roomId, String params) throws WxErrorException { | ||||
|     Map<String, Object> map = new HashMap<>(2); | ||||
|     map.put(ROOM_ID, roomId); | ||||
|     if (null != params) { | ||||
| @ -98,7 +98,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService { | ||||
|     if (jsonObject.get(ERR_CODE).getAsInt() != 0) { | ||||
|       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp)); | ||||
|     } | ||||
|     return jsonObject.get("cdnUrl").getAsString(); | ||||
|     return WxMaGsonBuilder.create().fromJson(responseContent, WxMaLiveSharedCode.class); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|  | ||||
| @ -0,0 +1,25 @@ | ||||
| package cn.binarywang.wx.miniapp.bean.live; | ||||
|  | ||||
| import com.google.gson.annotations.SerializedName; | ||||
| import lombok.Data; | ||||
|  | ||||
| import java.io.Serializable; | ||||
|  | ||||
| public class WxMaLiveSharedCode implements Serializable { | ||||
|     private static final long serialVersionUID = 8525117884393611947L; | ||||
|     /** | ||||
|      * 分享二维码 | ||||
|      */ | ||||
|     @SerializedName("cdnUrl") | ||||
|     private String cdnUrl; | ||||
|     /** | ||||
|      * 分享路径 | ||||
|      */ | ||||
|     @SerializedName("pagePath") | ||||
|     private String pagePath; | ||||
|     /** | ||||
|      * 分享海报 | ||||
|      */ | ||||
|     @SerializedName("posterUrl") | ||||
|     private String posterUrl; | ||||
| } | ||||
| @ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; | ||||
| import cn.binarywang.wx.miniapp.bean.live.WxMaCreateRoomResult; | ||||
| import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; | ||||
| import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo; | ||||
| import cn.binarywang.wx.miniapp.bean.live.WxMaLiveSharedCode; | ||||
| import cn.binarywang.wx.miniapp.test.ApiTestModule; | ||||
| import com.google.inject.Inject; | ||||
| import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | ||||
| @ -95,7 +96,7 @@ public class WxMaLiveServiceImplTest { | ||||
|  | ||||
|   @Test | ||||
|   public void getSharedCode() throws Exception { | ||||
|     String result = this.wxService.getLiveService().getSharedCode(39, null); | ||||
|     WxMaLiveSharedCode result = this.wxService.getLiveService().getSharedCode(39, null); | ||||
|     System.out.println(result); | ||||
|   } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 linlinjava
					linlinjava