我收藏的房间列表改版
This commit is contained in:
@@ -49,6 +49,7 @@ public class HomeRoomInfo implements MultiItemEntity, Serializable {
|
||||
private String failContext;
|
||||
private boolean isPick;
|
||||
private boolean needOpenSelfRoom;
|
||||
private boolean isChecked;
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
|
@@ -19,6 +19,10 @@ public class CollectionRoomModel extends BaseModel {
|
||||
private volatile static CollectionRoomModel model;
|
||||
private Api api;
|
||||
|
||||
private CollectionRoomModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
public static CollectionRoomModel get() {
|
||||
if (model == null) {
|
||||
synchronized (CollectionRoomModel.class) {
|
||||
@@ -30,17 +34,13 @@ public class CollectionRoomModel extends BaseModel {
|
||||
return model;
|
||||
}
|
||||
|
||||
private CollectionRoomModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取收藏房间列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Single<CollectionRoomInfo> getCollectionRoomList(long uid,int page,int pageSize) {
|
||||
return api.getCollectionRoomList(String.valueOf(uid), String.valueOf(page), String.valueOf(pageSize))
|
||||
public Single<CollectionRoomInfo> getCollectionRoomList(long uid, int roomType, int page, int pageSize) {
|
||||
return api.getCollectionRoomList(String.valueOf(uid), roomType, String.valueOf(page), String.valueOf(pageSize))
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
@@ -50,31 +50,31 @@ public class CollectionRoomModel extends BaseModel {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Single<String> followRoom(String type,long roomUid){
|
||||
public Single<String> followRoom(String type, long roomUid) {
|
||||
long uid = AuthModel.get().getCurrentUid();
|
||||
String ticket = AuthModel.get().getTicket();
|
||||
return api.followRoom(String.valueOf(uid),String.valueOf(roomUid),type,ticket)
|
||||
.flatMap(new Function<ServiceResult<String>, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(ServiceResult<String> stringServiceResult) throws Exception {
|
||||
if (stringServiceResult.isSuccess()) {
|
||||
return Single.just(stringServiceResult.getMessage());
|
||||
}else {
|
||||
return Single.error(new Throwable(stringServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.doOnSuccess(s -> {
|
||||
|
||||
})
|
||||
return api.followRoom(String.valueOf(uid), String.valueOf(roomUid), type, ticket)
|
||||
.compose(RxHelper.handleStringData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除收藏房间,type固定为3
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Single<String> deleteFollowRoom(String roomUids) {
|
||||
long uid = AuthModel.get().getCurrentUid();
|
||||
return api.deleteFollowRoom(String.valueOf(uid), roomUids, "3")
|
||||
.compose(RxHelper.handleStringData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 获取铭牌列表
|
||||
*
|
||||
* @param uid
|
||||
* @param page
|
||||
* @param pageSize
|
||||
@@ -82,13 +82,19 @@ public class CollectionRoomModel extends BaseModel {
|
||||
*/
|
||||
@GET("fans/fansRoomList")
|
||||
Single<ServiceResult<CollectionRoomInfo>> getCollectionRoomList(@Query("uid") String uid,
|
||||
@Query("page") String page,
|
||||
@Query("pageSize") String pageSize);
|
||||
@Query("roomType") int roomType,
|
||||
@Query("page") String page,
|
||||
@Query("pageSize") String pageSize);
|
||||
|
||||
@POST("fans/fansRoom")
|
||||
Single<ServiceResult<String>> followRoom(@Query("uid") String uid,
|
||||
@Query("roomUid") String roomUid,
|
||||
@Query("type") String type,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
@POST("fans/fansRoom")
|
||||
Single<ServiceResult<String>> deleteFollowRoom(@Query("uid") String uid,
|
||||
@Query("roomUids") String roomUids,
|
||||
@Query("type") String type);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user