1:完成cp效果展示,
This commit is contained in:
@@ -515,7 +515,11 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.GET_ROOM_GIFT)
|
||||
Call<BaseModel<String>> roomGift(@Field("room_id") String room_id, @Field("gift_id") String gift_id, @Field("gift_num") String num, @Field("to_uid") String to_uid, @Field("type") String gift_type, @Field("pit_number") String pit_number, @Field("heart_id") String heat_id);
|
||||
Call<BaseModel<RoomGiftData>> roomGift(@Field("room_id") String room_id, @Field("gift_id") String gift_id, @Field("gift_num") String num, @Field("to_uid") String to_uid, @Field("type") String gift_type, @Field("pit_number") String pit_number, @Field("heart_id") String heat_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_CP_GIVE_GIFT)
|
||||
Call<BaseModel<RoomGiftData>> cpGiveGift(@Field("user_id") String user_id, @Field("gift_id") String gift_id, @Field("room_id") String room_id);
|
||||
|
||||
@GET(Constants.GET_FIRST_CHARGE_GIFT)
|
||||
Call<BaseModel<FirstChargeGiftBean>> firstChargeGift();
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||
import com.xscm.moduleutil.bean.room.*;
|
||||
import com.xscm.moduleutil.bean.zhuangb.ZhuangBanShangChengBean;
|
||||
import com.xscm.moduleutil.listener.CPListener;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.SystemUtils;
|
||||
@@ -39,7 +40,6 @@ import java.security.SecureRandom;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EventListener;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -48,7 +48,6 @@ import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.ResponseBody;
|
||||
@@ -142,6 +141,15 @@ public class RetrofitClient {
|
||||
mRetrofit = provideRetrofit(provideOkHttpClient());
|
||||
sApiServer = mRetrofit.create(ApiServer.class);
|
||||
}
|
||||
private CPListener cpListener;
|
||||
public void CpListener(CPListener cpListenter) {
|
||||
this.cpListener = cpListenter;
|
||||
}
|
||||
|
||||
public CPListener getCpListener() {
|
||||
return cpListener;
|
||||
}
|
||||
|
||||
|
||||
public static RetrofitClient getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
@@ -3054,21 +3062,75 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String
|
||||
type, String pit_number, String heart_id, BaseObserver<String> observer) {
|
||||
sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback<BaseModel<String>>() {
|
||||
public void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number, String heart_id, BaseObserver<RoomGiftData> observer) {
|
||||
sApiServer.roomGift(room_id, gift_id, gift_num, to_uid, type, pit_number, heart_id).enqueue(new Callback<BaseModel<RoomGiftData>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
public void onResponse(Call<BaseModel<RoomGiftData>> call, Response<BaseModel<RoomGiftData>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<RoomGiftData> data = response.body();
|
||||
if (data.getCode()==1) {
|
||||
if (data.getData().getCp_type()!=null){
|
||||
if (cpListener !=null){
|
||||
cpListener.onSendCpMsg(data.getData());
|
||||
}
|
||||
}
|
||||
observer.onNext(data.getData());
|
||||
|
||||
}else if (data.getCode()==0){
|
||||
ToastUtils.showShort(data.getMsg());
|
||||
}else if (data.getCode()==301) {
|
||||
try {
|
||||
ToastUtils.showShort(data.getMsg());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
public void onFailure(Call<BaseModel<RoomGiftData>> call, Throwable t) {
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void cpGiveGift(String user_id, String gift_id,String room_id,BaseObserver<RoomGiftData> observer) {
|
||||
sApiServer.cpGiveGift(user_id, gift_id,room_id).enqueue(new Callback<BaseModel<RoomGiftData>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RoomGiftData>> call, Response<BaseModel<RoomGiftData>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<RoomGiftData> data = response.body();
|
||||
if (data.getCode()==1) {
|
||||
if (data.getData().getCp_type()!=null){
|
||||
if (cpListener !=null){
|
||||
cpListener.onSendCpMsg(data.getData());
|
||||
}
|
||||
}
|
||||
observer.onNext(data.getData());
|
||||
|
||||
}else if (data.getCode()==0){
|
||||
ToastUtils.showShort(data.getMsg());
|
||||
}else if (data.getCode()==301) {
|
||||
try {
|
||||
ToastUtils.showShort(data.getMsg());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<RoomGiftData>> call, Throwable t) {
|
||||
LogUtils.e("cpGiveGift",t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getDayDropGift(BaseObserver<HeavenGiftBean> observer) {
|
||||
sApiServer.getDayDropGift().enqueue(new Callback<BaseModel<HeavenGiftBean>>() {
|
||||
@Override
|
||||
@@ -3383,8 +3445,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void roomRelationList(String
|
||||
type, BaseObserver<List<RoomRelationBean>> observer) {
|
||||
public void roomRelationList(String type, BaseObserver<List<RoomRelationBean>> observer) {
|
||||
sApiServer.roomRelationList(type).enqueue(new Callback<BaseModel<List<RoomRelationBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RoomRelationBean>>> call, Response<BaseModel<List<RoomRelationBean>>> response) {
|
||||
|
||||
Reference in New Issue
Block a user