6.5.4礼物冠名
This commit is contained in:
@@ -23,12 +23,16 @@ import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.event.LiveRoomChangeEvent;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
@@ -39,10 +43,13 @@ import com.yunbao.common.utils.DeviceUtils;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.HintCustomPopup;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
@@ -253,7 +260,8 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url) {
|
||||
forward(context, url, true); }
|
||||
forward(context, url, true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -374,6 +382,43 @@ public class WebViewActivity extends AbsActivity {
|
||||
}
|
||||
}))
|
||||
.show();
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
|
||||
//看直播
|
||||
gotoLive(event.getLiveId());
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
|
||||
LiveHttpUtil.getLiveInfo(live_id, new com.yunbao.common.http.HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
||||
return;
|
||||
}
|
||||
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, live_id, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class LiveErrorEvent extends BaseModel {
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/6/27.
|
||||
*/
|
||||
|
||||
public class LiveRoomChangeEvent {
|
||||
|
||||
private LiveBean mLiveBean;
|
||||
private int mLiveType;//直播间的类型 普通 密码 门票 计时等
|
||||
private int mLiveTypeVal;//收费价格,计时收费每次扣费的值
|
||||
private boolean isLiveEnd = false;
|
||||
|
||||
public boolean isLiveEnd() {
|
||||
return isLiveEnd;
|
||||
}
|
||||
|
||||
public LiveRoomChangeEvent setLiveEnd(boolean liveEnd) {
|
||||
isLiveEnd = liveEnd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveRoomChangeEvent(LiveBean bean, int liveType, int liveTypeVal) {
|
||||
mLiveBean = bean;
|
||||
mLiveType = liveType;
|
||||
mLiveTypeVal = liveTypeVal;
|
||||
}
|
||||
|
||||
public LiveBean getLiveBean() {
|
||||
return mLiveBean;
|
||||
}
|
||||
|
||||
public int getLiveType() {
|
||||
return mLiveType;
|
||||
}
|
||||
|
||||
public int getLiveTypeVal() {
|
||||
return mLiveTypeVal;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.yunbao.common.http;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/3/21.
|
||||
*/
|
||||
|
||||
public class LiveHttpConsts {
|
||||
public static final String GET_COIN = "getCoin";
|
||||
public static final String GET_USER_LIST = "getUserList";
|
||||
public static final String ROOM_CHARGE = "roomCharge";
|
||||
public static final String TIME_CHARGE = "timeCharge";
|
||||
public static final String GET_LIVE_RECORD = "getLiveRecord";
|
||||
public static final String GET_ALI_CDN_RECORD = "getAliCdnRecord";
|
||||
public static final String GET_ALL_IMPRESS = "getAllImpress";
|
||||
public static final String SET_IMPRESS = "setImpress";
|
||||
public static final String GET_ADMIN_LIST = "getAdminList";
|
||||
public static final String SET_ADMIN = "setAdmin";
|
||||
public static final String GET_LIVE_SHUT_UP_LIST = "getLiveShutUpList";
|
||||
public static final String LIVE_CANCEL_SHUT_UP = "LiveCancelShutUp";
|
||||
public static final String GET_LIVE_BLACK_LIST = "getLiveBlackList";
|
||||
public static final String LIVE_CANCEL_BLACK = "liveCancelBlack";
|
||||
public static final String GET_LIVE_END_INFO = "getLiveEndInfo";
|
||||
public static final String SET_REPORT = "setReport";
|
||||
public static final String GET_LIVE_REPORT_LIST = "getLiveReportList";
|
||||
public static final String GET_LIVE_USER = "getLiveUser";
|
||||
public static final String KICKING = "kicking";
|
||||
public static final String SET_SHUT_UP = "setShutUp";
|
||||
public static final String SUPER_CLOSE_ROOM = "superCloseRoom";
|
||||
public static final String GET_GUARD_BUY_LIST = "getGuardBuyList";
|
||||
public static final String BUY_GUARD = "buyGuard";
|
||||
public static final String GET_GUARD_LIST = "getGuardList";
|
||||
public static final String GET_LINK_MIC_STREAM = "getLinkMicStream";
|
||||
public static final String LINK_MIC_SHOW_VIDEO = "linkMicShowVideo";
|
||||
public static final String SET_LINK_MIC_ENABLE = "setLinkMicEnable";
|
||||
public static final String CHECK_LINK_MIC_ENABLE = "checkLinkMicEnable";
|
||||
public static final String LIVE_PK_CHECK_LIVE = "livePkCheckLive";
|
||||
public static final String SEND_RED_PACK = "sendRedPack";
|
||||
public static final String GET_RED_PACK_LIST = "getRedPackList";
|
||||
public static final String ROB_RED_PACK = "robRedPack";
|
||||
public static final String GET_RED_PACK_RESULT = "getRedPackResult";
|
||||
public static final String SEND_DANMU = "sendDanmu";
|
||||
public static final String CHECK_LIVE = "checkLive";
|
||||
public static final String ENTER_ROOM = "enterRoom";
|
||||
public static final String GET_GIFT_LIST = "getGiftList";
|
||||
public static final String GET_WRAP_LIST = "getWrapList";
|
||||
public static final String GET_WISH_LIST = "getWishlist";
|
||||
public static final String SET_WISH_LIST = "setWishlist";
|
||||
|
||||
public static final String SEND_GIFT = "sendGift";
|
||||
public static final String LIVE_PK_SEARCH_ANCHOR = "livePkSearchAnchor";
|
||||
public static final String GET_LIVE_PK_LIST = "getLivePkList";
|
||||
public static final String SEARCH_MUSIC = "searchMusic";
|
||||
public static final String GET_MUSIC_URL = "getMusicUrl";
|
||||
public static final String CREATE_ROOM = "createRoom";
|
||||
public static final String CHANGE_LIVE = "changeLive";
|
||||
public static final String STOP_LIVE = "stopLive";
|
||||
public static final String GET_LIVE_SDK = "getLiveSdk";
|
||||
public static final String GET_TX_LINK_MIC_ACC_URL = "getTxLinkMicAccUrl";
|
||||
public static final String LINK_MIC_TX_MIX_STREAM = "linkMicTxMixStream";
|
||||
public static final String GET_MY_ADMIN_ROOM_LIST = "getMyAdminRoomList";
|
||||
public static final String GET_LIVE_GIFT_PRIZE_POOL = "getLiveGiftPrizePool";
|
||||
public static final String ANCHOR_CHECK_LIVE = "anchorCheckLive";
|
||||
public static final String GET_LIVE_INFO = "getLiveInfo";
|
||||
public static final String GET_EVENT = "Rank.IsActivity";
|
||||
public static final String USERHOPEPRANKTURNTABLE = "userHopePrankTurntable";
|
||||
public static final String ENDPRANKTURNTABLE = "endPrankTurntable";
|
||||
public static final String GETANCHORLASTWEEKLIST = "getAnchorLastWeekList";
|
||||
public static final String ISHOTCARD = "isHotCard";
|
||||
public static final String USEHOTCARDUSERLIST = "useHotCardUserList";
|
||||
public static final String SETINSTRUCTORREMARK = "getInstructorRemark";
|
||||
|
||||
}
|
||||
960
common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java
Normal file
960
common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java
Normal file
@@ -0,0 +1,960 @@
|
||||
package com.yunbao.common.http;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.lzy.okgo.request.GetRequest;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.VersionUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/3/21.
|
||||
*/
|
||||
|
||||
public class LiveHttpUtil {
|
||||
|
||||
// private static final String SALT = "76576076c1f5f657b634e966c8836a06";
|
||||
private static final String SALT = "123456";
|
||||
|
||||
/**
|
||||
* 取消网络请求
|
||||
*/
|
||||
public static void cancel(String tag) {
|
||||
HttpClient.getInstance().cancel(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前直播间的用户列表
|
||||
*/
|
||||
public static void getUserList(String liveuid, String stream, String type, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getUserLists", LiveHttpConsts.GET_USER_LIST)
|
||||
.params("liveuid", liveuid)
|
||||
.params("stream", stream)
|
||||
.params("type", type)
|
||||
.params("p", p)
|
||||
.params("version", "" + VersionUtil.getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播用户日榜/周榜
|
||||
*
|
||||
* @param liveUid 主播uid
|
||||
* @param callback 回调
|
||||
*/
|
||||
public static void getUserRankList(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Contribute.index", LiveHttpConsts.GET_USER_LIST)
|
||||
.params("uid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前直播间的连麦用户列表
|
||||
*/
|
||||
public static void getMicList(String liveuid, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getDrLm", "Live.getDrLm")
|
||||
.params("uid", liveuid, true)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动列表
|
||||
*/
|
||||
public static void getHDList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Active.getActiveList", "Active.getActiveList")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当直播间是门票收费,计时收费或切换成计时收费的时候,观众请求这个接口
|
||||
*
|
||||
* @param liveUid 主播的uid
|
||||
* @param stream 主播的stream
|
||||
*/
|
||||
public static void roomCharge(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.roomCharge", LiveHttpConsts.ROOM_CHARGE)
|
||||
.params("stream", stream)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当直播间是计时收费的时候,观众每隔一分钟请求这个接口进行扣费
|
||||
*
|
||||
* @param liveUid 主播的uid
|
||||
* @param stream 主播的stream
|
||||
*/
|
||||
public static void timeCharge(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.timeCharge", LiveHttpConsts.TIME_CHARGE)
|
||||
.params("stream", stream)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户余额
|
||||
*/
|
||||
public static void getCoin(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getCoin", LiveHttpConsts.GET_COIN)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的直播记录
|
||||
*
|
||||
* @param touid 对方的uid
|
||||
*/
|
||||
public static void getLiveRecord(String touid, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getLiverecord", LiveHttpConsts.GET_LIVE_RECORD)
|
||||
.params("touid", touid)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播回放url
|
||||
*
|
||||
* @param recordId 视频的id
|
||||
*/
|
||||
public static void getAliCdnRecord(String recordId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getAliCdnRecord", LiveHttpConsts.GET_ALI_CDN_RECORD)
|
||||
.params("id", recordId)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取主播印象列表
|
||||
*/
|
||||
public static void getAllImpress(String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getUserLabel", LiveHttpConsts.GET_ALL_IMPRESS)
|
||||
.params("touid", touid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给主播设置印象
|
||||
*/
|
||||
public static void setImpress(String touid, String ImpressIDs, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.setUserLabel", LiveHttpConsts.SET_IMPRESS)
|
||||
.params("touid", touid)
|
||||
.params("labels", ImpressIDs)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前直播间的管理员列表
|
||||
*/
|
||||
public static void getAdminList(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getAdminList", LiveHttpConsts.GET_ADMIN_LIST)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播设置或取消直播间的管理员
|
||||
*/
|
||||
public static void setAdmin(String liveUid, String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.setAdmin", LiveHttpConsts.SET_ADMIN)
|
||||
.params("liveuid", liveUid)
|
||||
.params("touid", touid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间的禁言列表
|
||||
*/
|
||||
public static void getLiveShutUpList(String liveUid, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemanage.getShutList", LiveHttpConsts.GET_LIVE_SHUT_UP_LIST)
|
||||
.params("liveuid", liveUid)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间解除禁言
|
||||
*/
|
||||
public static void liveCancelShutUp(String liveUid, String toUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemanage.cancelShut", LiveHttpConsts.LIVE_CANCEL_SHUT_UP)
|
||||
.params("liveuid", liveUid)
|
||||
.params("touid", toUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间的拉黑列表
|
||||
*/
|
||||
public static void getLiveBlackList(String liveUid, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemanage.getKickList", LiveHttpConsts.GET_LIVE_BLACK_LIST)
|
||||
.params("liveuid", liveUid)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间解除拉黑
|
||||
*/
|
||||
public static void liveCancelBlack(String liveUid, String toUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemanage.cancelKick", LiveHttpConsts.LIVE_CANCEL_BLACK)
|
||||
.params("liveuid", liveUid)
|
||||
.params("touid", toUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 直播结束后,获取直播收益,观看人数,时长等信息
|
||||
*/
|
||||
public static void getLiveEndInfo(String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.stopInfo", LiveHttpConsts.GET_LIVE_END_INFO)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间举报内容列表
|
||||
*/
|
||||
public static void getLiveReportList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getReportClass", LiveHttpConsts.GET_LIVE_REPORT_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报用户
|
||||
*/
|
||||
public static void setReport(String touid, String content, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.setReport", LiveHttpConsts.SET_REPORT)
|
||||
.params("touid", touid)
|
||||
.params("content", content)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报用户 + 图片
|
||||
*/
|
||||
public static void setReport(String touid, String content, File file1, File file2, File file3, String videoId, HttpCallback callback) {
|
||||
PostRequest<JsonBean> request = HttpClient.getInstance().post("Live.setReport", LiveHttpConsts.SET_REPORT)
|
||||
.isMultipart(true)
|
||||
.params("touid", touid)
|
||||
.params("content", content);
|
||||
if (file1 != null) {
|
||||
request.params("file1", file1);
|
||||
}
|
||||
if (file2 != null) {
|
||||
request.params("file2", file2);
|
||||
}
|
||||
if (file3 != null) {
|
||||
request.params("file3", file3);
|
||||
}
|
||||
if (!TextUtils.isEmpty(videoId)) {
|
||||
request.params("videoid", videoId);
|
||||
}
|
||||
request.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间点击聊天列表和头像出现的弹窗
|
||||
*/
|
||||
public static void getLiveUser(String touid, String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getPop", LiveHttpConsts.GET_LIVE_USER)
|
||||
.params("touid", touid)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播或管理员踢人
|
||||
*/
|
||||
public static void kicking(String liveUid, String touid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.kicking", LiveHttpConsts.KICKING)
|
||||
.params("liveuid", liveUid)
|
||||
.params("touid", touid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
public static void setShutUp(String liveUid, String stream, int type, String touid, HttpCallback callback) {
|
||||
setShutUp(liveUid, stream, type, touid, null, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播或管理员禁言
|
||||
* @param time 禁言时间 (分)
|
||||
*/
|
||||
public static void setShutUp(String liveUid, String stream, int type, String touid, String time, HttpCallback callback) {
|
||||
GetRequest<JsonBean> request = HttpClient.getInstance().get("Live.setShutUp", LiveHttpConsts.SET_SHUT_UP)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.params("type", type)
|
||||
.params("touid", touid);
|
||||
if (!StringUtil.isEmpty(time)) {
|
||||
request.params("minute", time);
|
||||
}
|
||||
request.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 超管关闭直播间或禁用账户
|
||||
*
|
||||
* @param type 0表示关闭当前直播 1表示禁播,2表示封禁账号
|
||||
*/
|
||||
public static void superCloseRoom(String liveUid, int type, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.superStopRoom", LiveHttpConsts.SUPER_CLOSE_ROOM)
|
||||
.params("liveuid", liveUid)
|
||||
.params("type", type)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 守护商品类型列表
|
||||
*/
|
||||
public static void getGuardBuyList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Guard.getList", LiveHttpConsts.GET_GUARD_BUY_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买守护接口
|
||||
*/
|
||||
public static void buyGuard(String liveUid, String stream, int guardId, int cid, HttpCallback callback) {
|
||||
GetRequest<JsonBean> request = HttpClient.getInstance().get("Guard.buyGuard", LiveHttpConsts.BUY_GUARD)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.params("guardid", guardId);
|
||||
if (cid != -1) {
|
||||
request = request.params("userCouponId", cid);
|
||||
}
|
||||
request.execute(callback);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查看主播的守护列表
|
||||
*/
|
||||
public static void getGuardList(String liveUid, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Guard.getGuardList", LiveHttpConsts.GET_GUARD_LIST)
|
||||
.params("liveuid", liveUid)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 观众跟主播连麦时,获取自己的流地址
|
||||
*/
|
||||
public static void getLinkMicStream(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Linkmic.requestLVBAddrForLinkMic", LiveHttpConsts.GET_LINK_MIC_STREAM)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播连麦成功后,要把这些信息提交给服务器
|
||||
*
|
||||
* @param touid 连麦用户ID
|
||||
* @param pull_url 连麦用户播流地址
|
||||
*/
|
||||
public static void linkMicShowVideo(String touid, String pull_url) {
|
||||
HttpClient.getInstance().get("Live.showVideo", LiveHttpConsts.LINK_MIC_SHOW_VIDEO)
|
||||
.params("liveuid", CommonAppConfig.getInstance().getUid())
|
||||
.params("touid", touid)
|
||||
.params("pull_url", pull_url)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播设置是否允许观众发起连麦
|
||||
*/
|
||||
public static void setLinkMicEnable(boolean linkMicEnable, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Linkmic.setMic", LiveHttpConsts.SET_LINK_MIC_ENABLE)
|
||||
.params("ismic", linkMicEnable ? 1 : 0)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 观众检查主播是否允许连麦
|
||||
*/
|
||||
public static void checkLinkMicEnable(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Linkmic.isMic", LiveHttpConsts.CHECK_LINK_MIC_ENABLE)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连麦pk检查对方主播在线状态
|
||||
*/
|
||||
public static void livePkCheckLive(String liveUid, String stream, String uidStream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Home.getisPk", "Home.getisPk")
|
||||
.params("uid", liveUid, true)
|
||||
// .params("token", CommonAppConfig.getInstance().getToken())
|
||||
// .params("liveuid", liveUid)
|
||||
// .params("stream", stream)
|
||||
// .params("uid_stream", uidStream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间发红包
|
||||
*/
|
||||
public static void sendRedPack(String stream, String coin, String count, String title, int type, int sendType, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Red.SendRed", LiveHttpConsts.SEND_RED_PACK)
|
||||
.params("stream", stream)
|
||||
.params("coin", coin)
|
||||
.params("nums", count)
|
||||
.params("des", title)
|
||||
.params("type", type)
|
||||
.params("type_grant", sendType)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间红包列表
|
||||
*/
|
||||
public static void getRedPackList(String stream, HttpCallback callback) {
|
||||
String sign = MD5Util.getMD5("stream=" + stream + "&" + SALT);
|
||||
HttpClient.getInstance().get("Red.GetRedList", LiveHttpConsts.GET_RED_PACK_LIST)
|
||||
.params("stream", stream)
|
||||
.params("sign", sign)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间抢红包
|
||||
*/
|
||||
public static void robRedPack(String stream, int redPackId, HttpCallback callback) {
|
||||
String uid = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo().getId() + "";
|
||||
String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&uid=" + uid + "&" + SALT);
|
||||
HttpClient.getInstance().get("Red.RobRed", LiveHttpConsts.ROB_RED_PACK)
|
||||
.params("uid", uid, true)
|
||||
.params("stream", stream)
|
||||
.params("redid", redPackId)
|
||||
.params("sign", sign)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 直播间红包领取详情
|
||||
*/
|
||||
public static void getRedPackResult(String stream, int redPackId, HttpCallback callback) {
|
||||
String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&" + SALT);
|
||||
HttpClient.getInstance().get("Red.GetRedRobList", LiveHttpConsts.GET_RED_PACK_RESULT)
|
||||
.params("stream", stream)
|
||||
.params("redid", redPackId)
|
||||
.params("sign", sign)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送弹幕
|
||||
*/
|
||||
public static void sendDanmu(String content, String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.sendBarrage", LiveHttpConsts.SEND_DANMU)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.params("giftid", "1")
|
||||
.params("giftcount", "1")
|
||||
.params("content", content)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查直播间状态,是否收费 是否有密码等
|
||||
*
|
||||
* @param liveUid 主播的uid
|
||||
* @param stream 主播的stream
|
||||
*/
|
||||
public static void checkLive(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.checkLive", LiveHttpConsts.CHECK_LIVE)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 观众进入直播间
|
||||
*/
|
||||
public static void enterRoom(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.enterRoom", LiveHttpConsts.ENTER_ROOM)
|
||||
.params("city", CommonAppConfig.getInstance().getCity())
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众进入直播间后,还要请求一次
|
||||
*/
|
||||
public static void enterBackRoom(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.userjoinroom", "Tx.userjoinroom")
|
||||
.params("GroupId", "g" + liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众退出直播间后,还要请求一次
|
||||
*/
|
||||
public static void qBackRoom(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.leave_room", "Tx.leave_room")
|
||||
.params("GroupId", "g" + liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼物列表,同时会返回剩余的钱
|
||||
*/
|
||||
public static void getGiftList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getGiftList", LiveHttpConsts.GET_GIFT_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼物列表,同时会返回剩余的钱(新版)
|
||||
*/
|
||||
public static void getNewGiftList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getGiftListApp", LiveHttpConsts.GET_GIFT_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取包裹列表
|
||||
*/
|
||||
public static void getWrapList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getPackList", LiveHttpConsts.GET_WRAP_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播获取心愿单列表
|
||||
*/
|
||||
public static void getWishList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Guide.getWishlist", LiveHttpConsts.GET_WISH_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户获取主播的心愿单列表
|
||||
*/
|
||||
public static void getWishList(String liveId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Guide.getWishlist", LiveHttpConsts.GET_WISH_LIST)
|
||||
.params("uid", liveId, true)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 獲取新手任務
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public static void getFrontTask(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 獲取新手任務
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public static void getFrontTask(String Token, String uid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask")
|
||||
.params("token", Token, true)
|
||||
.params("uid", uid, true)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成新手任務
|
||||
*/
|
||||
public static void setFrontTask(String type, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask")
|
||||
.params("type", type)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成新手任務
|
||||
*/
|
||||
public static void setFrontTask(String type, String liveuid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask")
|
||||
.params("type", type)
|
||||
.params("liveuid", liveuid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改心愿单列表
|
||||
*/
|
||||
public static void modifyWishList(String list, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Guide.setWishlist", LiveHttpConsts.SET_WISH_LIST)
|
||||
.params("list", list)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众给主播送礼物
|
||||
*/
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) {
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, 0, false,callback);
|
||||
}
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false,callback);
|
||||
}
|
||||
/**
|
||||
* 观众给主播送礼物
|
||||
*
|
||||
* @param isContactGift 是否为联系方式礼物
|
||||
*/
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift,HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.params("giftid", giftId)
|
||||
.params("isContactGift", isContactGift)
|
||||
.params("giftcount", giftCount)
|
||||
.params("isprank", by)
|
||||
.params("fans_exclusive_pack",isFansGroupGift?"1":"0")
|
||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众给主播送礼物發IM
|
||||
*/
|
||||
public static void sendGiftMsg(String by, String liveUid, String jsonstr, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.sendgift", LiveHttpConsts.SEND_GIFT)
|
||||
.params("GroupId", "g" + liveUid)
|
||||
.params("jsonstr", jsonstr)
|
||||
.params("isprank", by)
|
||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点亮發IM
|
||||
*/
|
||||
public static void sendZAN(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Fans.doubleClickLight", "Fans.DoubleClickLight")
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连麦pk搜索主播
|
||||
*/
|
||||
public static void livePkSearchAnchor(String key, int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livepk.search", LiveHttpConsts.LIVE_PK_SEARCH_ANCHOR)
|
||||
.params("key", key)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取主播连麦pk列表
|
||||
*/
|
||||
public static void getLivePkList(int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livepk.getLiveList", LiveHttpConsts.GET_LIVE_PK_LIST)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播添加背景音乐时,搜索歌曲
|
||||
*
|
||||
* @param key 关键字
|
||||
* @param callback
|
||||
*/
|
||||
public static void searchMusic(String key, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemusic.searchMusic", LiveHttpConsts.SEARCH_MUSIC)
|
||||
.params("key", key)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取歌曲的地址 和歌词的地址
|
||||
*/
|
||||
public static void getMusicUrl(String musicId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemusic.getDownurl", LiveHttpConsts.GET_MUSIC_URL)
|
||||
.params("audio_id", musicId)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新主播开播
|
||||
*
|
||||
* @param title 直播标题
|
||||
* @param type 直播类型 普通 密码 收费等
|
||||
* @param typeVal 密码 价格等
|
||||
* @param file 封面图片文件
|
||||
* @param callback
|
||||
*/
|
||||
public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, int clarityType, HttpCallback callback) {
|
||||
|
||||
PostRequest<JsonBean> request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM)
|
||||
.params("title", title)
|
||||
.params("liveclassid", liveClassId)
|
||||
.params("type", type)
|
||||
.params("landscape", "2")
|
||||
.params("class_type", "0")
|
||||
.params("type_val", typeVal)
|
||||
.params("clarityType", clarityType);
|
||||
if (file != null) {
|
||||
request.params("file", file);
|
||||
}
|
||||
request.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改直播状态
|
||||
*/
|
||||
public static void changeLive(String stream) {
|
||||
HttpClient.getInstance().get("Live.changeLive", LiveHttpConsts.CHANGE_LIVE)
|
||||
.params("stream", stream)
|
||||
.params("status", "1")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
L.e("开播---changeLive---->" + info[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播结束直播
|
||||
*/
|
||||
public static void stopLive(String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.stopRoom", LiveHttpConsts.STOP_LIVE)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播开播前获取sdk类型 0金山 1腾讯
|
||||
*/
|
||||
public static void getLiveSdk(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getSDK", LiveHttpConsts.GET_LIVE_SDK)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
public static void getisRong(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.isRong", "Live.isRong")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 腾讯sdk 跟主播连麦时,获取主播的低延时流
|
||||
*/
|
||||
public static void getTxLinkMicAccUrl(String originStreamUrl, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Linkmic.requestPlayUrlWithSignForLinkMic", LiveHttpConsts.GET_TX_LINK_MIC_ACC_URL)
|
||||
.params("originStreamUrl", originStreamUrl)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 连麦时候 主播混流
|
||||
*/
|
||||
public static void linkMicTxMixStream(String mergeparams) {
|
||||
HttpClient.getInstance().get("Linkmic.mergeVideoStream", LiveHttpConsts.LINK_MIC_TX_MIX_STREAM)
|
||||
.params("mergeparams", mergeparams)
|
||||
.execute(CommonHttpUtil.NO_CALLBACK);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 我是哪些直播间的管理员,返回这些直播间列表
|
||||
*/
|
||||
public static void getMyAdminRoomList(int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Livemanage.getRoomList", LiveHttpConsts.GET_MY_ADMIN_ROOM_LIST)
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取直播间奖池等级
|
||||
*/
|
||||
public static void getLiveGiftPrizePool(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Jackpot.getJackpot", LiveHttpConsts.GET_LIVE_GIFT_PRIZE_POOL)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播checkLive
|
||||
*/
|
||||
public static void anchorCheckLive(String liveUid, String stream, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.checkLiveing", LiveHttpConsts.ANCHOR_CHECK_LIVE)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取直播间信息
|
||||
*/
|
||||
public static void getLiveInfo(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getLiveInfo", LiveHttpConsts.GET_LIVE_INFO)
|
||||
.params("liveuid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 缓存动画svg
|
||||
*/
|
||||
|
||||
public static void getHcGiftList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.getSvgaList", LiveHttpConsts.GET_GIFT_LIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 缓存座骑svg
|
||||
*/
|
||||
|
||||
public static void getHczGiftList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Home.aoto_load", "Home.aoto_load")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取活动
|
||||
*/
|
||||
public static void geteEvent(String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Rank.isActivity", LiveHttpConsts.GET_EVENT)
|
||||
.params("anchorUid", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置活动
|
||||
*/
|
||||
public static void setEvent(String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Rank.crystalTimeEnd", LiveHttpConsts.GET_EVENT)
|
||||
.params("anchor_id", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整蛊转盘拯救主播
|
||||
*/
|
||||
public static void userHopePrankTurntable(String anchor_id, String prankid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Prank.userHopePrankTurntable", LiveHttpConsts.USERHOPEPRANKTURNTABLE)
|
||||
.params("prankid", prankid)
|
||||
.params("anchor_id", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 倒计时结束
|
||||
*/
|
||||
public static void endPrankTurntable(String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Prank.endPrankTurntable", LiveHttpConsts.ENDPRANKTURNTABLE)
|
||||
.params("anchor_id", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 周星榜数据
|
||||
*/
|
||||
public static void getAnchorLastWeekList(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("WeekStar.getAnchorLastWeekList", LiveHttpConsts.GETANCHORLASTWEEKLIST)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热度加成列表
|
||||
*/
|
||||
public static void useHotCardUserList(String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.useHotCardUserList", LiveHttpConsts.USEHOTCARDUSERLIST)
|
||||
.params("anchor_id", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否有热度加成
|
||||
*/
|
||||
public static void isHotCard(String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.isHotCard", LiveHttpConsts.ISHOTCARD)
|
||||
.params("anchor_id", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改im备注信息
|
||||
*/
|
||||
public static void setInstructorRemark(String touid, String remark, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.setInstructorRemark", LiveHttpConsts.SETINSTRUCTORREMARK)
|
||||
.params("touid", touid)
|
||||
.params("remark", remark)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void getNobleTrumpetNum(HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Noble.getNobleTrumpetNum", "getNobleTrumpetNum")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void nobleUseTrumpet(String trumpet_msg, String anchor_id, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Noble.nobleUseTrumpet", "nobleUseTrumpet")
|
||||
.params("", trumpet_msg)
|
||||
.params("", anchor_id)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void getStarChallengeStatus(String liveUid, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("StarChallenge.getStarChallengeStatus", "StarChallengeStatus")
|
||||
.params("liveUid", liveUid)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页关注直播
|
||||
*/
|
||||
public static void getHomeFollow(int p, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Home.getFollow", "Home.getFollow")
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.event.LiveErrorEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpConsts;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.base.CheckLiveCallBack;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/9/29.
|
||||
*/
|
||||
|
||||
public class LiveRoomCheckLivePresenter {
|
||||
|
||||
private Context mContext;
|
||||
private int mLiveType;//直播间的类型 普通 密码 门票 计时等
|
||||
private int mLiveTypeVal;//收费价格等
|
||||
private String mLiveTypeMsg;//直播间提示信息或房间密码
|
||||
private LiveBean mLiveBean;
|
||||
private ActionListener mActionListener;
|
||||
private int mLiveSdk;
|
||||
//搜索页面不提示密码
|
||||
public static boolean isRoom = false;
|
||||
|
||||
/**
|
||||
* 新的检查直播间状态方法
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param liveUid 直播间ID
|
||||
* @param stream
|
||||
*/
|
||||
public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener) {
|
||||
mContext = context;
|
||||
LiveNetManager.get(context)
|
||||
.checkLive(liveUid, stream, new CheckLiveCallBack() {
|
||||
@Override
|
||||
public void forwardNormalRoom(CheckLiveModel model) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forwardPwdRoom(CheckLiveModel model) {
|
||||
DialogUitl.showSimpleInputDialog(context, context.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
// if (mContext instanceof Activity) {
|
||||
// ((Activity) mContext).finish();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_input_password));
|
||||
return;
|
||||
}
|
||||
String password = MD5Util.getMD5(content);
|
||||
if (model.getTypeMsg().equalsIgnoreCase(password)) {
|
||||
dialog.dismiss();
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.live_password_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forwardPayRoom(CheckLiveModel model) {
|
||||
DialogUitl.showSimpleDialog(context, mLiveTypeMsg, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
LiveHttpUtil.roomCharge(liveUid, stream, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (actionListener != null) {
|
||||
actionListener.onLiveRoomChanged(liveUid, stream, model.getType(), model.getTypeVal(), model.getLiveSdk());
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
Log.e("直播间异常", "onError: " + error);
|
||||
Bus.get().post(new LiveErrorEvent());
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public LiveRoomCheckLivePresenter(Context context, ActionListener actionListener) {
|
||||
mContext = context;
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众 观看直播
|
||||
*/
|
||||
public void checkLive(LiveBean bean) {
|
||||
mLiveBean = bean;
|
||||
LiveHttpUtil.checkLive(bean.getUid(), bean.getStream(), mCheckLiveCallback);
|
||||
}
|
||||
|
||||
|
||||
private HttpCallback mCheckLiveCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
mLiveType = obj.getIntValue("type");
|
||||
mLiveTypeVal = obj.getIntValue("type_val");
|
||||
mLiveTypeMsg = obj.getString("type_msg");
|
||||
if (CommonAppConfig.LIVE_SDK_CHANGED) {
|
||||
mLiveSdk = obj.getIntValue("live_sdk");
|
||||
} else {
|
||||
mLiveSdk = CommonAppConfig.LIVE_SDK_USED;
|
||||
}
|
||||
switch (mLiveType) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
forwardNormalRoom();
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PWD:
|
||||
forwardPwdRoom();
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PAY:
|
||||
case Constants.LIVE_TYPE_TIME:
|
||||
forwardPayRoom();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e("直播间异常", "Error: " + msg);
|
||||
Bus.get().post(new LiveErrorEvent());
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLoadingDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createLoadingDialog() {
|
||||
return DialogUitl.loadingDialog(mContext);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 前往普通房间
|
||||
*/
|
||||
private void forwardNormalRoom() {
|
||||
enterLiveRoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* 前往密码房间
|
||||
*/
|
||||
private void forwardPwdRoom() {
|
||||
DialogUitl.showSimpleInputDialog(mContext, mContext.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
if (mContext instanceof Activity) {
|
||||
((Activity) mContext).finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_input_password));
|
||||
return;
|
||||
}
|
||||
String password = MD5Util.getMD5(content);
|
||||
if (mLiveTypeMsg.equalsIgnoreCase(password)) {
|
||||
dialog.dismiss();
|
||||
enterLiveRoom();
|
||||
} else {
|
||||
ToastUtil.show(mContext.getString(R.string.live_password_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 前往付费房间
|
||||
*/
|
||||
private void forwardPayRoom() {
|
||||
DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
roomCharge();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void roomCharge() {
|
||||
if (mLiveBean == null) {
|
||||
return;
|
||||
}
|
||||
LiveHttpUtil.roomCharge(mLiveBean.getUid(), mLiveBean.getStream(), mRoomChargeCallback);
|
||||
}
|
||||
|
||||
private HttpCallback mRoomChargeCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
enterLiveRoom();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLoadingDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createLoadingDialog() {
|
||||
return DialogUitl.loadingDialog(mContext);
|
||||
}
|
||||
};
|
||||
|
||||
public void cancel() {
|
||||
mActionListener = null;
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入直播间
|
||||
*/
|
||||
private void enterLiveRoom() {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onLiveRoomChanged(mLiveBean, mLiveType, mLiveTypeVal, mLiveSdk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface ActionListener {
|
||||
void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk);
|
||||
}
|
||||
|
||||
public interface NewActionListener {
|
||||
void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk);
|
||||
|
||||
void onCheckError(String contextError);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user