埋点配置

This commit is contained in:
18401019693 2023-09-05 13:24:21 +08:00
parent 93aa8e55e5
commit 82fd35305a
9 changed files with 218 additions and 41 deletions

View File

@ -66,6 +66,28 @@ public class LiveGiftBean {
private String namingCoin;
@JSONField(name = "naming_user_coin")
private String namingUserCoin;
@JSONField(name = "blind_box_ticket")
private int blindBoxTicket;
@JSONField(name = "blind_box_ticket_id")
private int blindBoxTicketId;
public int getBlindBoxTicketId() {
return blindBoxTicketId;
}
public LiveGiftBean setBlindBoxTicketId(int blindBoxTicketId) {
this.blindBoxTicketId = blindBoxTicketId;
return this;
}
public int getBlindBoxTicket() {
return blindBoxTicket;
}
public LiveGiftBean setBlindBoxTicket(int blindBoxTicket) {
this.blindBoxTicket = blindBoxTicket;
return this;
}
public String getNamingUserCoin() {
return namingUserCoin;
@ -202,7 +224,7 @@ public class LiveGiftBean {
return this;
}
private int fansGiftLevel=0;//粉丝团礼物等级要求
private int fansGiftLevel = 0;//粉丝团礼物等级要求
public int getFansGiftLevel() {
return fansGiftLevel;

View File

@ -6,10 +6,6 @@ import com.lzy.okgo.request.GetRequest;
import com.lzy.okgo.request.PostRequest;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MD5Util;
@ -292,6 +288,7 @@ public class LiveHttpUtil {
/**
* 主播或管理员禁言
*
* @param time 禁言时间
*/
public static void setShutUp(String liveUid, String stream, int type, String touid, String time, HttpCallback callback) {
@ -619,17 +616,19 @@ public class LiveHttpUtil {
* 观众给主播送礼物
*/
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) {
sendGift(by, liveUid, stream, giftId, giftCount, 0, false,callback);
sendGift(by, liveUid, stream, giftId, giftCount, 0, false, callback);
}
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false,callback);
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false, callback);
}
/**
* 观众给主播送礼物
*
* @param isContactGift 是否为联系方式礼物
*/
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift,HttpCallback callback) {
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift, HttpCallback callback) {
HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT)
.params("liveuid", liveUid)
.params("stream", stream)
@ -637,7 +636,20 @@ public class LiveHttpUtil {
.params("isContactGift", isContactGift)
.params("giftcount", giftCount)
.params("isprank", by)
.params("fans_exclusive_pack",isFansGroupGift?"1":"0")
.params("fans_exclusive_pack", isFansGroupGift ? "1" : "0")
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}
public static void sendBlindBoxTicket(String by, String liveUid, String stream, int giftId, HttpCallback callback) {
HttpClient.getInstance().get("Live.sendBlindBoxTicket", LiveHttpConsts.SEND_GIFT)
.params("liveuid", liveUid)
.params("stream", stream)
.params("giftid", giftId)
.params("isContactGift", 0)
.params("giftcount", "1")
.params("isprank", by)
.params("fans_exclusive_pack", "0")
.params("appVersion", CommonAppConfig.getInstance().getVersion())
.execute(callback);
}

View File

@ -1313,5 +1313,7 @@ Limited ride And limited avatar frame</string>
<string name="cancel_ca">cancel</string>
<string name="settings_ser">settings</string>
<string name="too_many_gifts">Too many gifts</string>
<string name="trial_coupon">是否使用試用劵</string>
<string name="use_diamonds">使用鑽石</string>
</resources>

View File

@ -66,4 +66,14 @@ public class FrameGiftAdapter extends RecyclerView.Adapter {
public int getItemCount() {
return giftJson.size();
}
public void refreshWrapListAfterSend(LiveGiftBean model) {
for (int i = 0; i < giftJson.size(); i++) {
if (giftJson.get(i).getId() == model.getId()) {
int giftNum = giftJson.get(i).getBlindBoxTicket();
giftJson.get(i).setBlindBoxTicket(giftNum - 1);
}
}
notifyDataSetChanged();
}
}

View File

@ -34,15 +34,20 @@ public class CoinModel extends BaseModel {
public String getCoin() {
long coinMoney = Long.parseLong(coin);
String coinStr = coin;
if (999999999 < coinMoney && coinMoney <= 999999999999L) {
coin = coin.substring(0, coin.length() - 3);
coin = coin + "k";
coinStr = coinStr.substring(0, coinStr.length() - 3);
coinStr = coinStr + "k";
}
if (999999999999L < coinMoney && coinMoney <= 999999999999999L) {
coin = coin.substring(0, coin.length() - 6);
coin = coin + "M";
coinStr = coinStr.substring(0, coinStr.length() - 6);
coinStr = coinStr + "M";
}
return coin;
return coinStr;
}
public Long getCoinLong() {
return Long.parseLong(coin);
}
public CoinModel setCoin(String coin) {

View File

@ -230,7 +230,36 @@ public class LiveGiftPopup extends AbsDialogFragment {
@Override
public void onViewClicks() {
MobclickAgent.onEvent(mContext, "gif_list_seed_gif", "用户送礼物");
if (liveGiftModel != null && liveGiftModel.getBlindBoxTicket() > 0) {
BigDecimal needcoin = new BigDecimal(liveGiftModel.getPrice()).multiply(new BigDecimal(mCount));
if (needcoin.longValue() > diamond) {
sendBlindBoxTicket();
} else {
new DialogUitl.Builder(mContext)
.setView(R.layout.dialog_live_unfollow)
.setConfirmString(mContext.getString(R.string.aristocrat_determine))
.setCancelString(mContext.getString(R.string.use_diamonds))
.setContent(mContext.getString(R.string.trial_coupon))
.setClickCallback(new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
sendGiftHandler.post(sendGiftRunnble);
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
sendBlindBoxTicket();
}
}).setCancelable(true).build().show();
}
} else {
sendGiftHandler.post(sendGiftRunnble);
}
}
});
@ -453,6 +482,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
/**
* 获取砖石和金豆余额
*/
long diamond = 0;
private void getCoin() {
LiveHttpUtil.getCoin(new HttpCallback() {
@Override
@ -462,6 +493,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
CoinModel coinModel = GsonUtils.fromJson(info[0], CoinModel.class);
goldText.setText(coinModel.getGold());
diamondText.setText(coinModel.getCoin());
diamond = coinModel.getCoinLong();
lvStr.setText("Lv." + coinModel.getUserLevel());
findViewById(R.id.red_point).setVisibility((!TextUtils.isEmpty(coinModel.getUsersPackRedDot())) &&
@ -528,10 +560,66 @@ public class LiveGiftPopup extends AbsDialogFragment {
private Runnable sendGiftRunnble = new Runnable() {
@Override
public void run() {
if (isWrap && liveGiftModel.getType() == 7) {
sendBlindBoxTicket();
} else {
sendGift();
}
}
};
//使用优惠券
public void sendBlindBoxTicket() {
if (TextUtils.isEmpty(mLiveUid) ||
TextUtils.isEmpty(mStream) ||
liveGiftModel == null)
return;
LiveHttpUtil.sendBlindBoxTicket((by != null ? "1" : "0"),
mLiveUid,
mStream,
isWrap ? liveGiftModel.getId() : liveGiftModel.getBlindBoxTicketId(), new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
if (liveGiftModel.getSwf().contains("svga")) {
dismiss();
}
if (info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
String coin = obj.getString("coin");
String goldCoin = obj.getString("gold");
UserBean u = CommonAppConfig.getInstance().getUserBean();
if (u != null) {
u.setLevel(obj.getIntValue("level"));
//送礼物后更新粉丝徽章等级
u.setMedalLevel(obj.getIntValue("medal_level"));
u.setMedalName(obj.getString("medal_name"));
u.setCoin(coin);
}
if (diamondText != null) {
diamondText.setText(coin);
}
if (goldText != null) {
goldText.setText(goldCoin);
}
if (!isWrap) {
liveGiftModel.setBlindBoxTicket(liveGiftModel.getBlindBoxTicket() - 1);
}
isGetNewWrap = true;
if (isWrap) {
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel));
}
}
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 赠送礼物
*/
@ -655,10 +743,12 @@ public class LiveGiftPopup extends AbsDialogFragment {
lianSongHandler.removeCallbacks(lianSongRunnable);
mShowLianBtn = false;
getCoin();
LiveNetManager.get(mContext)
.getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback<GiftNamingInfoModel>() {
@Override
public void onSuccess(GiftNamingInfoModel data) {
if (TextUtils.equals(data.getNamingStatus(), "1")) {
liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class);
if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) &&
!TextUtils.isEmpty(liveGiftModel.getNamingUid()) &&
@ -688,6 +778,10 @@ public class LiveGiftPopup extends AbsDialogFragment {
namingLayout.setVisibility(View.GONE);
}
} else {
namingLayout.setVisibility(View.GONE);
}
}
@Override
@ -800,7 +894,7 @@ public class LiveGiftPopup extends AbsDialogFragment {
if (!TextUtils.isEmpty(liveGiftModel.getOperateImage())) {
operateImage.setVisibility(View.VISIBLE);
ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage);
}else {
} else {
operateImage.setVisibility(View.GONE);
}
@ -1185,12 +1279,15 @@ public class LiveGiftPopup extends AbsDialogFragment {
if (goldText != null) {
goldText.setText(goldCoin);
}
if (!mGiftBean.getSwf().contains("svga")) {
showLianBtn();
}
if (mGiftBean.getType() == 7) {
showLianBtn();
}
// //刷新包裹列表wrap_gift_num -1:表示数量没有变化
// mObjGiftSendback = obj;
isGetNewWrap = true;

View File

@ -0,0 +1,17 @@
package com.yunbao.live.event;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveGiftBean;
public class LiveGiftItemRefreshEvent extends BaseModel {
private LiveGiftBean liveGiftModel;
public LiveGiftBean getLiveGiftModel() {
return liveGiftModel;
}
public LiveGiftItemRefreshEvent setLiveGiftModel(LiveGiftBean liveGiftModel) {
this.liveGiftModel = liveGiftModel;
return this;
}
}

View File

@ -19,6 +19,11 @@ import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveGiftFragmentPagerAdapter;
import com.yunbao.live.event.LiveGiftItemRefreshEvent;
import com.yunbao.live.event.LiveParcelItemRefreshEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
@ -148,4 +153,6 @@ public class LiveGiftFragment extends BaseFragment {
liveGiftFragment.setArguments(bundle);
return liveGiftFragment;
}
}

View File

@ -17,6 +17,7 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.live.R;
import com.yunbao.live.adapter.FrameGiftAdapter;
import com.yunbao.live.event.LiveGiftItemEvent;
import com.yunbao.live.event.LiveGiftItemRefreshEvent;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@ -79,4 +80,8 @@ public class LiveGiftItemFragment extends BaseFragment {
public void onLiveGiftItemEvent(LiveGiftItemEvent event) {
frameGiftAdapter.giftSelect(event.getLiveGiftModel());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveGiftItemRefreshEvent(LiveGiftItemRefreshEvent event) {
frameGiftAdapter.refreshWrapListAfterSend(event.getLiveGiftModel());
}
}