update 购买守护优惠卷
This commit is contained in:
parent
d1d8054c01
commit
0177a1314d
109
common/src/main/java/com/yunbao/common/bean/DiscountsModel.java
Normal file
109
common/src/main/java/com/yunbao/common/bean/DiscountsModel.java
Normal file
@ -0,0 +1,109 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 优惠卷
|
||||
*/
|
||||
public class DiscountsModel extends BaseModel {
|
||||
//------------------贵族--------------------
|
||||
public static final int TYPE_VISCOUNT=1;//子爵
|
||||
public static final int TYPE_MARQUIS=2;//侯爵
|
||||
public static final int TYPE_DUKE=3;//公爵
|
||||
public static final int TYPE_KING=4;//国王
|
||||
public static final int TYPE_EMPEROR=5;//皇帝
|
||||
//------------------守护--------------------
|
||||
public static final int TYPE_WEEKS=6;//周守护
|
||||
public static final int TYPE_MONTH=7;//月守护
|
||||
public static final int TYPE_YEARS=8;//月守护
|
||||
|
||||
@SerializedName("userCouponID")
|
||||
private int userCouponID;
|
||||
@SerializedName("num")
|
||||
private int num;
|
||||
@SerializedName("endTime")
|
||||
private long endTime;
|
||||
@SerializedName("img")
|
||||
private String img;
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("discount")
|
||||
private double discount;
|
||||
@SerializedName("describe")
|
||||
private String describe;
|
||||
|
||||
public DiscountsModel() {
|
||||
}
|
||||
|
||||
public int getUserCouponID() {
|
||||
return userCouponID;
|
||||
}
|
||||
|
||||
public void setUserCouponID(int userCouponID) {
|
||||
this.userCouponID = userCouponID;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public long getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(long endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public double getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(double discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
}
|
||||
|
||||
public void setDescribe(String describe) {
|
||||
this.describe = describe;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DiscountsModel{" +
|
||||
"userCouponID=" + userCouponID +
|
||||
", num=" + num +
|
||||
", endTime=" + endTime +
|
||||
", img='" + img + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", discount=" + discount +
|
||||
", describe='" + describe + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.HourRank;
|
||||
@ -671,5 +672,11 @@ public interface PDLiveApi {
|
||||
@Query("type") int type,
|
||||
@Query("list") String list
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取折扣卷信息
|
||||
*/
|
||||
@GET("/api/public/?service=Coupon.getUserCoupon")
|
||||
Observable<ResponseModel<List<DiscountsModel>>> getDiscountInfo(
|
||||
@Query("type") int type
|
||||
);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
import com.yunbao.common.bean.HttpCallbackModel;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
@ -1357,6 +1358,27 @@ public class LiveNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
public void getDiscountInfo(int type,HttpCallback<List<DiscountsModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getDiscountInfo(type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<DiscountsModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<DiscountsModel>> wishListGiftConfModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(wishListGiftConfModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
|
@ -24,6 +24,7 @@ import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@ -380,6 +381,19 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
|
||||
if (mTargetBuyBean == null) {
|
||||
return;
|
||||
}
|
||||
int discountType = 0;
|
||||
switch (mTargetBuyBean.getType()) {
|
||||
case Constants.GUARD_TYPE_DAY:
|
||||
discountType = DiscountsModel.TYPE_WEEKS;
|
||||
break;
|
||||
case Constants.GUARD_TYPE_MONTH:
|
||||
discountType = DiscountsModel.TYPE_MONTH;
|
||||
break;
|
||||
case Constants.GUARD_TYPE_YEAR:
|
||||
discountType = DiscountsModel.TYPE_YEARS;
|
||||
break;
|
||||
}
|
||||
|
||||
LiveHttpUtil.buyGuard(mLiveUid, mStream, mTargetBuyBean.getId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
|
Loading…
Reference in New Issue
Block a user