Commit 59c8427b authored by mengcuiguang's avatar mengcuiguang

代码优化

parent cd6e5f16
...@@ -65,7 +65,6 @@ android { ...@@ -65,7 +65,6 @@ android {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "String", "AppKeyPre", "\"abcd\"" buildConfigField "String", "AppKeyPre", "\"abcd\""
buildConfigField "String", "MainIp", DEBUG_URL buildConfigField "String", "MainIp", DEBUG_URL
// buildConfigField "String", "MainIp", RELEASE_URL
//混淆 //混淆
minifyEnabled false minifyEnabled false
......
//package com.wenshu.youyou.manager
//
//import android.app.Application
//import android.os.Build
//import android.text.TextUtils
//import com.component.dly.xzzq_ywsdk.YwSDK.Companion.setDebugMode
//import com.wenshu.youyou.BuildConfig
//import com.wenshu.youyou.WenshuApplication
//
///**
// * 描述:鱼丸盒子游戏
// * 作者:孟崔广
// */
//object YwhzManager {
//
// private const val APPID_DEBUG = ""
// private const val APPSECRET_DEBUG = ""
//
// private const val APPID_RELEASE = ""
// private const val APPSECRET_RELEASE = ""
//
// fun init(application: Application) {
// val userManager = UserManager.getInstance()
// var userID = userManager.userID
// if (!userManager.userIsLogin() || TextUtils.isEmpty(userID)) {
// // 用户id为空 或 未登录 = 游客
// userID = "0"
// }
//
// val appid: String
// val appSecret: String
// if (BuildConfig.DEBUG) {
// appid = APPID_DEBUG
// appSecret = APPSECRET_DEBUG
// } else {
// appid = APPID_RELEASE
// appSecret = APPSECRET_RELEASE
// }
// var oaid: String = ""
// if (Build.VERSION.SDK_INT > 28) {
// if (!TextUtils.isEmpty(WenshuApplication.OAID)) {
// oaid = WenshuApplication.OAID
// }
// }
// setDebugMode()
// init(application, appSecret, appid, userID, "1", oaid)
// }
//}
\ No newline at end of file
package com.wenshu.youyou.mvp.model
import java.io.Serializable
data class CpdBean(val needSeconds: Int = 0,
val coin: Int = 0,
val CPD: Int = 0,
val CPD_SYD: Int = 0,
val cpdOrder: String = "",
val coinSh: Int = 0,
val coinSyd: Int = 0
) : Serializable
\ No newline at end of file
...@@ -35,6 +35,7 @@ class FriendsPresenter : BasePresenter<FriendsView>() { ...@@ -35,6 +35,7 @@ class FriendsPresenter : BasePresenter<FriendsView>() {
when (baseResponse.status) { when (baseResponse.status) {
200 -> { 200 -> {
sonCashoutChallengeMsg()
view.getFriendsHallMsgSuc(baseResponse.data) view.getFriendsHallMsgSuc(baseResponse.data)
} }
else -> { else -> {
...@@ -185,7 +186,7 @@ class FriendsPresenter : BasePresenter<FriendsView>() { ...@@ -185,7 +186,7 @@ class FriendsPresenter : BasePresenter<FriendsView>() {
/** /**
* 新版分红逻辑 * 新版分红逻辑
*/ */
fun sonCashoutChallengeMsg() { private fun sonCashoutChallengeMsg() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call( .call(
loanService.sonCashoutChallengeMsg(), loanService.sonCashoutChallengeMsg(),
......
...@@ -16,6 +16,7 @@ import com.wenshu.youyou.utils.LogUtil ...@@ -16,6 +16,7 @@ import com.wenshu.youyou.utils.LogUtil
import com.wenshu.library.net.neterror.BaseSubscriber import com.wenshu.library.net.neterror.BaseSubscriber
import com.wenshu.library.net.neterror.Throwable import com.wenshu.library.net.neterror.Throwable
import com.wenshu.library.utils.json.JsonUtil import com.wenshu.library.utils.json.JsonUtil
import com.wenshu.youyou.mvp.model.CpdBean
class TaskPresenter : BasePresenter<TaskView>() { class TaskPresenter : BasePresenter<TaskView>() {
fun getShCpdTime() { fun getShCpdTime() {
...@@ -25,7 +26,7 @@ class TaskPresenter : BasePresenter<TaskView>() { ...@@ -25,7 +26,7 @@ class TaskPresenter : BasePresenter<TaskView>() {
view.showLoading("加载中...") view.showLoading("加载中...")
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.getShCpdTime(vo), .call(loanService.getShCpdTime(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() { object : BaseSubscriber<BaseResponse<CpdBean>>() {
override fun onCompleted() { override fun onCompleted() {
} }
...@@ -35,20 +36,14 @@ class TaskPresenter : BasePresenter<TaskView>() { ...@@ -35,20 +36,14 @@ class TaskPresenter : BasePresenter<TaskView>() {
view.hideLoading() view.hideLoading()
} }
override fun onNext(baseResponse: BaseResponse<JsonObject>) { override fun onNext(baseResponse: BaseResponse<CpdBean>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.status val code = baseResponse.status
val data = baseResponse.data val data = baseResponse.data
when (code) { when (code) {
200 -> { 200 -> {
if (data != null) { if (data != null) {
view.getShCpdTimeSuc( view.getShCpdTimeSuc(baseResponse.data)
data.get("needSeconds").asInt,
data.get("coin").asInt,
data.get("CPD").asInt,
data.get("CPD_SYD").asInt,
data.get("cpdOrder").asString
)
} }
} }
} }
......
package com.wenshu.youyou.mvp.views package com.wenshu.youyou.mvp.views
import com.wenshu.youyou.mvp.model.CpdBean
import com.wenshu.youyou.mvp.model.CpdModelBean import com.wenshu.youyou.mvp.model.CpdModelBean
import com.wenshu.youyou.mvp.model.SydCpdListBean import com.wenshu.youyou.mvp.model.SydCpdListBean
interface TaskView : BaseView { interface TaskView : BaseView {
fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int, CPD_ORDER: String?) fun getShCpdTimeSuc(data: CpdBean)
fun getCpdModelSuc(dataBean: CpdModelBean.DataBean) fun getCpdModelSuc(dataBean: CpdModelBean.DataBean)
......
...@@ -10,6 +10,7 @@ import com.wenshu.youyou.mvp.model.BaseResponse; ...@@ -10,6 +10,7 @@ import com.wenshu.youyou.mvp.model.BaseResponse;
import com.wenshu.youyou.mvp.model.CashoutChallengeBean; import com.wenshu.youyou.mvp.model.CashoutChallengeBean;
import com.wenshu.youyou.mvp.model.ClickTurnBean; import com.wenshu.youyou.mvp.model.ClickTurnBean;
import com.wenshu.youyou.mvp.model.CommonParamBean; import com.wenshu.youyou.mvp.model.CommonParamBean;
import com.wenshu.youyou.mvp.model.CpdBean;
import com.wenshu.youyou.mvp.model.DrawcashBean; import com.wenshu.youyou.mvp.model.DrawcashBean;
import com.wenshu.youyou.mvp.model.DrawcashRecordBean; import com.wenshu.youyou.mvp.model.DrawcashRecordBean;
import com.wenshu.youyou.mvp.model.FriendHallMsgBean; import com.wenshu.youyou.mvp.model.FriendHallMsgBean;
...@@ -538,7 +539,7 @@ public interface LoanService { ...@@ -538,7 +539,7 @@ public interface LoanService {
* @return * @return
*/ */
@POST("api/114/getCPDBaseMsg") @POST("api/114/getCPDBaseMsg")
Observable<BaseResponse<JsonObject>> getShCpdTime(@Body Map<String, Object> vo); Observable<BaseResponse<CpdBean>> getShCpdTime(@Body Map<String, Object> vo);
/** /**
* 获取用户配置信息 * 获取用户配置信息
......
...@@ -182,8 +182,6 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F ...@@ -182,8 +182,6 @@ class FriendsFragment(private var isResume: Boolean = false) : BaseFragment(), F
// 刷新分红数据 // 刷新分红数据
friendsPresenter.getFriendHallMsg() friendsPresenter.getFriendHallMsg()
friendsPresenter.sonCashoutChallengeMsg()
when (view_pager_friends.currentItem) { when (view_pager_friends.currentItem) {
0 -> { 0 -> {
friendsPresenter.getContributionBigLeaders() friendsPresenter.getContributionBigLeaders()
......
...@@ -38,6 +38,7 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout ...@@ -38,6 +38,7 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.tz.sdk.coral.ad.CoralAD import com.tz.sdk.coral.ad.CoralAD
import com.tz.sdk.coral.callback.h5.DownloadProcess import com.tz.sdk.coral.callback.h5.DownloadProcess
import com.wenshu.youyou.mvp.model.CpdBean
import kotlinx.android.synthetic.main.fragment_task_cpd.* import kotlinx.android.synthetic.main.fragment_task_cpd.*
private val TAG = TaskCpdFragment::class.java.simpleName private val TAG = TaskCpdFragment::class.java.simpleName
...@@ -139,12 +140,12 @@ class TaskCpdFragment : BaseFragment(), TaskView, ...@@ -139,12 +140,12 @@ class TaskCpdFragment : BaseFragment(), TaskView,
override fun getContentViewLayoutID() = R.layout.activity_task override fun getContentViewLayoutID() = R.layout.activity_task
override fun getShCpdTimeSuc(time: Int, coin: Int, CPD: Int, CPD_SYD: Int, CPD_ORDER: String?) { override fun getShCpdTimeSuc(data: CpdBean) {
needUseTime = time needUseTime = data.needSeconds
shCoin = coin shCoin = data.coinSh
sydCoin = coin sydCoin = data.coinSyd
shMax = CPD shMax = data.CPD
cpdMax = CPD_SYD cpdMax = data.CPD_SYD
if ((shMax + cpdMax) <= 0) { if ((shMax + cpdMax) <= 0) {
hideLoading() hideLoading()
...@@ -164,13 +165,13 @@ class TaskCpdFragment : BaseFragment(), TaskView, ...@@ -164,13 +165,13 @@ class TaskCpdFragment : BaseFragment(), TaskView,
cpdLoadCountTime = 0 cpdLoadCountTime = 0
mFakeTaskList.clear() mFakeTaskList.clear()
if (TextUtils.isEmpty(CPD_ORDER)) { if (TextUtils.isEmpty(data.cpdOrder)) {
notifyDataAndShowAd() notifyDataAndShowAd()
return return
} }
// 珊瑚和CPD展示顺序 // 珊瑚和CPD展示顺序
when (CPD_ORDER) { when (data.cpdOrder) {
"CPD_SYD" -> { "CPD_SYD" -> {
when { when {
cpdMax > 0 -> { cpdMax > 0 -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment