兑换奖励接口
This commit is contained in:
parent
f46d14ce28
commit
a5d546d1d1
@ -10,7 +10,11 @@ import androidx.annotation.NonNull;
|
|||||||
import com.lxj.xpopup.core.CenterPopupView;
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.http.ResponseModel;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@ -23,6 +27,8 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
|||||||
private int mPoint, mLimitQuantity, mScale;
|
private int mPoint, mLimitQuantity, mScale;
|
||||||
private String mImageUrl;
|
private String mImageUrl;
|
||||||
private ImageView exchangeParticulars;
|
private ImageView exchangeParticulars;
|
||||||
|
private String battlePassPointsId;
|
||||||
|
private WarOrderExchangeDetailsCallback orderExchangeDetailsCallback;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
@ -33,12 +39,14 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
|||||||
* @param imageUrl 物品图片的url
|
* @param imageUrl 物品图片的url
|
||||||
*/
|
*/
|
||||||
public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity,
|
public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity,
|
||||||
int point, int scale, String imageUrl) {
|
int point, int scale, String imageUrl, String battlePassPointsId, WarOrderExchangeDetailsCallback orderExchangeDetailsCallback) {
|
||||||
super(context);
|
super(context);
|
||||||
mPoint = point;
|
mPoint = point;
|
||||||
mLimitQuantity = limitQuantity;
|
mLimitQuantity = limitQuantity;
|
||||||
mScale = scale;
|
mScale = scale;
|
||||||
mImageUrl = imageUrl;
|
mImageUrl = imageUrl;
|
||||||
|
this.battlePassPointsId = battlePassPointsId;
|
||||||
|
this.orderExchangeDetailsCallback = orderExchangeDetailsCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,5 +92,32 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.point_exchange_linear), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
LiveNetManager.get(getContext())
|
||||||
|
.pointsExchange(battlePassPointsId, buyExp, new HttpCallback<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResponseModel<Object> data) {
|
||||||
|
dialog.dismiss();
|
||||||
|
if (orderExchangeDetailsCallback != null) {
|
||||||
|
orderExchangeDetailsCallback.onCallback(data.getData().getCode(), data.getData().getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
dialog.dismiss();
|
||||||
|
if (orderExchangeDetailsCallback != null) {
|
||||||
|
orderExchangeDetailsCallback.onCallback(102, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface WarOrderExchangeDetailsCallback {
|
||||||
|
void onCallback(int code, String msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1097,4 +1097,16 @@ public interface PDLiveApi {
|
|||||||
|
|
||||||
@GET("/api/public/?service=Livebattlepass.buyingExperiencePoint")
|
@GET("/api/public/?service=Livebattlepass.buyingExperiencePoint")
|
||||||
Observable<ResponseModel<Object>> buyingExperiencePoint(@Query("exp_count") String expCount);
|
Observable<ResponseModel<Object>> buyingExperiencePoint(@Query("exp_count") String expCount);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* battle_pass_points_id => 兑换列表ID
|
||||||
|
* count => 兑换物品的数量
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/api/public/?service=Livebattlepass.pointsExchange")
|
||||||
|
Observable<ResponseModel<Object>> pointsExchange(
|
||||||
|
@Query("battle_pass_points_id ") String battlePassPointsId,
|
||||||
|
@Query("count ") String count
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -2460,6 +2460,28 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void pointsExchange(String battlePassPointsId, String count, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.pointsExchange(battlePassPointsId, count)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onSuccess(objectResponseModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
public void buyingExperiencePoint(String expCount, HttpCallback<ResponseModel<Object>> callback) {
|
public void buyingExperiencePoint(String expCount, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.buyingExperiencePoint(expCount)
|
.buyingExperiencePoint(expCount)
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/point_exchange_linear"
|
||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="38dp"
|
android:layout_height="38dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
@ -39,9 +39,6 @@ import com.yunbao.common.bean.CoolConfig;
|
|||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.bean.NativeCallbackModel;
|
import com.yunbao.common.bean.NativeCallbackModel;
|
||||||
import com.yunbao.common.dialog.CinemaTicketPopupWindow;
|
import com.yunbao.common.dialog.CinemaTicketPopupWindow;
|
||||||
import com.yunbao.common.dialog.LiberalBattlePassPopupWindow;
|
|
||||||
import com.yunbao.common.dialog.OrderLevelPopupWindow;
|
|
||||||
import com.yunbao.common.dialog.PromotionElitePopupWindow;
|
|
||||||
import com.yunbao.common.dialog.WarOrderExchangeDetailsPopupWindow;
|
import com.yunbao.common.dialog.WarOrderExchangeDetailsPopupWindow;
|
||||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
@ -234,12 +231,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
findViewById(R.id.native_callback).setOnClickListener(new View.OnClickListener() {
|
findViewById(R.id.native_callback).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
new XPopup.Builder(mContext)
|
|
||||||
.enableDrag(false)
|
|
||||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
|
||||||
.asCustom(new WarOrderExchangeDetailsPopupWindow(mContext,10,90000,10,
|
|
||||||
"https://downs.yaoulive.com/20230706/0572c0f694601f4d2695cd210effbe93.jpeg?imageView2/2/w/600/h/600"))
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}//战令等级
|
}//战令等级
|
||||||
|
Loading…
Reference in New Issue
Block a user