福袋全服需求修改,整理福袋云信协议
This commit is contained in:
@@ -322,13 +322,12 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
public void onReceiveLuckyGiftToMultiMsg(LuckyBagGifts giftMultiReceiverInfo) {
|
||||
if (giftMultiReceiverInfo != null) {
|
||||
setVisibility(VISIBLE);
|
||||
List<GiftReceiver> targetUsers = giftMultiReceiverInfo.getTargetUsers();
|
||||
List<Long> targetUids = giftMultiReceiverInfo.getTargetUids();
|
||||
List<GiftReceiveInfo> giftReceiveInfos = new ArrayList<>();
|
||||
for (GiftReceiver targetUser : targetUsers) {
|
||||
for (Long targetUid : targetUids) {
|
||||
GiftReceiveInfo giftReceiveInfo = new GiftReceiveInfo();
|
||||
giftReceiveInfo.setUid(giftMultiReceiverInfo.getUid());
|
||||
giftReceiveInfo.setGiftNum(giftMultiReceiverInfo.getGiftNum());
|
||||
giftReceiveInfo.setTargetUid(targetUser.getUid());
|
||||
giftReceiveInfo.setTargetUid(targetUid);
|
||||
giftReceiveInfo.setNick(giftMultiReceiverInfo.getNick());
|
||||
giftReceiveInfo.setGiftId(giftMultiReceiverInfo.getDisplayGift().get(0).getGiftId());
|
||||
giftReceiveInfo.setGift(giftMultiReceiverInfo.getDisplayGift().get(0));
|
||||
|
@@ -1012,15 +1012,16 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
String flashMsg = "哇偶!<font color=#FEED8F>"+info.getNick()+"</font>"+"通过"+ info.getLuckyBagName()+"开出了"+"<font color=#89FFFE>"+info.getGiftName()+"</font>";
|
||||
if (second == CUSTOM_MSG_LUCKY_GIFT_ROOM_NOTIFY){
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null && roomInfo.getUid() == info.getRoomUid() && context instanceof AVRoomActivity) {
|
||||
//厅内福袋通知
|
||||
if (roomInfo != null && roomInfo.getUid() == info.getRoomUid() && context instanceof AVRoomActivity) {
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
}
|
||||
}else if (second == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY){
|
||||
if (context instanceof AddUserInfoActivity || context instanceof LoginActivity || UserUtils.getUserInfo() == null)
|
||||
return;
|
||||
//全服福袋通知
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null && context instanceof AVRoomActivity) {
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@@ -1010,10 +1010,11 @@ public abstract class BaseMvpActivity<V extends IMvpBaseView, P extends Abstract
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
}
|
||||
}else if (second == CUSTOM_MSG_LUCKY_GIFT_SERVER_NOTIFY){
|
||||
if (context instanceof AddUserInfoActivity || context instanceof LoginActivity || UserUtils.getUserInfo() == null)
|
||||
return;
|
||||
//全服福袋通知
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null && context instanceof AVRoomActivity) {
|
||||
addLuckyBagNotify(Html.fromHtml(flashMsg));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -10,4 +10,6 @@ public class GiftList implements Serializable {
|
||||
private GiftInfo gift;
|
||||
private int giftNum;
|
||||
private int prizeLevel;
|
||||
private int giftId;
|
||||
// private GiftInfo giftInfo;
|
||||
}
|
||||
|
@@ -24,4 +24,5 @@ public class GiftMultiReceiverInfo implements Serializable {
|
||||
private List<IndexGiftValue> giftValueVos;
|
||||
private long currentTime;
|
||||
private List<LuckyBagGifts> luckyBagGifts;
|
||||
private List<Long> targetUids;
|
||||
}
|
||||
|
@@ -15,9 +15,9 @@ public class LuckyBagGifts implements Serializable {
|
||||
private String giftName;
|
||||
private List<GiftInfo> displayGift;
|
||||
|
||||
private List<GiftReceiver> targetUsers;
|
||||
// private List<GiftReceiver> targetUsers;
|
||||
private List<Long> targetUids;
|
||||
private long uid;
|
||||
private int giftNum;
|
||||
private int giftId;
|
||||
private List<IndexGiftValue> giftValueVos;
|
||||
private long currentTime;
|
||||
|
@@ -361,10 +361,13 @@ public class GiftToolbox {
|
||||
luckyBagGifts.setDisplayGift(giftReceiveInfo.getDisplayGift());
|
||||
luckyBagGifts.setGiftName(giftReceiveInfo.getGift().getGiftName());
|
||||
luckyBagGifts.setCurrentTime(giftReceiveInfo.getCurrentTime());
|
||||
luckyBagGifts.setTargetUsers(giftReceiveInfo.getTargetUsers());
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
for (GiftReceiver targetUser : giftReceiveInfo.getTargetUsers()) {
|
||||
targetUids.add(targetUser.getUid());
|
||||
}
|
||||
luckyBagGifts.setTargetUids(targetUids);
|
||||
luckyBagGifts.setGiftValueVos(giftReceiveInfo.getGiftValueVos());
|
||||
luckyBagGifts.setUid(giftReceiveInfo.getUid());
|
||||
luckyBagGifts.setGiftNum(giftReceiveInfo.getGiftNum());
|
||||
luckyBagGifts.setGiftId(giftReceiveInfo.getGiftId());
|
||||
//这里去掉收礼物人的头像字段,减少容量
|
||||
MultiLuckyGiftAttachment luckyGiftAttachment = new MultiLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT,
|
||||
@@ -429,10 +432,13 @@ public class GiftToolbox {
|
||||
luckyBagGifts.setDisplayGift(giftReceiveInfo.getDisplayGift());
|
||||
luckyBagGifts.setGiftName(giftReceiveInfo.getGift().getGiftName());
|
||||
luckyBagGifts.setCurrentTime(giftReceiveInfo.getCurrentTime());
|
||||
luckyBagGifts.setTargetUsers(giftReceiveInfo.getTargetUsers());
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
for (GiftReceiver targetUser : giftReceiveInfo.getTargetUsers()) {
|
||||
targetUids.add(targetUser.getUid());
|
||||
}
|
||||
luckyBagGifts.setTargetUids(targetUids);
|
||||
luckyBagGifts.setGiftValueVos(giftReceiveInfo.getGiftValueVos());
|
||||
luckyBagGifts.setUid(giftReceiveInfo.getUid());
|
||||
luckyBagGifts.setGiftNum(giftReceiveInfo.getGiftNum());
|
||||
luckyBagGifts.setGiftId(giftReceiveInfo.getGiftId());
|
||||
MultiLuckyGiftAttachment luckyGiftAttachment = new MultiLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT, CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_LUCK_GIFT);
|
||||
luckyGiftAttachment.setMultiLuckyGiftAttachment(luckyBagGifts);
|
||||
@@ -495,10 +501,13 @@ public class GiftToolbox {
|
||||
luckyBagGifts.setDisplayGift(giftReceiveInfo.getDisplayGift());
|
||||
luckyBagGifts.setGiftName(giftReceiveInfo.getGift().getGiftName());
|
||||
luckyBagGifts.setCurrentTime(giftReceiveInfo.getCurrentTime());
|
||||
luckyBagGifts.setTargetUsers(giftReceiveInfo.getTargetUsers());
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
for (GiftReceiver targetUser : giftReceiveInfo.getTargetUsers()) {
|
||||
targetUids.add(targetUser.getUid());
|
||||
}
|
||||
luckyBagGifts.setTargetUids(targetUids);
|
||||
luckyBagGifts.setGiftValueVos(giftReceiveInfo.getGiftValueVos());
|
||||
luckyBagGifts.setUid(giftReceiveInfo.getUid());
|
||||
luckyBagGifts.setGiftNum(giftReceiveInfo.getGiftNum());
|
||||
luckyBagGifts.setGiftId(giftReceiveInfo.getGiftId());
|
||||
//这里去掉收礼物人的头像字段,减少容量
|
||||
MultiLuckyGiftAttachment luckyGiftAttachment = new MultiLuckyGiftAttachment(CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MULTI_GIFT, CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ALL_MIC_LUCKY_GIFT);
|
||||
|
@@ -6,7 +6,9 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yizhuan.xchat_android_core.gift.GiftModel;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftList;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiver;
|
||||
@@ -40,12 +42,16 @@ public class MultiLuckyGiftAttachment extends CustomAttachment {
|
||||
protected void parseData(JSONObject data) {
|
||||
multiLuckyGiftReceiveInfo = new LuckyBagGifts();
|
||||
multiLuckyGiftReceiveInfo.setUid(data.getLong("uid"));
|
||||
multiLuckyGiftReceiveInfo.setGiftNum(data.getIntValue("giftNum"));
|
||||
multiLuckyGiftReceiveInfo.setNick(data.getString("nick"));
|
||||
multiLuckyGiftReceiveInfo.setGiftId(data.getInteger("giftId"));
|
||||
multiLuckyGiftReceiveInfo.setGiftName(data.getString("giftName"));
|
||||
if (data.containsKey("gift")) {
|
||||
JSONArray giftListArray = data.getJSONArray("gift");
|
||||
|
||||
JSONObject luckyGiftListObj = data.getJSONObject("luckyGiftList");
|
||||
GiftReceiver giftReceiver = new Gson().fromJson(luckyGiftListObj.getJSONObject("user").toJSONString(), GiftReceiver.class);
|
||||
multiLuckyGiftReceiveInfo.setUser(giftReceiver);
|
||||
|
||||
if (luckyGiftListObj.containsKey("giftList")) {
|
||||
JSONArray giftListArray = luckyGiftListObj.getJSONArray("giftList");
|
||||
String giftListStr = null;
|
||||
if (giftListArray != null) {
|
||||
giftListStr = giftListArray.toJSONString();
|
||||
@@ -54,10 +60,26 @@ public class MultiLuckyGiftAttachment extends CustomAttachment {
|
||||
List<GiftList> giftList = new Gson().fromJson(giftListStr,
|
||||
new TypeToken<List<GiftList>>() {
|
||||
}.getType());
|
||||
// for (int i = 0; i < giftList.size(); i++) {
|
||||
// int giftId = giftList.get(i).getGiftId();
|
||||
// GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftId);
|
||||
// if (giftInfo == null) {
|
||||
// break;
|
||||
// }
|
||||
// giftList.get(i).setGift(giftInfo);
|
||||
// }
|
||||
multiLuckyGiftReceiveInfo.setGiftList(giftList);
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray jsonArray = data.getJSONArray("targetUids");
|
||||
List<Long> targetUids = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Long uid = jsonArray.getLong(i);
|
||||
targetUids.add(uid);
|
||||
}
|
||||
multiLuckyGiftReceiveInfo.setTargetUids(targetUids);
|
||||
|
||||
if (data.containsKey("displayGift")) {
|
||||
JSONArray displayGiftListArray = data.getJSONArray("displayGift");
|
||||
String displayGiftListStr = null;
|
||||
@@ -72,14 +94,6 @@ public class MultiLuckyGiftAttachment extends CustomAttachment {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data.getJSONObject("user").toJSONString();
|
||||
GiftReceiver giftInfo = new Gson().fromJson(data.getJSONObject("user").toJSONString(), GiftReceiver.class);
|
||||
|
||||
multiLuckyGiftReceiveInfo.setTargetUsers(data.getObject("targetUsers",
|
||||
new TypeReference<List<GiftReceiver>>() {
|
||||
}));
|
||||
|
||||
//礼物值数据处理
|
||||
if (data.containsKey("giftValueVos")) {
|
||||
JSONArray giftValueVosArray = data.getJSONArray("giftValueVos");
|
||||
@@ -95,7 +109,7 @@ public class MultiLuckyGiftAttachment extends CustomAttachment {
|
||||
}
|
||||
}
|
||||
multiLuckyGiftReceiveInfo.setCurrentTime(data.getLong("currentTime"));
|
||||
multiLuckyGiftReceiveInfo.setUser(giftInfo);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,21 +118,29 @@ public class MultiLuckyGiftAttachment extends CustomAttachment {
|
||||
object.put("nick", multiLuckyGiftReceiveInfo.getNick());
|
||||
|
||||
if (multiLuckyGiftReceiveInfo.getGiftList() != null) {
|
||||
object.put("gift", multiLuckyGiftReceiveInfo.getGiftList());
|
||||
JSONObject luckyGiftListObj = new JSONObject();
|
||||
luckyGiftListObj.put("giftList",multiLuckyGiftReceiveInfo.getGiftList());
|
||||
luckyGiftListObj.put("user",multiLuckyGiftReceiveInfo.getUser());
|
||||
object.put("luckyGiftList", luckyGiftListObj);
|
||||
}
|
||||
if (multiLuckyGiftReceiveInfo.getDisplayGift() != null) {
|
||||
object.put("displayGift", multiLuckyGiftReceiveInfo.getDisplayGift());
|
||||
}
|
||||
object.put("user", multiLuckyGiftReceiveInfo.getUser());
|
||||
object.put("targetUsers", multiLuckyGiftReceiveInfo.getTargetUsers());
|
||||
object.put("uid", multiLuckyGiftReceiveInfo.getUid());
|
||||
object.put("giftNum", multiLuckyGiftReceiveInfo.getGiftNum());
|
||||
object.put("giftId", multiLuckyGiftReceiveInfo.getGiftId());
|
||||
object.put("giftName",multiLuckyGiftReceiveInfo.getGiftName());
|
||||
//礼物值
|
||||
if (multiLuckyGiftReceiveInfo.getGiftValueVos() != null) {
|
||||
object.put("giftValueVos", multiLuckyGiftReceiveInfo.getGiftValueVos());
|
||||
}
|
||||
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (int i = 0; i < multiLuckyGiftReceiveInfo.getTargetUids().size(); i++) {
|
||||
Long uid = multiLuckyGiftReceiveInfo.getTargetUids().get(i);
|
||||
jsonArray.add(uid);
|
||||
}
|
||||
object.put("targetUids", jsonArray);
|
||||
|
||||
object.put("currentTime", multiLuckyGiftReceiveInfo.getCurrentTime());
|
||||
return object;
|
||||
}
|
||||
|
Reference in New Issue
Block a user