[修复]0元购接口参数问题
This commit is contained in:
parent
b795f4458a
commit
fd0a5725e3
|
|
@ -42,20 +42,28 @@ import com.viddin.videos.free.databinding.ActivityWithdrawBinding as ViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现主页面 Activity
|
||||||
|
* 负责展示可提现金额列表、处理提现逻辑、显示提现结果弹窗及新手引导
|
||||||
|
*/
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
// 存储提现选项视图的列表
|
||||||
private val mItemViewList: MutableList<WithDrawItemView> = mutableListOf()
|
private val mItemViewList: MutableList<WithDrawItemView> = mutableListOf()
|
||||||
|
|
||||||
|
|
||||||
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
override fun inflateViewBinding(inflater: LayoutInflater) = ViewBinding.inflate(inflater)
|
||||||
|
|
||||||
override fun ViewBinding.initWindowInsets() {
|
override fun ViewBinding.initWindowInsets() {
|
||||||
|
// 设置沉浸式状态栏
|
||||||
setImmerseRootView(contentRoot)
|
setImmerseRootView(contentRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initViews() {
|
override fun ViewBinding.initViews() {
|
||||||
|
// 设置标题栏文字
|
||||||
titlebar.setTitleText(R.string.sacar)
|
titlebar.setTitleText(R.string.sacar)
|
||||||
|
|
||||||
|
// 初始化提现选项列表
|
||||||
mItemViewList.add(withdraw01)
|
mItemViewList.add(withdraw01)
|
||||||
mItemViewList.add(withdraw1)
|
mItemViewList.add(withdraw1)
|
||||||
mItemViewList.add(withdraw10)
|
mItemViewList.add(withdraw10)
|
||||||
|
|
@ -64,6 +72,7 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
mItemViewList.add(withdraw100)
|
mItemViewList.add(withdraw100)
|
||||||
mItemViewList.add(withdraw300)
|
mItemViewList.add(withdraw300)
|
||||||
|
|
||||||
|
// 为每个提现选项设置金额和点击回调
|
||||||
withdraw01.setNumAndAction(0, 0.1,
|
withdraw01.setNumAndAction(0, 0.1,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
handleGotoWithdraw(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
|
|
@ -99,60 +108,84 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
handleGotoWithdraw(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 设置提现方式(如 PIX)的图标和点击事件
|
||||||
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
|
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
|
||||||
|
// 点击显示绑定银行卡对话框
|
||||||
WithdrawBindBankDialog(this@WithDrawActivity, null).setWithDrawCashNum(0.0).show()
|
WithdrawBindBankDialog(this@WithDrawActivity, null).setWithDrawCashNum(0.0).show()
|
||||||
})
|
})
|
||||||
|
|
||||||
withdrawPix2.setSelectedState(true)
|
withdrawPix2.setSelectedState(true)
|
||||||
|
|
||||||
|
// 设置点击事件监听
|
||||||
setOnClickBatch(withdrawRecord) {
|
setOnClickBatch(withdrawRecord) {
|
||||||
when(this) {
|
when(this) {
|
||||||
withdrawRecord -> {
|
withdrawRecord -> {
|
||||||
|
// 跳转到提现记录页面
|
||||||
Router.WithdrawRecord.startActivity(this@WithDrawActivity)
|
Router.WithdrawRecord.startActivity(this@WithDrawActivity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新总金额 UI
|
||||||
updateUICashTotal()
|
updateUICashTotal()
|
||||||
|
|
||||||
|
// 判断 0.1 元新人提现是否已完成,若完成则隐藏该选项
|
||||||
// TaskManager.instance().newbieFirstWithdrawStatus().getStatusBean().hasWithdrawed
|
// TaskManager.instance().newbieFirstWithdrawStatus().getStatusBean().hasWithdrawed
|
||||||
if (WithdrawManager.instance().getItemState(0, 0) == STATE_WITHDRAW_SUCCESS
|
if (WithdrawManager.instance().getItemState(0, 0) == STATE_WITHDRAW_SUCCESS
|
||||||
|| TaskManager.instance().newbieFirstWithdrawStatus().smallCashHasWithdrawed()) {
|
|| TaskManager.instance().newbieFirstWithdrawStatus().smallCashHasWithdrawed()) {
|
||||||
withdraw01.isVisible = false
|
withdraw01.isVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 上报提现页面展示事件
|
||||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Show)
|
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_Show)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理提现点击逻辑
|
||||||
|
* @param itemIndex 提现选项的索引
|
||||||
|
*/
|
||||||
private fun handleGotoWithdraw(itemIndex: Int) {
|
private fun handleGotoWithdraw(itemIndex: Int) {
|
||||||
val cashNum = mItemViewList.get(itemIndex).getCashNum()
|
val cashNum = mItemViewList.get(itemIndex).getCashNum()
|
||||||
if (cashNum >= 1.0) {
|
if (cashNum >= 1.0) {
|
||||||
|
// 金额大于等于 1.0,标记开始提现并进入二级提现页面
|
||||||
WithdrawManager.instance().setItemStarted(itemIndex)
|
WithdrawManager.instance().setItemStarted(itemIndex)
|
||||||
gotoWithdrawSubActivity(itemIndex)
|
gotoWithdrawSubActivity(itemIndex)
|
||||||
} else {
|
} else {
|
||||||
|
// 小额提现(0.1元)逻辑
|
||||||
val hasBindBank = AccountManager.hasValidBankInfo()
|
val hasBindBank = AccountManager.hasValidBankInfo()
|
||||||
if (!hasBindBank) {
|
if (!hasBindBank) {
|
||||||
|
// 未绑定银行卡,显示绑定弹窗
|
||||||
WithdrawBindBankDialog(this@WithDrawActivity, ::startRealWithdraw ).setWithDrawCashNum(cashNum).show()
|
WithdrawBindBankDialog(this@WithDrawActivity, ::startRealWithdraw ).setWithDrawCashNum(cashNum).show()
|
||||||
} else {
|
} else {
|
||||||
if (WithdrawManager.instance().getItemState(0, 0) == STATE_COULD_WITHDRAW) {
|
if (WithdrawManager.instance().getItemState(0, 0) == STATE_COULD_WITHDRAW) {
|
||||||
|
// 已满足提现条件,显示信息确认弹窗
|
||||||
WithdrawInfoConfirmDialog(this@WithDrawActivity, ::startRealWithdraw).setWithDrawCashNum(cashNum).show()
|
WithdrawInfoConfirmDialog(this@WithDrawActivity, ::startRealWithdraw).setWithDrawCashNum(cashNum).show()
|
||||||
} else {
|
} else {
|
||||||
|
// 不满足条件(通常是需要看广告),显示看广告提现弹窗
|
||||||
WithdrawWatchAdDialog(this@WithDrawActivity, cashNum, ::startRealWithdraw).show()
|
WithdrawWatchAdDialog(this@WithDrawActivity, cashNum, ::startRealWithdraw).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 上报点击提现选项事件
|
||||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_finsh, mapOf("Withdrawal_Position" to cashNum))
|
StatisticUtil.reportEvents(StatisticUtil.KEY_Withdrawal_finsh, mapOf("Withdrawal_Position" to cashNum))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起真实的提现请求
|
||||||
|
* @param cashNum 提现金额
|
||||||
|
*/
|
||||||
private fun startRealWithdraw(cashNum: Double) {
|
private fun startRealWithdraw(cashNum: Double) {
|
||||||
// payCashNum: Double, payItemId: Int, paySubItemId: Int, payItemLoopIndex: Int
|
// payCashNum: Double, payItemId: Int, paySubItemId: Int, payItemLoopIndex: Int
|
||||||
WithdrawManager.instance().startWithdrawReal(cashNum, 0, 0, 1)
|
WithdrawManager.instance().startWithdrawReal(cashNum, 0, 0, 1)
|
||||||
WithdrawManager.instance().setItemStarted(0)
|
WithdrawManager.instance().setItemStarted(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新 UI 上的总现金数和已提现成功总额
|
||||||
|
*/
|
||||||
private fun updateUICashTotal() {
|
private fun updateUICashTotal() {
|
||||||
binding.tvCashTotal.text = String.format("%.2f", AccountManager.getCash())
|
binding.tvCashTotal.text = String.format("%.2f", AccountManager.getCash())
|
||||||
binding.tvAllCashHasWithdrawed.text = buildString {
|
binding.tvAllCashHasWithdrawed.text = buildString {
|
||||||
|
|
@ -162,11 +195,15 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新提现列表项的 UI 状态(进度、按钮等)
|
||||||
|
*/
|
||||||
private fun updateItemListUI() {
|
private fun updateItemListUI() {
|
||||||
mItemViewList.forEach {
|
mItemViewList.forEach {
|
||||||
it.updateProgressAndButUI()
|
it.updateProgressAndButUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查是否需要隐藏 0.1 元提现选项
|
||||||
if (WithdrawManager.instance().getItemState(0, 0) == STATE_WITHDRAW_SUCCESS
|
if (WithdrawManager.instance().getItemState(0, 0) == STATE_WITHDRAW_SUCCESS
|
||||||
|| TaskManager.instance().newbieFirstWithdrawStatus().smallCashHasWithdrawed()) {
|
|| TaskManager.instance().newbieFirstWithdrawStatus().smallCashHasWithdrawed()) {
|
||||||
binding.withdraw01.isVisible = false
|
binding.withdraw01.isVisible = false
|
||||||
|
|
@ -175,22 +212,27 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
|
||||||
|
|
||||||
override fun ViewBinding.initListeners() {
|
override fun ViewBinding.initListeners() {
|
||||||
|
// 注册事件总线监听
|
||||||
registerEvents({ data->
|
registerEvents({ data->
|
||||||
when (data?.mEventType) {
|
when (data?.mEventType) {
|
||||||
VididinEvents.Event_Account_Cash_Changed -> {
|
VididinEvents.Event_Account_Cash_Changed -> {
|
||||||
|
// 现金余额发生变化
|
||||||
updateUICashTotal()
|
updateUICashTotal()
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_AD_WATCHED_FOR_WITHDRAW_SMALL -> {
|
VididinEvents.EVENT_AD_WATCHED_FOR_WITHDRAW_SMALL -> {
|
||||||
|
// 小额提现看广告奖励
|
||||||
val adNotifyBean = data.mData as WatchAdNotifyBean<Double>
|
val adNotifyBean = data.mData as WatchAdNotifyBean<Double>
|
||||||
WithdrawManager.instance().addAdEarnForSubBean(0, 0,
|
WithdrawManager.instance().addAdEarnForSubBean(0, 0,
|
||||||
adNotifyBean.earnMoneyNum * VidiConst.WITHDRAW_REWARD_AD_REVENUE_PERCENT)
|
adNotifyBean.earnMoneyNum * VidiConst.WITHDRAW_REWARD_AD_REVENUE_PERCENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_WITHDRAW_RESULT_UPDATED -> {
|
VididinEvents.EVENT_WITHDRAW_RESULT_UPDATED -> {
|
||||||
|
// 提现结果更新
|
||||||
try {
|
try {
|
||||||
val record = data.mData as RecordCash
|
val record = data.mData as RecordCash
|
||||||
if (record.withdrawItemIndex == 0) {
|
if (record.withdrawItemIndex == 0) {
|
||||||
|
// 如果是当前小额提现的结果,显示结果弹窗
|
||||||
showTransactionResultDialog(record)
|
showTransactionResultDialog(record)
|
||||||
}
|
}
|
||||||
updateUICashTotal()
|
updateUICashTotal()
|
||||||
|
|
@ -201,18 +243,22 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_WITHDRAW_ITEM_LIST_CHANGED -> {
|
VididinEvents.EVENT_WITHDRAW_ITEM_LIST_CHANGED -> {
|
||||||
|
// 提现列表整体发生变化
|
||||||
updateItemListUI()
|
updateItemListUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_BANK_INFO_CHANGED -> {
|
VididinEvents.EVENT_BANK_INFO_CHANGED -> {
|
||||||
|
// 银行卡绑定信息变化
|
||||||
withdrawPix2.updateBankAccountInfo()
|
withdrawPix2.updateBankAccountInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_WITHDRAW_SUB_ITEM_PROGRESS_UPDATED -> {
|
VididinEvents.EVENT_WITHDRAW_SUB_ITEM_PROGRESS_UPDATED -> {
|
||||||
|
// 二级提现项进度更新
|
||||||
updateItemListUI()
|
updateItemListUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
VididinEvents.EVENT_WITHDRAW_SMALL_AD_FINISHED -> {
|
VididinEvents.EVENT_WITHDRAW_SMALL_AD_FINISHED -> {
|
||||||
|
// 小额提现相关广告观看完成
|
||||||
handleGotoWithdraw(0)
|
handleGotoWithdraw(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -225,8 +271,10 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
VididinEvents.EVENT_WITHDRAW_SUB_ITEM_PROGRESS_UPDATED,
|
VididinEvents.EVENT_WITHDRAW_SUB_ITEM_PROGRESS_UPDATED,
|
||||||
VididinEvents.EVENT_WITHDRAW_SMALL_AD_FINISHED)
|
VididinEvents.EVENT_WITHDRAW_SMALL_AD_FINISHED)
|
||||||
|
|
||||||
|
// 读取本地提现记录并展示未通知的结果
|
||||||
readTransactionsAndShowResult()
|
readTransactionsAndShowResult()
|
||||||
|
|
||||||
|
// 检查并展示新手引导
|
||||||
if (needShowGuide()) {
|
if (needShowGuide()) {
|
||||||
binding.tvCashTotal.postDelayed({
|
binding.tvCashTotal.postDelayed({
|
||||||
showGuide()
|
showGuide()
|
||||||
|
|
@ -239,22 +287,34 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
//TODO("Not yet implemented")
|
//TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示提现成功弹窗
|
||||||
|
*/
|
||||||
private fun showSuccessDialog(cashNum: Double) {
|
private fun showSuccessDialog(cashNum: Double) {
|
||||||
WithdrawSuccessDialog(this@WithDrawActivity, cashNum).show()
|
WithdrawSuccessDialog(this@WithDrawActivity, cashNum).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示提现失败弹窗
|
||||||
|
*/
|
||||||
private fun showFailDialog(failHintRes: Int) {
|
private fun showFailDialog(failHintRes: Int) {
|
||||||
WithdrawFailDialog(this@WithDrawActivity, failHintRes).show()
|
WithdrawFailDialog(this@WithDrawActivity, failHintRes).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转到提现二级详情页面
|
||||||
|
*/
|
||||||
private fun gotoWithdrawSubActivity(selectedIndex: Int) {
|
private fun gotoWithdrawSubActivity(selectedIndex: Int) {
|
||||||
Router.WithdrawSub.startActivity(this, selectedIndex)
|
Router.WithdrawSub.startActivity(this, selectedIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------ new added -------------------------//
|
// ------------------------ 新增处理逻辑 -------------------------//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取并处理本地提现记录
|
||||||
|
*/
|
||||||
private fun readTransactionsAndShowResult() {
|
private fun readTransactionsAndShowResult() {
|
||||||
val recordList = WithdrawManager.instance().getClonedRecordList()
|
val recordList = WithdrawManager.instance().getClonedRecordList()
|
||||||
recordList.forEach {
|
recordList.forEach {
|
||||||
|
|
@ -262,7 +322,11 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据提现记录状态显示对应的结果弹窗
|
||||||
|
*/
|
||||||
private fun showTransactionResultDialog(record: RecordCash) {
|
private fun showTransactionResultDialog(record: RecordCash) {
|
||||||
|
// 如果未展示过结果弹窗且提现状态不是“进行中”,则展示结果
|
||||||
if (!record.hasShowResultDialog && record.withdrawState != TRANSACTION_STATE_ONGOING) {
|
if (!record.hasShowResultDialog && record.withdrawState != TRANSACTION_STATE_ONGOING) {
|
||||||
WithdrawManager.instance().updateRecordHasNotifyState(record.uuid)
|
WithdrawManager.instance().updateRecordHasNotifyState(record.uuid)
|
||||||
when (record.withdrawState) {
|
when (record.withdrawState) {
|
||||||
|
|
@ -277,10 +341,16 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否需要显示引导
|
||||||
|
*/
|
||||||
private fun needShowGuide(): Boolean {
|
private fun needShowGuide(): Boolean {
|
||||||
return GuideManager.instance().getCurGuideIndex() == VidiConst.GUIDE_INDEX_CASH_GOLD
|
return GuideManager.instance().getCurGuideIndex() == VidiConst.GUIDE_INDEX_CASH_GOLD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存引导状态,标记当前步骤已完成
|
||||||
|
*/
|
||||||
private fun saveGuideState() {
|
private fun saveGuideState() {
|
||||||
GuideManager.instance().setGuideIndex(VidiConst.GUIDE_INDEX_WITHDRAW)
|
GuideManager.instance().setGuideIndex(VidiConst.GUIDE_INDEX_WITHDRAW)
|
||||||
}
|
}
|
||||||
|
|
@ -289,6 +359,9 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行新手引导展示
|
||||||
|
*/
|
||||||
private fun showGuide() {
|
private fun showGuide() {
|
||||||
HighlightPro.with(this@WithDrawActivity)
|
HighlightPro.with(this@WithDrawActivity)
|
||||||
.setHighlightParameter {
|
.setHighlightParameter {
|
||||||
|
|
@ -307,18 +380,23 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
|
||||||
}
|
}
|
||||||
.setOnDismissCallback {
|
.setOnDismissCallback {
|
||||||
|
// 引导消失后保存状态并触发点击 0.1 元提现
|
||||||
saveGuideState()
|
saveGuideState()
|
||||||
handleGotoWithdraw(0)
|
handleGotoWithdraw(0)
|
||||||
}
|
}
|
||||||
.interceptBackPressed(true)
|
.interceptBackPressed(true)
|
||||||
.show()
|
.show()
|
||||||
|
|
||||||
|
// 上报引导埋点
|
||||||
StatisticUtil.reportEvents(StatisticUtil.KEY_Guide, mapOf("Guide" to 3))
|
StatisticUtil.reportEvents(StatisticUtil.KEY_Guide, mapOf("Guide" to 3))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
/**
|
||||||
|
* 启动 WithDrawActivity
|
||||||
|
*/
|
||||||
internal fun startActivity(activity: Activity) {
|
internal fun startActivity(activity: Activity) {
|
||||||
activity.startActivity(Intent(activity.applicationContext, WithDrawActivity::class.java))
|
activity.startActivity(Intent(activity.applicationContext, WithDrawActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,13 +39,13 @@ class ZeroBuyViewModel : ViewModel() {
|
||||||
val curTimeSec = System.currentTimeMillis()/1000
|
val curTimeSec = System.currentTimeMillis()/1000
|
||||||
val signStr = RequestUtil.getZeroBuyRequestSign(curTimeSec, operationVal)
|
val signStr = RequestUtil.getZeroBuyRequestSign(curTimeSec, operationVal)
|
||||||
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
||||||
val requestParams: MutableMap<String, String> = mutableMapOf("AppId" to AndroidUtil.getPackageId(), "DeviceId" to DeviceUtil.generateDeviceId())
|
val requestParams: MutableMap<String, String> = mutableMapOf("app_id" to AndroidUtil.getPackageId(), "device_id" to DeviceUtil.generateDeviceId())
|
||||||
val userId = AccountManager.getAccount()?.userId?: 0
|
val userId = AccountManager.getAccount()?.userId?: 0
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
requestParams.put("UserId", userId.toString())
|
requestParams.put("user_id", userId.toString())
|
||||||
}
|
}
|
||||||
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
||||||
requestParams.put("ActivityId", itemId.toString())
|
requestParams.put("activity_id", itemId.toString())
|
||||||
|
|
||||||
|
|
||||||
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
||||||
|
|
@ -88,10 +88,10 @@ class ZeroBuyViewModel : ViewModel() {
|
||||||
val curTimeSec = System.currentTimeMillis()/1000
|
val curTimeSec = System.currentTimeMillis()/1000
|
||||||
val signStr = RequestUtil.getZeroBuyRequestSign(curTimeSec, operationVal)
|
val signStr = RequestUtil.getZeroBuyRequestSign(curTimeSec, operationVal)
|
||||||
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
||||||
val requestParams: MutableMap<String, String> = mutableMapOf("AppId" to AndroidUtil.getPackageId(), "DeviceId" to DeviceUtil.generateDeviceId())
|
val requestParams: MutableMap<String, String> = mutableMapOf("app_id" to AndroidUtil.getPackageId(), "device_id" to DeviceUtil.generateDeviceId())
|
||||||
val userId = AccountManager.getAccount()?.userId?: 0
|
val userId = AccountManager.getAccount()?.userId?: 0
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
requestParams.put("UserId", userId.toString())
|
requestParams.put("user_id", userId.toString())
|
||||||
}
|
}
|
||||||
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
||||||
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
||||||
|
|
|
||||||
|
|
@ -153,25 +153,25 @@ class ZeroManager private constructor() {
|
||||||
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
||||||
|
|
||||||
// body param
|
// body param
|
||||||
val requestParams: MutableMap<String, String> = mutableMapOf("AppId" to AndroidUtil.getPackageId(), "DeviceId" to DeviceUtil.generateDeviceId())
|
val requestParams: MutableMap<String, String> = mutableMapOf("app_id" to AndroidUtil.getPackageId(), "device_id" to DeviceUtil.generateDeviceId())
|
||||||
val userId = AccountManager.getAccount().userId
|
val userId = AccountManager.getAccount().userId
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
requestParams.put("UserId", userId.toString())
|
requestParams.put("user_id", userId.toString())
|
||||||
}
|
}
|
||||||
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
val joinZeroBuyItemIds = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
||||||
requestParams.put("ActivityId", zeroWithdrawItem.purchase_id.toString())
|
requestParams.put("activity_id", zeroWithdrawItem.purchase_id.toString())
|
||||||
|
|
||||||
// withdraw 相关参数:
|
// withdraw 相关参数:
|
||||||
val bankCPFAccount = AccountManager.getAccount().bankInfo?.bankAccount!!
|
val bankCPFAccount = AccountManager.getAccount().bankInfo?.bankAccount!!
|
||||||
val accountType = "CPF"
|
val accountType = "CPF"
|
||||||
requestParams.put("Account", bankCPFAccount)
|
requestParams.put("account", bankCPFAccount)
|
||||||
requestParams.put("AccountType", accountType)
|
requestParams.put("account_type", accountType)
|
||||||
requestParams.put("Country", Country.BR.name)
|
requestParams.put("country", Country.BR.name)
|
||||||
requestParams.put("DocumentType", accountType)
|
requestParams.put("document_type", accountType)
|
||||||
requestParams.put("DocumentId", bankCPFAccount)
|
requestParams.put("document_id", bankCPFAccount)
|
||||||
requestParams.put("BankCode", AccountManager.getAccount().bankInfo?.bankAccount!!)
|
requestParams.put("bank_code", AccountManager.getAccount().bankInfo?.bankAccount!!)
|
||||||
val signOriginStr = "${zeroWithdrawItem.purchase_id}-${userId}-${bankCPFAccount}-${accountType}-${bankCPFAccount}-${accountType}-${ZEROBUY_SECRET}"
|
val signOriginStr = "${zeroWithdrawItem.purchase_id}-${userId}-${bankCPFAccount}-${accountType}-${bankCPFAccount}-${accountType}-${ZEROBUY_SECRET}"
|
||||||
requestParams.put("Sign", MD5Util.md5(signOriginStr)!!)
|
requestParams.put("sign", MD5Util.md5(signOriginStr)!!)
|
||||||
|
|
||||||
|
|
||||||
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams, joinZeroBuyItemIds)
|
||||||
|
|
@ -215,19 +215,16 @@ class ZeroManager private constructor() {
|
||||||
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
val requestHeaders = mapOf("Operation" to operationVal.toString(), "Timestamp" to curTimeSec.toString(), "Sign" to signStr)
|
||||||
|
|
||||||
// body param
|
// body param
|
||||||
val requestParams: MutableMap<String, String> = mutableMapOf("AppId" to AndroidUtil.getPackageId())
|
val requestParams: MutableMap<String, String> = mutableMapOf("app_id" to AndroidUtil.getPackageId())
|
||||||
val userId = AccountManager.getAccount().userId
|
val userId = AccountManager.getAccount().userId
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
requestParams.put("UserId", userId.toString())
|
requestParams.put("user_id", userId.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
requestParams.put("ActivityId", zeroWithdrawItem.purchase_id.toString())
|
requestParams.put("activity_id", zeroWithdrawItem.purchase_id.toString())
|
||||||
|
|
||||||
// withdraw check result 相关参数:
|
// withdraw check result 相关参数:
|
||||||
requestParams.put("device_id", zeroWithdrawItem.orderId)
|
|
||||||
requestParams.put("order_id", zeroWithdrawItem.orderId)
|
requestParams.put("order_id", zeroWithdrawItem.orderId)
|
||||||
requestParams.put("record_id", zeroWithdrawItem.orderId)
|
|
||||||
requestParams.put("recordId", zeroWithdrawItem.orderId)
|
|
||||||
|
|
||||||
|
|
||||||
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams)
|
val result = NetworkUtil.post("${VidiConst.URL_ZERO_BUY}/any", requestHeaders, requestParams)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue