Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
fcad0507
Commit
fcad0507
authored
Oct 13, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
93dca57a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
9 deletions
+97
-9
DrawCashPresenter.kt
...com/duben/miniplaylet/mvp/presenters/DrawCashPresenter.kt
+40
-0
DrawCashFragment.kt
...om/duben/miniplaylet/ui/fragment/draw/DrawCashFragment.kt
+57
-9
No files found.
video/app/src/main/java/com/duben/miniplaylet/mvp/presenters/DrawCashPresenter.kt
View file @
fcad0507
...
...
@@ -6,9 +6,49 @@ import com.duben.miniplaylet.mvp.model.DrawInfoBean
import
com.duben.miniplaylet.mvp.views.DrawCashView
import
com.duben.library.net.neterror.BaseSubscriber
import
com.duben.library.net.neterror.Throwable
import
com.duben.miniplaylet.manager.UserManager
import
com.duben.miniplaylet.mvp.model.UserBean
import
java.util.HashMap
class
DrawCashPresenter
:
BasePresenter
<
DrawCashView
>()
{
/**
* 微信登录
*/
fun
wxLogin
(
wxInfo
:
String
)
{
view
.
showLoading
(
"加载中..."
)
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"wxInfo"
]
=
wxInfo
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
wechatlogin
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
UserBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
view
.
hideLoading
()
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
showToast
(
e
.
message
)
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
UserBean
>)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
val
data
=
baseResponse
.
data
when
(
code
)
{
200
->
if
(
data
!=
null
)
{
UserManager
.
getInstance
().
saveUserInfo
(
data
)
view
.
showToast
(
"微信授权成功"
)
}
else
->
view
.
showToast
(
message
)
}
}
})
}
fun
cashPageCoin
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
cashPageCoin
(),
...
...
video/app/src/main/java/com/duben/miniplaylet/ui/fragment/draw/DrawCashFragment.kt
View file @
fcad0507
...
...
@@ -8,6 +8,9 @@ import android.view.View
import
android.widget.RadioGroup
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.GridLayoutManager
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.duben.library.utils.json.JsonUtil
import
com.duben.miniplaylet.R
import
com.duben.miniplaylet.ad.AdManager
import
com.duben.miniplaylet.ad.AdStatusListener
...
...
@@ -26,12 +29,17 @@ import com.duben.miniplaylet.utils.ConsumerToastUtil
import
com.duben.miniplaylet.utils.SpanUtils
import
com.duben.miniplaylet.utils.ToastUtil
import
com.duben.library.utils.nodoubleclick.AntiShake
import
com.duben.miniplaylet.login.LoginApi
import
com.duben.miniplaylet.login.OnLoginListener
import
com.duben.miniplaylet.manager.UserManager
import
com.duben.miniplaylet.mvp.model.WXInfo
import
kotlinx.android.synthetic.main.fragment_draw.*
/**
* 提现
*/
class
DrawCashFragment
:
LazyLoadBaseFragment
(),
DrawCashView
,
DrawCashAdapter
.
OnClickListener
,
class
DrawCashFragment
:
LazyLoadBaseFragment
(),
OnLoginListener
,
DrawCashView
,
DrawCashAdapter
.
OnClickListener
,
View
.
OnClickListener
{
companion
object
{
...
...
@@ -52,7 +60,9 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
}
private
val
drawCashPresenter
by
lazy
{
DrawCashPresenter
()
}
private
val
loginApi
by
lazy
{
LoginApi
()
}
private
var
wxInfo
:
WXInfo
?
=
null
private
var
drawType
=
DRAW_TYPE_CASH
private
var
mDrawCashAdapter
:
DrawCashAdapter
?
=
null
private
var
redPkgBean
:
DrawInfoBean
?
=
null
...
...
@@ -93,6 +103,7 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
}
override
fun
onFragmentResume
()
{
if
(
drawType
==
DRAW_TYPE_CASH
)
{
// 红包
drawCashPresenter
.
cashPageCoin
()
...
...
@@ -191,7 +202,21 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
1
->
{
//1、支付渠道
if
(
TextUtils
.
equals
(
payChannel
,
WEIXIN_PAY
))
{
// showToast("微信支付维护中")
// 微信授权
// if (TextUtils.isEmpty(UserManager.getInstance().wxOpenid)) {
// val wechat = ShareSDK.getPlatform(Wechat.NAME)
// if (!wechat.isClientValid) {
// showToast("请先安装微信")
// return
// }
//
// showToast("微信拉起授权")
// loginApi.setOnLoginListener(this)
// loginApi.setPlatform(Wechat.NAME)
// loginApi.login(requireActivity())
// }
return
}
...
...
@@ -222,7 +247,7 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
showToast
(
"发起提现成功"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
(
requireActivity
()
as
MainActivity
).
dismissDrawDialog
()
},
800
)
...
...
@@ -319,21 +344,21 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
Constant
.
CARRIERTYPE_ONLY_SHOW
->
{
TrackManager
.
getInstance
().
addCashoutReq
(
currentDrawInfo
?.
unitId
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
showToast
(
"发起提现成功"
)
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
(
requireActivity
()
as
MainActivity
).
dismissDrawDialog
()
},
800
)
},
1000
)
}
Constant
.
CARRIERTYPE_REWARD_COIN
->
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
ConsumerToastUtil
.
showAwardText
(
requireContext
(),
AppConfig
.
awardRedpkg
,
0
)
},
800
)
...
...
@@ -343,10 +368,10 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
}
Constant
.
CARRIERTYPE_REWARD_DI
->
{
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
Handler
(
Looper
.
getMainLooper
()).
postDelayed
({
if
(!
isAdded
)
return
@postDelayed
if
(!
isAdded
)
return
@postDelayed
ConsumerToastUtil
.
showAwardText
(
requireContext
(),
0
,
AppConfig
.
awardYuanbao
)
},
800
)
...
...
@@ -355,4 +380,27 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
}
}
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>):
Boolean
{
try
{
wxInfo
=
WXInfo
()
wxInfo
?.
let
{
it
.
unionid
=
res
[
"unionid"
].
toString
()
+
""
it
.
openid
=
res
[
"openid"
].
toString
()
+
""
it
.
province
=
res
[
"province"
].
toString
()
+
""
it
.
city
=
res
[
"city"
].
toString
()
+
""
it
.
country
=
res
[
"country"
].
toString
()
+
""
it
.
headimgurl
=
res
[
"headimgurl"
].
toString
()
+
""
it
.
nickname
=
res
[
"nickname"
].
toString
()
+
""
it
.
sex
=
(
res
[
"sex"
].
toString
()
+
""
).
toInt
()
}
if
(
isAdded
)
{
drawCashPresenter
.
wxLogin
(
JsonUtil
.
toJson
(
wxInfo
))
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
false
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment