跨房PK:发起PK相关页面
This commit is contained in:
@@ -393,6 +393,10 @@ public class CustomAttachment implements MsgAttachment {
|
||||
public static final int CUSTOM_MSG_CHAT_HINT = 75;
|
||||
public static final int CUSTOM_MSG_SUB_CHAT_HINT = 751;
|
||||
|
||||
//私聊提示
|
||||
public static final int CUSTOM_MSG_ROOM_PK = 83;
|
||||
public static final int CUSTOM_MSG_SUB_ROOM_PK_INVITE = 831;
|
||||
|
||||
public CustomAttachment() {
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,123 @@
|
||||
package com.yizhuan.xchat_android_core.room.anotherroompk
|
||||
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet
|
||||
import io.reactivex.Single
|
||||
import lombok.Getter
|
||||
import retrofit2.http.*
|
||||
|
||||
object RoomPKModel {
|
||||
private val api: Api
|
||||
|
||||
init {
|
||||
api = RxNet.create(Api::class.java)
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起挑战
|
||||
*
|
||||
* @param acceptUid 必传:接受方房主uid
|
||||
* @param duration 时长:分钟
|
||||
* @param inviteUid 必传:发起方房主uid
|
||||
* @param operateUid 操作人uid
|
||||
* @param playDesc 玩法
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun initiateRoomPK(
|
||||
acceptUid: Long,
|
||||
duration: Int,
|
||||
inviteUid: Long,
|
||||
operateUid: Long,
|
||||
playDesc: String?
|
||||
): Single<String> {
|
||||
return api.initiateRoomPK(acceptUid, duration, inviteUid, operateUid, playDesc)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受/拒绝挑战
|
||||
*
|
||||
* @param isAccept true 接受PK
|
||||
* @param roomUid roomUid
|
||||
* @param roundId roundId
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun acceptRoomPK(
|
||||
isAccept: Boolean,
|
||||
roomUid: Long,
|
||||
roundId: Long
|
||||
): Single<String> {
|
||||
return api.acceptRoomPK(isAccept, roomUid, roundId)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleStringData())
|
||||
}
|
||||
|
||||
/**
|
||||
* 跨房pk/牌照房搜索
|
||||
*
|
||||
* @param erbanNo erbanNo,空则获取全部牌照房
|
||||
* @param pageNum pageNum
|
||||
* @param pageSize pageSize
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
fun searchPermitRoom(
|
||||
erbanNo: String?,
|
||||
pageNum: Int,
|
||||
pageSize: Int
|
||||
): Single<List<SimpleRoomInfo>> {
|
||||
return api.searchPermitRoom(erbanNo, pageNum, pageSize)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
/**
|
||||
* 发起挑战
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/crossroompkround/initiateChallenge")
|
||||
fun initiateRoomPK(
|
||||
@Field("acceptUid") acceptUid: Long,
|
||||
@Field("duration") duration: Int,
|
||||
@Field("inviteUid") inviteUid: Long,
|
||||
@Field("operateUid") operateUid: Long,
|
||||
@Field("playDesc") playDesc: String?
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
* 接受/拒绝挑战
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/crossroompkround/initiateChallenge")
|
||||
fun acceptRoomPK(
|
||||
@Field("isAccept") isAccept: Boolean,
|
||||
@Field("roomUid") roomUid: Long,
|
||||
@Field("roundId") roundId: Long
|
||||
): Single<ServiceResult<String>>
|
||||
|
||||
/**
|
||||
*
|
||||
* 跨房pk/牌照房搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/search/permitRoom")
|
||||
fun searchPermitRoom(
|
||||
@Query("erbanNo") erbanNo: String?,
|
||||
@Query("pageNum") pageNum: Int,
|
||||
@Query("pageSize") pageSize: Int
|
||||
): Single<ServiceResult<List<SimpleRoomInfo>>>
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.yizhuan.xchat_android_core.room.anotherroompk
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class SimpleRoomInfo(
|
||||
val title: String? = null,
|
||||
val roomUid :Long = 0L,
|
||||
val erbanNo :Long = 0L,
|
||||
val avatar :String? = null,
|
||||
var checked :Boolean = false
|
||||
) : Serializable
|
@@ -21,4 +21,10 @@ fun String?.toast() {
|
||||
}
|
||||
|
||||
inline fun String?.ifNullOrEmpty(defaultValue: () -> String): String =
|
||||
if (this.isNullOrEmpty()) defaultValue() else this
|
||||
if (this.isNullOrEmpty()) defaultValue() else this
|
||||
|
||||
inline fun String?.ifNotNullOrEmpty(block: (String) -> Unit) {
|
||||
if (!this.isNullOrEmpty()) {
|
||||
block(this)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user