fix:调整榜单的请求接口改为retrofit2模块
fix:调整榜单实体类为IMLoginModel而非UserBean add:网络请求接口允许配置是否默认添加uid参数*榜单接口需求
This commit is contained in:
parent
5ef2015715
commit
e65f0fe0ce
@ -0,0 +1,63 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直播间榜单实体类
|
||||||
|
*/
|
||||||
|
public class ContributeModel extends BaseModel{
|
||||||
|
@SerializedName("uid")
|
||||||
|
private long uid;
|
||||||
|
@SerializedName("total")
|
||||||
|
private String total;
|
||||||
|
@SerializedName("userinfo")
|
||||||
|
private IMLoginModel userinfo;
|
||||||
|
@SerializedName("dress_head")
|
||||||
|
private String dressHead;
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributeModel setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributeModel setTotal(String total) {
|
||||||
|
this.total = total;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMLoginModel getUserinfo() {
|
||||||
|
return userinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributeModel setUserinfo(IMLoginModel userinfo) {
|
||||||
|
this.userinfo = userinfo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDressHead() {
|
||||||
|
return dressHead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributeModel setDressHead(String dressHead) {
|
||||||
|
this.dressHead = dressHead;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ContributeModel{" +
|
||||||
|
"uid=" + uid +
|
||||||
|
", total='" + total + '\'' +
|
||||||
|
", userinfo=" + userinfo +
|
||||||
|
", dressHead='" + dressHead + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -673,4 +673,62 @@ public class IMLoginModel extends BaseModel {
|
|||||||
this.slide = slide;
|
this.slide = slide;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "IMLoginModel{" +
|
||||||
|
"avatar='" + avatar + '\'' +
|
||||||
|
", avatarThumb='" + avatarThumb + '\'' +
|
||||||
|
", birthday='" + birthday + '\'' +
|
||||||
|
", city='" + city + '\'' +
|
||||||
|
", coin=" + coin +
|
||||||
|
", consumption=" + consumption +
|
||||||
|
", frontTask=" + frontTask +
|
||||||
|
", gold=" + gold +
|
||||||
|
", goldsumption=" + goldsumption +
|
||||||
|
", goodnum='" + goodnum + '\'' +
|
||||||
|
", id=" + id +
|
||||||
|
", issuper=" + issuper +
|
||||||
|
", langue='" + langue + '\'' +
|
||||||
|
", level='" + level + '\'' +
|
||||||
|
", levelAnchor='" + levelAnchor + '\'' +
|
||||||
|
", liang=" + liang +
|
||||||
|
", location='" + location + '\'' +
|
||||||
|
", medalLevel='" + medalLevel + '\'' +
|
||||||
|
", medalName='" + medalName + '\'' +
|
||||||
|
", nobleId=" + nobleId +
|
||||||
|
", nobleEndTime='" + nobleEndTime + '\'' +
|
||||||
|
", province='" + province + '\'' +
|
||||||
|
", sex=" + sex +
|
||||||
|
", signature='" + signature + '\'' +
|
||||||
|
", token='" + token + '\'' +
|
||||||
|
", tokenRong='" + tokenRong + '\'' +
|
||||||
|
", userNicename='" + userNicename + '\'' +
|
||||||
|
", userStatus=" + userStatus +
|
||||||
|
", vip=" + vip +
|
||||||
|
", votestotal=" + votestotal +
|
||||||
|
", firstLogin=" + firstLogin +
|
||||||
|
", isagent=" + isagent +
|
||||||
|
", num='" + num + '\'' +
|
||||||
|
", isAdmin='" + isAdmin + '\'' +
|
||||||
|
", agentSwitch='" + agentSwitch + '\'' +
|
||||||
|
", avatar2='" + avatar2 + '\'' +
|
||||||
|
", dress=" + dress +
|
||||||
|
", familySwitch=" + familySwitch +
|
||||||
|
", fans=" + fans +
|
||||||
|
", follows=" + follows +
|
||||||
|
", isBind=" + isBind +
|
||||||
|
", lives=" + lives +
|
||||||
|
", medalNoDisplaySrc='" + medalNoDisplaySrc + '\'' +
|
||||||
|
", mobile='" + mobile + '\'' +
|
||||||
|
", nobleName='" + nobleName + '\'' +
|
||||||
|
", usersType='" + usersType + '\'' +
|
||||||
|
", votes='" + votes + '\'' +
|
||||||
|
", yuanbao=" + yuanbao +
|
||||||
|
", list=" + list +
|
||||||
|
", slide=" + slide +
|
||||||
|
", giftEffect=" + giftEffect +
|
||||||
|
", mountEffect=" + mountEffect +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
package com.yunbao.live.bean;
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
import com.yunbao.common.bean.UserBean;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by zlzw on 2022/8/20.
|
* Created by zlzw on 2022/8/20.
|
||||||
* 直播间榜单实体类
|
* 直播间榜单实体类
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LiveUserRankBean extends UserBean {
|
public class LiveUserRankBean extends UserBean implements Parcelable {
|
||||||
|
|
||||||
private long total;
|
private long total;
|
||||||
|
|
||||||
|
private UserBean userinfo;
|
||||||
|
|
||||||
public long getTotal() {
|
public long getTotal() {
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
@ -19,6 +21,14 @@ public class LiveUserRankBean extends UserBean {
|
|||||||
this.total = total;
|
this.total = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserBean getUserinfo() {
|
||||||
|
return userinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserinfo(UserBean userinfo) {
|
||||||
|
this.userinfo = userinfo;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "LiveUserRankBean{" +
|
return "LiveUserRankBean{" +
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直播间榜单数据类
|
||||||
|
*/
|
||||||
|
public class UserRankModel extends BaseModel{
|
||||||
|
@SerializedName("list_day")
|
||||||
|
private List<ContributeModel> listDay;
|
||||||
|
@SerializedName("list_week")
|
||||||
|
private List<ContributeModel> listWeek;
|
||||||
|
|
||||||
|
public List<ContributeModel> getListDay() {
|
||||||
|
return listDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListDay(List<ContributeModel> listDay) {
|
||||||
|
this.listDay = listDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ContributeModel> getListWeek() {
|
||||||
|
return listWeek;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListWeek(List<ContributeModel> listWeek) {
|
||||||
|
this.listWeek = listWeek;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UserRankModel{" +
|
||||||
|
"listDay=" + listDay +
|
||||||
|
", listWeek=" + listWeek +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -44,30 +44,40 @@ public class API extends BaseApi {
|
|||||||
public PDLiveApi pdLiveApi(Context context) {
|
public PDLiveApi pdLiveApi(Context context) {
|
||||||
if (null == pdLiveApi) {
|
if (null == pdLiveApi) {
|
||||||
//实例化gson
|
//实例化gson
|
||||||
Gson gson = new GsonBuilder()
|
pdLiveApi=createPDLiveApi(true);
|
||||||
.registerTypeAdapter(Date.class, new DateTypeAdapter())
|
|
||||||
.create();
|
|
||||||
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("http");
|
|
||||||
loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY);
|
|
||||||
OkHttpClient.Builder builder = new OkHttpClient()
|
|
||||||
.newBuilder()
|
|
||||||
.addInterceptor(initQuery(CommonAppContext.sInstance.getApplicationContext()))
|
|
||||||
.addInterceptor(loggingInterceptor);
|
|
||||||
|
|
||||||
pdLiveApi = create(builder.build(),
|
|
||||||
GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class);
|
|
||||||
}
|
}
|
||||||
return pdLiveApi;
|
return pdLiveApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的PDLiveApi,兼容部分接口需要控制是否添加UID参数
|
||||||
|
* 仅有需要不添加uid的接口使用,默认请用pdLiveApi()
|
||||||
|
* @param isNeedUid 是否需要用户uid参数
|
||||||
|
* @return PDLiveApi
|
||||||
|
*/
|
||||||
|
public PDLiveApi createPDLiveApi(boolean isNeedUid){
|
||||||
|
Gson gson = new GsonBuilder()
|
||||||
|
.registerTypeAdapter(Date.class, new DateTypeAdapter())
|
||||||
|
.create();
|
||||||
|
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("http");
|
||||||
|
loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY);
|
||||||
|
OkHttpClient.Builder builder = new OkHttpClient()
|
||||||
|
.newBuilder()
|
||||||
|
.addInterceptor(initQuery(isNeedUid,CommonAppContext.sInstance.getApplicationContext()))
|
||||||
|
.addInterceptor(loggingInterceptor);
|
||||||
|
|
||||||
|
return create(builder.build(),
|
||||||
|
GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class);
|
||||||
|
}
|
||||||
|
|
||||||
//公共参数
|
//公共参数
|
||||||
public Interceptor initQuery(final Context context) {
|
public Interceptor initQuery(boolean isNeedUid,final Context context) {
|
||||||
Interceptor addQueryParameterInterceptor = new Interceptor() {
|
Interceptor addQueryParameterInterceptor = new Interceptor() {
|
||||||
@Override
|
@Override
|
||||||
public Response intercept(Chain chain) throws IOException {
|
public Response intercept(Chain chain) throws IOException {
|
||||||
Request request = chain.request();
|
Request request = chain.request();
|
||||||
//配置公共参数
|
//配置公共参数
|
||||||
request = new ParamsContext(request, context).getInRequest();
|
request = new ParamsContext(request, context).getInRequest(isNeedUid);
|
||||||
return chain.proceed(request);
|
return chain.proceed(request);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@ package com.yunbao.common.http;
|
|||||||
import com.yunbao.common.bean.ActiveModel;
|
import com.yunbao.common.bean.ActiveModel;
|
||||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
import com.yunbao.common.bean.BaseModel;
|
||||||
|
import com.yunbao.common.bean.ContributeModel;
|
||||||
import com.yunbao.common.bean.FaceBookUpModel;
|
import com.yunbao.common.bean.FaceBookUpModel;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.LiveInfoModel;
|
import com.yunbao.common.bean.LiveInfoModel;
|
||||||
@ -153,4 +154,12 @@ public interface PDLiveApi {
|
|||||||
*/
|
*/
|
||||||
@GET("/api/public/?service=live.getDrLm")
|
@GET("/api/public/?service=live.getDrLm")
|
||||||
Observable<ResponseModel<List<ActiveModel>>> getDrLm();
|
Observable<ResponseModel<List<ActiveModel>>> getDrLm();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日榜、周榜数据
|
||||||
|
* @param uid 直播间id,并非用户uid
|
||||||
|
* @return 榜单结构
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Contribute.index")
|
||||||
|
Observable<ResponseModel<List<ContributeModel>>> getRanksList(@Query("uid")String uid);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.yunbao.common.http;
|
package com.yunbao.common.http;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.yunbao.common.bean.UserRankModel;
|
||||||
|
|
||||||
public class ResponseData<T> {
|
public class ResponseData<T> {
|
||||||
@SerializedName("code")
|
@SerializedName("code")
|
||||||
@ -9,6 +10,8 @@ public class ResponseData<T> {
|
|||||||
private String msg;
|
private String msg;
|
||||||
@SerializedName("info")
|
@SerializedName("info")
|
||||||
private T info;
|
private T info;
|
||||||
|
@SerializedName("data")
|
||||||
|
private UserRankModel data;
|
||||||
|
|
||||||
public int getCode() {
|
public int getCode() {
|
||||||
return code;
|
return code;
|
||||||
@ -36,4 +39,12 @@ public class ResponseData<T> {
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserRankModel getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(UserRankModel data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,16 +9,28 @@ import okhttp3.HttpUrl;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
|
||||||
public class GetRequestParams implements IRequestParam {
|
public class GetRequestParams implements IRequestParam {
|
||||||
|
/**
|
||||||
|
* 构建Request
|
||||||
|
* @param isNeedUid 是否需要添加用户uid参数
|
||||||
|
* @param request
|
||||||
|
* @param context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Request getRequest(Request request, Context context) {
|
public Request getRequest(boolean isNeedUid,Request request, Context context) {
|
||||||
//添加公共参数
|
//添加公共参数
|
||||||
if (IMLoginManager.isLogin(context)) {
|
if (IMLoginManager.isLogin(context)) {
|
||||||
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
||||||
HttpUrl modifiedUrl = request.url().newBuilder()
|
/* HttpUrl modifiedUrl = request.url().newBuilder()
|
||||||
.addQueryParameter("uid", String.valueOf(model.getId()))
|
.addQueryParameter("uid", String.valueOf(model.getId()))
|
||||||
.addQueryParameter("token", model.getToken())
|
.addQueryParameter("token", model.getToken())
|
||||||
.build();
|
.build();*/
|
||||||
return request.newBuilder().url(modifiedUrl).build();
|
HttpUrl.Builder builder = request.url().newBuilder();
|
||||||
|
if(isNeedUid) {
|
||||||
|
builder.addQueryParameter("uid", String.valueOf(model.getId()));
|
||||||
|
}
|
||||||
|
builder.addQueryParameter("token", model.getToken());
|
||||||
|
return request.newBuilder().url(builder.build()).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,5 +5,5 @@ import android.content.Context;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
|
||||||
public interface IRequestParam {
|
public interface IRequestParam {
|
||||||
Request getRequest(Request request, Context context);
|
Request getRequest(boolean isNeedUid,Request request, Context context);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class ParamsContext {
|
|||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Request getInRequest() {
|
public Request getInRequest(boolean isNeedUid) {
|
||||||
switch (request.method()) {
|
switch (request.method()) {
|
||||||
case "GET":
|
case "GET":
|
||||||
iRequestParam = new GetRequestParams();
|
iRequestParam = new GetRequestParams();
|
||||||
@ -23,6 +23,6 @@ public class ParamsContext {
|
|||||||
iRequestParam = new PostRequestParams();
|
iRequestParam = new PostRequestParams();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return iRequestParam.getRequest(request, context);
|
return iRequestParam.getRequest(isNeedUid,request, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import okhttp3.Request;
|
|||||||
|
|
||||||
public class PostRequestParams implements IRequestParam {
|
public class PostRequestParams implements IRequestParam {
|
||||||
@Override
|
@Override
|
||||||
public Request getRequest(Request request, Context context) {
|
public Request getRequest(boolean isNeedUid,Request request, Context context) {
|
||||||
if (request.body() instanceof FormBody) {
|
if (request.body() instanceof FormBody) {
|
||||||
FormBody.Builder bodyBuilder = new FormBody.Builder();
|
FormBody.Builder bodyBuilder = new FormBody.Builder();
|
||||||
|
|
||||||
@ -21,9 +21,14 @@ public class PostRequestParams implements IRequestParam {
|
|||||||
}
|
}
|
||||||
if (IMLoginManager.isLogin(context)) {
|
if (IMLoginManager.isLogin(context)) {
|
||||||
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
||||||
formBody = bodyBuilder.addEncoded("uid", String.valueOf(model.getId()))
|
/* formBody = bodyBuilder.addEncoded("uid", String.valueOf(model.getId()))
|
||||||
.addEncoded("token", model.getToken())
|
.addEncoded("token", model.getToken())
|
||||||
.build();
|
.build();*/
|
||||||
|
if (isNeedUid){
|
||||||
|
bodyBuilder.addEncoded("uid", String.valueOf(model.getId()));
|
||||||
|
}
|
||||||
|
bodyBuilder.addEncoded("token", model.getToken());
|
||||||
|
formBody=bodyBuilder.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
request = request.newBuilder().post(formBody).build();
|
request = request.newBuilder().post(formBody).build();
|
||||||
|
@ -28,12 +28,10 @@ import com.yunbao.common.bean.UserBean;
|
|||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.utils.CommonIconUtil;
|
import com.yunbao.common.utils.CommonIconUtil;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.RandomUtil;
|
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveActivity;
|
import com.yunbao.live.activity.LiveActivity;
|
||||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||||
import com.yunbao.live.bean.LiveUserRankBean;
|
import com.yunbao.common.bean.LiveUserRankBean;
|
||||||
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
@ -3,8 +3,6 @@ package com.yunbao.live.dialog;
|
|||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -14,14 +12,20 @@ import android.widget.ImageView;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.adapter.RefreshAdapter;
|
import com.yunbao.common.adapter.RefreshAdapter;
|
||||||
|
import com.yunbao.common.bean.LiveUserRankBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
|
import com.yunbao.common.bean.UserRankModel;
|
||||||
import com.yunbao.common.custom.CommonRefreshView;
|
import com.yunbao.common.custom.CommonRefreshView;
|
||||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||||
|
import com.yunbao.common.http.API;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
@ -29,12 +33,14 @@ import com.yunbao.live.activity.LiveActivity;
|
|||||||
import com.yunbao.live.adapter.UserMoreInfoAdapter;
|
import com.yunbao.live.adapter.UserMoreInfoAdapter;
|
||||||
import com.yunbao.live.bean.LiveGuardInfo;
|
import com.yunbao.live.bean.LiveGuardInfo;
|
||||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||||
import com.yunbao.live.bean.LiveUserRankBean;
|
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 观看直播的人 列表
|
* 观看直播的人 列表
|
||||||
*/
|
*/
|
||||||
@ -203,9 +209,20 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
|||||||
public void loadData(int p, HttpCallback callback) {
|
public void loadData(int p, HttpCallback callback) {
|
||||||
Log.i("tag111", p + "ssss");
|
Log.i("tag111", p + "ssss");
|
||||||
if(isRank()){
|
if(isRank()){
|
||||||
LiveHttpUtil.getUserRankList(mLiveUid,callback);
|
/**
|
||||||
//榜单没有分页需求
|
* 榜单接口的uid为直播间ID,并不是也不需要用户uid
|
||||||
mRefreshView.setPageCount(1);
|
*/
|
||||||
|
API.get().createPDLiveApi(false).getRanksList(mLiveUid)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(listResponseModel -> {
|
||||||
|
UserRankModel data = listResponseModel.getData().getData();
|
||||||
|
//获取到参数后手动调用成功方法
|
||||||
|
callback.onSuccess(0,"",new String[]{JSONObject.toJSONString(data)});
|
||||||
|
}, throwable -> {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
callback.onError();
|
||||||
|
}).isDisposed();
|
||||||
}else {
|
}else {
|
||||||
LiveHttpUtil.getUserList(mLiveUid, stream, type, p, callback);
|
LiveHttpUtil.getUserList(mLiveUid, stream, type, p, callback);
|
||||||
pg = p;
|
pg = p;
|
||||||
@ -269,8 +286,11 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
private List<LiveUserRankBean> processRankData(JSONObject json){
|
private List<LiveUserRankBean> processRankData(JSONObject json){
|
||||||
JSONArray rank=Integer.parseInt(Tips)==4?json.getJSONArray("list_day"):json.getJSONArray("list_week");
|
JSONArray rank=Integer.parseInt(Tips)==4?json.getJSONArray("listDay"):json.getJSONArray("listWeek");
|
||||||
List<LiveUserRankBean> data =new ArrayList<>();
|
List<LiveUserRankBean> data =new ArrayList<>();
|
||||||
|
/**
|
||||||
|
* 由于在线观众和粉丝列表实体结构与榜单结构不一致,做个兼容操作
|
||||||
|
*/
|
||||||
for (Object o : rank) {
|
for (Object o : rank) {
|
||||||
JSONObject item= (JSONObject) o;
|
JSONObject item= (JSONObject) o;
|
||||||
LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class);
|
LiveUserRankBean bean=JSON.parseObject(item.getString("userinfo"),LiveUserRankBean.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user