Files
jiecheng-business/libdata/src/main/java/com/migu/httputils/MatchHttpUtils.java
zhaogd d11464d466 基线备份:thirdparty 变体完成 + Android 4.2 兼容改造前
包含内容:
- thirdparty flavor 独立 applicationId + Intent 入口(ThirdPartyEntryActivity)
- 58 后端接口适配(单 /api 路径、code 0/200、camelCase 字段、UNBOUND 轮询)
- MAC 硬件锚定校验(防一凭证多设备共用)
- EPG mac 覆盖 SDK init(sMacOverride)+ ChannelManger 初始化对齐
- 提示文案优化(设备未注册/权益未绑定)
2026-08-25 11:16:40 +08:00

267 lines
9.6 KiB
Java
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.migu.httputils;
import com.google.gson.Gson;
import com.migu.bean.ShortVideoBean;
import com.migu.bean.ShortVideoInfoListBean;
import com.migu.bean.StarInfoIndexBean;
import com.migu.bean.SubmitPointsLikesBean;
import com.migu.bean.SupportVoteBean;
import com.migu.bean.TopicVoteInfoBean;
import com.migu.callback.AijiaCallback;
import com.migu.callback.CommonCallback;
import com.migu.libnetwork.HttpRequestCallback;
import com.migu.libnetwork.HttpUtils;
import com.pukka.libcore.boxShared.BoxSharedParameters;
import java.util.TreeMap;
/**
* 赛会楼层迁移相关请求接口
* @author ouyang
*/
public class MatchHttpUtils extends BaseHttpUtils {
/**
* 投票互动( 获取活动双方信息接口)
*/
private static final String GET_VOTE_INFO = PATH_PARAM_MATCH + "/voteInfo";
/**
* 记录支持次数接口(观众互动投票,将支持队伍次数请求给后端)
*/
private static final String VOTE_SUPPORT = PATH_PARAM_MATCH + "/voteSupport";
/**
* 人气榜详情接口(通过此接口,获取用户点赞的球员、球队、嘉宾数据)
*/
private static final String GET_POPULARITY_RANK = PATH_PARAM_MATCH + "/star/getPopularityRank";
/**
* 人气榜点赞接口(通过此接口,获取用户点赞的球员、球队、嘉宾数据)
*/
private static final String SUBMIT_LIKE = PATH_PARAM_MATCH + "/star/submitPopularPointsLike";
/**
* 短视频
*/
private static final String getShortVideoList = PATH_PARAM_MATCH + "/shortVideoList";
/**
* 获取活动双方信息接口
*/
public static void getVoteInfo(String topicId,String seasonCode, CommonCallback mCommonCallback) {
TreeMap<String, String> map = new TreeMap<>();
map.put("stbid", getStbId());
String timeShift = getTimeShift();
map.put("timestamp", timeShift);
map.put("sign", getSign(timeShift));
map.put("channelId", getChannelId());
map.put("sptoken", getSpToken());
map.put("portalcode", getPortalCode());
map.put("topicId", topicId);
map.put("seasonCode", seasonCode);
HttpUtils.getInstance().executePost(GET_VOTE_INFO, map, 0, new HttpRequestCallback() {
@Override
public void onRequestNetFail(int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
@Override
public void onRequestSuccess(String result, int type) {
if (mCommonCallback != null) {
TopicVoteInfoBean collectBean = new Gson().fromJson(result, TopicVoteInfoBean.class);
mCommonCallback.onResponse(collectBean);
}
}
@Override
public void onRequestFail(String value, String failCode, int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
});
}
/**
* 投票提交
*/
public static void voteSupport(String teamAId, String teamBId, String teamACount, String teamBCount, String topicId,String seasonCode, CommonCallback mCommonCallback) {
TreeMap<String, String> map = new TreeMap<>();
map.put("stbid", getStbId());
String timeShift = getTimeShift();
map.put("timestamp", timeShift);
map.put("sign", getSign(timeShift));
map.put("channelId", getChannelId());
map.put("sptoken", getSpToken());
map.put("portalcode", getPortalCode());
map.put("teamAId", teamAId);
map.put("teamBId", teamBId);
map.put("teamACount", teamACount);
map.put("teamBCount", teamBCount);
map.put("topicId", topicId);
map.put("seasonCode", seasonCode);
HttpUtils.getInstance().executePost(VOTE_SUPPORT, map, 0, new HttpRequestCallback() {
@Override
public void onRequestNetFail(int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
@Override
public void onRequestSuccess(String result, int type) {
if (mCommonCallback != null) {
SupportVoteBean collectBean = new Gson().fromJson(result, SupportVoteBean.class);
mCommonCallback.onResponse(collectBean);
}
}
@Override
public void onRequestFail(String value, String failCode, int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
});
}
/**
* 人气榜详情接口
*/
public static void getPopularityRank(String seasonCode,CommonCallback mCommonCallback) {
TreeMap<String, String> map = new TreeMap<>();
map.put("stbid", getStbId());
String timeShift = getTimeShift();
map.put("timestamp", timeShift);
map.put("sign", getSign(timeShift));
map.put("sptoken", getSpToken());
map.put("portalcode", getPortalCode());
map.put("channelId", getChannelId());
map.put("seasonCode", seasonCode);
HttpUtils.getInstance().executePost(GET_POPULARITY_RANK, map, 0, new HttpRequestCallback() {
@Override
public void onRequestNetFail(int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
@Override
public void onRequestSuccess(String result, int type) {
if (mCommonCallback != null) {
StarInfoIndexBean collectBean = new Gson().fromJson(result, StarInfoIndexBean.class);
mCommonCallback.onResponse(collectBean);
}
}
@Override
public void onRequestFail(String value, String failCode, int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
});
}
/**
* 人气榜点赞接口
* flag:0 球队点赞 1,短视频点赞
*/
public static void submitPopularPointsLike(SubmitPointsLikesBean pointsLikes, ShortVideoInfoListBean shortVideoInfoList,
int flag, String seasonCode, CommonCallback mCommonCallback) {
TreeMap<String, Object> map = new TreeMap<>();
map.put("stbId", getStbId());
String timeShift = getTimeShift();
map.put("timestamp", timeShift);
map.put("sign", getSign(timeShift));
map.put("userId", BoxSharedParameters.getInstance().getUserId());
map.put("sptoken", getSpToken());
map.put("portalcode", getPortalCode());
if (flag ==0 ){
map.put("pointsLikes", pointsLikes);
}else if (flag == 1){
map.put("pointsLikes", shortVideoInfoList);
}
map.put("channelId",getChannelId());
map.put("seasonCode", seasonCode);
HttpUtils.getInstance().executePost(SUBMIT_LIKE, map, 0, new HttpRequestCallback() {
@Override
public void onRequestNetFail(int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
@Override
public void onRequestSuccess(String result, int type) {
if (mCommonCallback != null) {
SupportVoteBean collectBean = new Gson().fromJson(result, SupportVoteBean.class);
mCommonCallback.onResponse(collectBean);
}
}
@Override
public void onRequestFail(String value, String failCode, int type) {
if (mCommonCallback != null) {
mCommonCallback.onFail();
}
}
});
}
/**
* 获取活动双方信息接口
*/
public static void getShortVideoList(String name,String pageIndex, String seasonCode, String columnId, AijiaCallback.GetShortVideoCallBack shortVideoCallBack) {
TreeMap<String, String> map = new TreeMap<>();
String timeShift = getTimeShift();
map.put( "seasonCode",seasonCode);
map.put( "columnId" ,columnId);
map.put( "columnName",name);
map.put( "pageIndex" , pageIndex);
map.put( "pageSize" , "10");
map.put( "portalcode",getPortalCode());
map.put( "sptoken" ,getSpToken());
map.put( "timestamp" , timeShift);
map.put( "sign" ,getSign(timeShift));
map.put( "channelId" ,BoxSharedParameters.getInstance().getChannelId());
HttpUtils.getInstance().executePost(getShortVideoList, map, 0, new HttpRequestCallback() {
@Override
public void onRequestNetFail(int type) {
if (shortVideoCallBack != null) {
shortVideoCallBack.fail();
}
}
@Override
public void onRequestSuccess(String result, int type) {
if (shortVideoCallBack != null) {
ShortVideoBean shortVideoBean = fromJson(result, ShortVideoBean.class);
shortVideoCallBack.onResponse(shortVideoBean);
}
}
@Override
public void onRequestFail(String value, String failCode, int type) {
if (shortVideoCallBack != null) {
shortVideoCallBack.fail();
}
}
});
}
private static <K> K fromJson(String result, Class<K> k) {
try {
return new Gson().fromJson(result, k);
} catch (Exception e) {
return null;
}
}
}