Selaa lähdekoodia

feat: benefit

tongmengxiao 1 kuukausi sitten
vanhempi
commit
cb46784e41

+ 1 - 0
baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt

@@ -51,4 +51,5 @@ interface IRoomInfo {
     fun getHeadSpecial():String //头像框
     fun getBadgeSpecial():String //徽章
     fun getChatSpecial():String //聊天气泡
+    fun getTimeKey():String //在直播间里时间
 }

+ 9 - 1
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -29,6 +29,13 @@ object UrlConstant {
         }
     }
 
+    private val TRAFFIC_URL by lazy {
+        if (BuildConfig.DEBUG) {
+            "http://test-h5.swago.cn"
+        } else {
+            "https://web-view.me-live.cn"
+        }
+    }
 
     private val gson by lazy {
         Gson()
@@ -85,7 +92,8 @@ object UrlConstant {
     val WITHDRAW_CUSTOMER = "${BASE_WEB_URL}/withdrawal/customer"//所有用户都跳跳这个 1.2.0版本改的
     //排行榜
     val RANKING = "${BASE_WEB_URL}/goldCoinRank"
-
+    //转盘
+    val TRAFFIC = "${TRAFFIC_URL}/checkIn"
     var appGameRootPath =
         AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "gameFile"
 

+ 2 - 1
baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt

@@ -14,6 +14,7 @@ import android.webkit.WebViewClient
 import androidx.constraintlayout.widget.ConstraintLayout
 import androidx.transition.Visibility
 import com.google.firebase.firestore.core.View
+import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.databinding.DialogTodayTrafficBinding
 import com.swago.baseswago.util.DpPxUtil
 import com.swago.baseswago.util.SwagoInfo
@@ -90,7 +91,7 @@ class TodayTrafficDialog : BaseStoreDFragment<DialogTodayTrafficBinding>() {
 
                 }
             }
-            loadUrl("http://test-h5.swago.cn/checkIn")
+            loadUrl(UrlConstant.TRAFFIC)
         }
     }
 

+ 2 - 2
baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt

@@ -84,14 +84,14 @@ interface RoomApi {
      */
     @FormUrlEncoded
     @POST("/v1/rtc/leave/broadcast")
-    suspend fun leaveRoom(@Field("room_id") room_id: String): Any
+    suspend fun leaveRoom(@Field("room_id") room_id: String, @Field("time_key") time_key: String): Any
 
     /**
      * 退出房间(小黑屋)
      */
     @FormUrlEncoded
     @POST("/v1/rtc/house/leave/broadcast")
-    suspend fun houseLeaveRoom(@Field("room_id") room_id: String): Any
+    suspend fun houseLeaveRoom(@Field("room_id") room_id: String, @Field("time_key") time_key: String): Any
 
 
     /**

+ 10 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java

@@ -52,6 +52,7 @@ public class RoomModel {
     private String give_val;
 
     private String broadcast_bg_url;
+    private String time_key;
 
     private String join_special;
     private String head_special;
@@ -278,6 +279,14 @@ public class RoomModel {
         this.broadcast_bg_url = broadcast_bg_url;
     }
 
+    public String getTime_key() {
+        return time_key;
+    }
+
+    public void setTime_key(String time_key) {
+        this.time_key = time_key;
+    }
+
     public CusNewMsgBean<RoomUserChangeModel> getJoin_im_data() {
         return join_im_data;
     }
@@ -325,4 +334,5 @@ public class RoomModel {
     public void setBroadcast_head_special(String broadcast_head_special) {
         this.broadcast_head_special = broadcast_head_special;
     }
+
 }

+ 1 - 1
home/src/main/java/com/swago/home/MineFragment.kt

@@ -185,7 +185,7 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
             }
         })
 
-        payVm.getBenefit()
+//        payVm.getBenefit()
     }
 
     override fun initLiveData() {

+ 2 - 0
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -23,6 +23,7 @@ import com.liulishuo.okdownload.core.breakpoint.BreakpointInfo
 import com.liulishuo.okdownload.core.cause.EndCause
 import com.liulishuo.okdownload.core.cause.ResumeFailedCause
 import com.permissionx.guolindev.PermissionX
+import com.swago.baseswago.PayVm
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.baseroom.*
@@ -116,6 +117,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     val roomOtherVm by activityViewModels<RoomOtherVm>()
     val msgVm by activityViewModels<MsgVm>()
     val userVm by activityViewModels<UserVm>()
+    val payVm by activityViewModels<PayVm>()
     lateinit var unreadMessageVm: UnreadMessageVm
 
     /**

+ 4 - 0
room/src/main/java/com/swago/room/bean/UserRoomModel.kt

@@ -221,4 +221,8 @@ class UserRoomModel : IRoomInfo {
             roomModel?.chat_special ?: ""
         }
     }
+
+    override fun getTimeKey(): String {
+        return roomModel?.time_key ?: ""
+    }
 }

+ 7 - 3
room/src/main/java/com/swago/room/user/UserRoomFragment.kt

@@ -53,8 +53,6 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
     private var isSameDate:Boolean = false
     override fun initOther() {
         super.initOther()
-        isSameDate = SpUtil.readString("last_visit_date") == TimeUtil.getCurrentDate()
-        SpUtil.putString("last_visit_date", TimeUtil.getCurrentDate())
         binding.ivBenefit.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
                 openBenefitBagDialog()
@@ -231,6 +229,12 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
 
             }.show(parentFragmentManager , "EnterPasswordDialog")
         }
+
+        payVm.benefitLiveData.observe(this){
+            if (it.is_benefit==0&&it.is_pop_discount_package==0){
+                BenefitBagDialog.newInstance().show(childFragmentManager, "BenefitBagDialog")
+            }
+        }
     }
 
     fun dismissDialog() {
@@ -283,7 +287,7 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
         }
         if (!isSameDate){
             isSameDate = true
-            openBenefitBagDialog()
+            payVm.getBenefit()
         }
     }
 

+ 2 - 2
room/src/main/java/com/swago/room/vm/RoomVm.kt

@@ -291,9 +291,9 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
         requestData2(false) {
             requestData {
                 if (iRoomInfo.getRoomType() == RoomType.HOUSE.type){
-                    ApiManager.roomApi.houseLeaveRoom(iRoomInfo.getRoomId())
+                    ApiManager.roomApi.houseLeaveRoom(iRoomInfo.getRoomId(),iRoomInfo.getTimeKey())
                 } else {
-                    ApiManager.roomApi.leaveRoom(iRoomInfo.getRoomId())
+                    ApiManager.roomApi.leaveRoom(iRoomInfo.getRoomId(),iRoomInfo.getTimeKey())
                 }
             }
 

+ 1 - 1
user/src/main/java/com/swago/user/SettingActivity.kt

@@ -32,7 +32,7 @@ class SettingActivity : BaseXActivity<ActivitySettingBinding>() {
         setBackView(binding.toolbar.ivBack)
         binding.toolbar.tvTitle.text = AppContext.getContext().resources.getString(R.string.setting)
 
-        binding.tvVersion.text = getVersionName() + "(2)"
+        binding.tvVersion.text = getVersionName()
 
         binding.tvUserAgreement.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {