267 lines
9.6 KiB
Java
267 lines
9.6 KiB
Java
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|