File tree Expand file tree Collapse file tree
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818import java .util .List ;
1919import java .util .Map ;
2020
21- import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Broadcast .*;
21+ import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Broadcast .GET_LIVE_INFO ;
22+ import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Broadcast .Room ;
2223
2324/**
2425 * <pre>
@@ -36,13 +37,20 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
3637
3738 @ Override
3839 public WxMaCreateRoomResult createRoom (WxMaLiveRoomInfo roomInfo ) throws WxErrorException {
39- String responseContent = this .wxMaService .post (Room .CREATE_ROOM , WxMaGsonBuilder .create ().toJson (roomInfo ));
40- JsonObject jsonObject = GsonParser .parse (responseContent );
41- if (jsonObject .get (ERR_CODE ).getAsInt () != 0 ) {
42- throw new WxErrorException (WxError .fromJson (responseContent , WxType .MiniApp ));
40+ try {
41+ String responseContent = this .wxMaService .post (Room .CREATE_ROOM , WxMaGsonBuilder .create ().toJson (roomInfo ));
42+ JsonObject jsonObject = GsonParser .parse (responseContent );
43+ if (jsonObject .get (ERR_CODE ).getAsInt () != 0 ) {
44+ throw new WxErrorException (WxError .fromJson (responseContent , WxType .MiniApp ));
45+ }
46+ return WxMaGsonBuilder .create ().fromJson (responseContent , WxMaCreateRoomResult .class );
47+ } catch (WxErrorException e ) {
48+ if (e .getError ().getErrorCode () == 300036 ) {
49+ return WxMaGsonBuilder .create ().fromJson (e .getError ().getJson (), WxMaCreateRoomResult .class );
50+ } else {
51+ throw e ;
52+ }
4353 }
44-
45- return WxMaGsonBuilder .create ().fromJson (responseContent , WxMaCreateRoomResult .class );
4654 }
4755
4856 @ Override
You can’t perform that action at this time.
0 commit comments