Commit a4ed5af4 authored by maxiaoliang's avatar maxiaoliang

修改任务完成后领取接口

parent 8e3fc437
...@@ -18,6 +18,7 @@ import com.ym.library.utils.LogUtils ...@@ -18,6 +18,7 @@ import com.ym.library.utils.LogUtils
import com.ym.library.utils.Utils import com.ym.library.utils.Utils
import com.ym.ddcy.R import com.ym.ddcy.R
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.module.TaskCompleteEntity
import com.ym.library.module.WateringTaskEntity import com.ym.library.module.WateringTaskEntity
import com.ym.library.net.GameApiClient import com.ym.library.net.GameApiClient
...@@ -54,6 +55,7 @@ class WateringTaskAdpater : ...@@ -54,6 +55,7 @@ class WateringTaskAdpater :
holder.imgcoin.setImageResource(R.mipmap.icon_popupwater_icon) holder.imgcoin.setImageResource(R.mipmap.icon_popupwater_icon)
if (data.description != null) { if (data.description != null) {
holder.btnProgess.visibility = View.GONE holder.btnProgess.visibility = View.GONE
holder.tvTitle.text = data.title+" (${data.current_nums}/${data.awardLimit})"
holder.tvProgess.text = data.description holder.tvProgess.text = data.description
} else { } else {
holder.btnProgess.visibility = View.VISIBLE holder.btnProgess.visibility = View.VISIBLE
...@@ -116,27 +118,32 @@ class WateringTaskAdpater : ...@@ -116,27 +118,32 @@ class WateringTaskAdpater :
// 领取水滴 type:1每日领水 2高额领水 // 领取水滴 type:1每日领水 2高额领水
private fun getDripTaskReceive(type: Int, data: NewsEntity) { private fun getDripTaskReceive(type: Int, data: NewsEntity) {
GameApiClient.gameApi.getTaskReceive(data.sid, type).compose( GameApiClient.gameApi.getTaskComplete(data.sid).compose(
RxSchedulers.observableIO2Main() RxSchedulers.observableIO2Main()
).subscribe(object : BaseObserver<Any>() { ).subscribe(object : BaseObserver<TaskCompleteEntity>() {
override fun onSuccess(result: Any?) { override fun onSuccess(result: TaskCompleteEntity?) {
RxBusUtil.getDefault()
.send(RxBusConstant.RX_MAIN_WATER_DROP_UPDATE) RxBusUtil.getDefault()
if (result != null) { .send(RxBusConstant.RX_MAIN_WATER_DROP_UPDATE)
LogUtils.i("WateringTaskAdpater", "水滴领取" + result) if (result != null) {
var adType = "" LogUtils.i("WateringTaskAdpater", "水滴领取" + result)
if (type == 1) { var adType = ""
adType = "每日" if (type == 1) {
} else if (type == 2) { adType = "每日"
adType = "高额" } else if (type == 2) {
adType = "高额"
}
MainDialog.showgetWaterDrop(mContext, 4, "task_coins", data.awardCoins!!, null)
} }
MainDialog.showgetWaterDrop(mContext, 4, "task_coins", data.awardCoins!!, null)
}
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {} override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
}) })
} }
/** /**
......
...@@ -75,7 +75,8 @@ class WateringRewardPresenter : WateringRewardContract.Presenter { ...@@ -75,7 +75,8 @@ class WateringRewardPresenter : WateringRewardContract.Presenter {
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
mView?.taskListResult(null) getRrchardDailyTask()
} }
}) })
} }
......
...@@ -96,6 +96,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View, ...@@ -96,6 +96,7 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
@SuppressLint() @SuppressLint()
@Subscribe(code = RxBusConstant.RX_MAIN_WATER_DROP_UPDATE, threadMode = ThreadMode.MAIN) @Subscribe(code = RxBusConstant.RX_MAIN_WATER_DROP_UPDATE, threadMode = ThreadMode.MAIN)
fun updateList() { fun updateList() {
mPresenter?.getRrchardDailyTask() mPresenter?.getRrchardDailyTask()
} }
......
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