Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
* 获取直播房间列表.(分页)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String getPushUrl(Integer roomId) throws WxErrorException {
}

@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) {
Expand All @@ -98,7 +98,7 @@ public String getSharedCode(Integer roomId, String params) throws WxErrorExcepti
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void getPushUrl() throws Exception {

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

Expand Down