🎨 #2785【小程序】获取直播间分享二维码接口优化,支持分享路径和海报

This commit is contained in:
linlinjava
2022-08-21 14:56:49 +08:00
committed by Binary Wang
parent c78a1f5132
commit 0f9e75acb2
4 changed files with 30 additions and 4 deletions

View File

@@ -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;
/**
* 获取直播房间列表.(分页)

View File

@@ -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

View File

@@ -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;
}