feat:恢复转赠功能

This commit is contained in:
max
2024-05-17 19:56:26 +08:00
parent 6ca5589efc
commit 92070af5e8
44 changed files with 2801 additions and 34 deletions

View File

@@ -8,6 +8,8 @@ import com.chwl.core.community.CommunityConstant
import com.chwl.core.community.bean.UnReadCountInfo
import com.chwl.core.home.bean.*
import com.chwl.core.room.bean.AnchorInfo
import com.chwl.core.user.bean.DiamondGiveHistoryInfo
import com.chwl.core.user.bean.SearchUserInfo
import com.chwl.core.user.bean.UserInfo
import com.chwl.core.utils.net.RxHelper
import com.chwl.core.utils.net.launchRequest
@@ -183,7 +185,79 @@ object HomeModel : BaseModel() {
api.getResourceJumpInfo(id)
}
suspend fun getDiamondGiveHistory(page: Int, pageSize: Int): List<DiamondGiveHistoryInfo>? =
launchRequest {
api.getRecord(page, pageSize)
}
suspend fun getSearchUser(erbanNo: Long): SearchUserInfo? =
launchRequest {
api.getSearchUser(erbanNo)
}
suspend fun giveGift(toUid: Long, giftId: Int, giftNum: Int): String? =
launchRequest {
api.giveGift(toUid, giftId, giftNum)
}
suspend fun getGiveDetail(
uid: Long,
type: Int,
page: Int,
pageSize: Int
): List<DiamondGiveHistoryInfo>? =
launchRequest {
api.getGiveDetail(uid, type, page, pageSize)
}
private interface Api {
/**
* 轉贈鉆石歷史記錄
*
* @return
*/
@GET("/user/diamond/giveRecord")
suspend fun getRecord(
@Query("pageNum") pageNum: Int?,
@Query("pageSize") pageSize: Int?
): ServiceResult<List<DiamondGiveHistoryInfo>>
/**
* 精確搜索用戶
*
* @return
*/
@POST("/user/diamond/searchUser")
suspend fun getSearchUser(
@Query("erbanNo") erbanNo: Long?
): ServiceResult<SearchUserInfo>
/**
* 贈送禮物
*
* @return
*/
@POST("/user/diamond/giveGift")
suspend fun giveGift(
@Query("toUid") toUid: Long?,
@Query("giftId") giftId: Int?,
@Query("giftNum") giftNum: Int?
): ServiceResult<String>
/**
* 轉贈詳情
*
* @return
*/
@GET("/user/diamond/giveRecordVoByType")
suspend fun getGiveDetail(
@Query("toUid") toUid: Long?,
@Query("type") type: Int?,
@Query("pageNum") pageNum: Int?,
@Query("pageSize") pageSize: Int?
): ServiceResult<List<DiamondGiveHistoryInfo>>
/**
* 提交反馈
*

View File

@@ -217,4 +217,8 @@ public class RouterType {
* 用户等级目前只是本地用到所以用了100001
*/
public static final int USER_LEVEL = 100001;
/**
* 我的转赠目前只是本地用到所以用了100002
*/
public static final int USER_DONATION = 100002;
}

View File

@@ -86,4 +86,5 @@ public interface IPayModel extends IModel {
Single<String> getChargeContact();
Single<String> giveGold(long toUid, String goldNum, String password);
}

View File

@@ -325,8 +325,27 @@ public class PayModel extends BaseModel implements IPayModel {
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<String> giveGold(long toUid, String goldNum, String password) {
return api.giveGold(toUid, goldNum, password)
.compose(RxHelper.handleStringData())
.compose(RxHelper.handleSchedulers());
}
public interface Api {
/**
* 钻石转赠
*
* @return
*/
@FormUrlEncoded
@POST("/user/diamond/give")
Single<ServiceResult<String>> giveGold(@Field("toUid") long toUid,
@Field("diamondNum") String diamondNum,
@Field("payPwd") String payPwd);
/**
* 获取钱包
*