Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
23099a89
Commit
23099a89
authored
Dec 18, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页数据缓存设置位5秒后缓存,放置数据存取错乱
parent
40cea21d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
45 deletions
+59
-45
HomeConsultBean.kt
m-home/src/main/java/com/yidianling/home/model/bean/HomeConsultBean.kt
+20
-15
HomePagerDataBean.kt
m-home/src/main/java/com/yidianling/home/model/bean/HomePagerDataBean.kt
+14
-14
HomePresenterImpl.kt
m-home/src/xlzx/java/com/yidianling/home/presenter/HomePresenterImpl.kt
+22
-13
HomeConsultItemView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultItemView.kt
+3
-3
No files found.
m-home/src/main/java/com/yidianling/home/model/bean/HomeConsultBean.kt
View file @
23099a89
...
...
@@ -58,25 +58,30 @@ class HomeConsultBean: HomeItemBaseBean {
*/
//字段名称改了
var
uid
:
Int
=
0
var
doctorUid
:
Int
=
0
var
doctorId
:
String
=
""
var
doctorName
:
String
?
=
null
var
doctorHead
:
String
?
=
null
var
profesBack
:
String
?
=
null
var
name
:
String
=
""
var
doctorName
:
String
=
""
var
head
:
String
=
""
var
doctorHead
:
String
=
""
var
profesBack
:
String
=
""
var
minBookingPrice
:
Int
=
0
var
serviceFee
:
Int
=
0
var
zixunOrderNum
:
Int
=
0
var
feedbackRate
:
Float
=
0f
var
province
:
String
?
=
null
var
city
:
String
?
=
null
var
province
:
String
=
""
var
city
:
String
=
""
var
isOnline
:
Int
=
0
var
mUrl
:
String
?
=
null
var
hUrl
:
String
?
=
null
var
mUrl
:
String
=
""
var
linkUrl
:
String
=
""
var
hUrl
:
String
=
""
var
share
:
ShareBean
?
=
null
var
isHiddenXcx
:
String
?
=
null
var
tags
:
String
?
=
null
var
isHiddenXcx
:
String
=
""
var
tags
:
String
=
""
//私聊文案
var
chatBtnText
:
String
?
=
null
var
chatBtnText
:
String
=
""
class
ShareBean
{
/**
...
...
@@ -87,11 +92,11 @@ class HomeConsultBean: HomeItemBaseBean {
* share_url : https://m.ydl.com/experts/1614
*/
var
title
:
String
?
=
null
var
cover
:
String
?
=
null
var
desc
:
String
?
=
null
var
shareUrl
:
String
?
=
null
var
share_url
:
String
?
=
null
var
title
:
String
=
""
var
cover
:
String
=
""
var
desc
:
String
=
""
var
shareUrl
:
String
=
""
var
share_url
:
String
=
""
}
}
}
m-home/src/main/java/com/yidianling/home/model/bean/HomePagerDataBean.kt
View file @
23099a89
...
...
@@ -10,24 +10,24 @@ class HomePagerDataBean() {
this
.
type
=
type
;
}
constructor
(
h
omeH
eaderBean
:
HomeHeaderBean
,
homeC
onsultBean
:
HomeConsultBean
,
homeC
onfideBean
:
HomeConfideBean
,
homeC
ourseBean
:
HomeCourseBean
,
constructor
(
headerBean
:
HomeHeaderBean
,
c
onsultBean
:
HomeConsultBean
,
c
onfideBean
:
HomeConfideBean
,
c
ourseBean
:
HomeCourseBean
,
testListBean
:
MutableList
<
HomeTestItemBean
>?,
homeA
skBean
:
HomeAskBean
,
a
skBean
:
HomeAskBean
,
museBean
:
MuseModuleBean
,
homeFM
Bean
:
HomeFMBean
,
homeA
rticleBean
:
HomeArticleBean
):
this
(){
this
.
headerBean
=
h
omeH
eaderBean
this
.
consultBean
=
homeC
onsultBean
this
.
articleBean
=
homeA
rticleBean
this
.
askBean
=
homeA
skBean
this
.
courseBean
=
homeC
ourseBean
fm
Bean
:
HomeFMBean
,
a
rticleBean
:
HomeArticleBean
):
this
(){
this
.
headerBean
=
headerBean
this
.
consultBean
=
c
onsultBean
this
.
articleBean
=
a
rticleBean
this
.
askBean
=
a
skBean
this
.
courseBean
=
c
ourseBean
this
.
testListBean
=
testListBean
this
.
museBean
=
museBean
this
.
fmBean
=
homeFM
Bean
this
.
confideBean
=
homeC
onfideBean
this
.
fmBean
=
fm
Bean
this
.
confideBean
=
c
onfideBean
}
/**
* 咨询模块数据
...
...
m-home/src/xlzx/java/com/yidianling/home/presenter/HomePresenterImpl.kt
View file @
23099a89
...
...
@@ -27,6 +27,7 @@ import io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.concurrent.TimeUnit
/**
...
...
@@ -55,17 +56,17 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
.
setHotSearch
(
it
)
}
}
//BUTTON_BANNER_VIEW的数据与PAGER_BANNER_VIEW一致,不需要再次设置
// YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW -> {
// homeBean.headerBean = dataBean.headerBean
// }
YdlHomeViewHolderConstract
.
CONSULT_VIEW
->
{
YdlHomeViewHolderConstract
.
BUTTON_BANNER_VIEW
->
{
homeBean
.
headerBean
=
dataBean
.
headerBean
dataBean
.
headerBean
?.
keywordData
?.
let
{
ModularServiceManager
.
provide
(
IConsultantService
::
class
.
java
)
.
setHotSearch
(
it
)
}
}
YdlHomeViewHolderConstract
.
CONSULT_VIEW
->
{
homeBean
.
consultBean
=
dataBean
.
consultBean
}
YdlHomeViewHolderConstract
.
CONFIDE_VIEW
->
{
homeBean
.
headerBean
=
dataBean
.
headerBean
homeBean
.
confideBean
=
dataBean
.
confideBean
}
YdlHomeViewHolderConstract
.
COURSE_VIEW
->
{
...
...
@@ -244,13 +245,21 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
},
Action
{
homeList
.
sortWith
(
compareBy
{
it
.
type
})
//更新本地缓存数据,这边顶部数据保存了两份,一个10001,一个10002,防止第二次进来读取的时候homeDataResponse回调中的remove(0)把10002删除
SharedPreferencesEditor
.
putString
(
CACHE_HOME_PAGER_DATA
,
Gson
().
toJson
(
homeList
))
Observable
.
interval
(
5000
,
TimeUnit
.
SECONDS
)
.
compose
(
RxUtils
.
applySchedulers
(
mView
))
.
subscribe
{
SharedPreferencesEditor
.
putString
(
CACHE_HOME_PAGER_DATA
,
Gson
().
toJson
(
homeList
))
SharedPreferencesEditor
.
putString
(
IS_NEW_CACHE_HOME_PAGER_DATA
,
true
.
toString
())
SharedPreferencesEditor
.
putString
(
HOME_PAGER_DATA_CACHE_VERISON
,
RxAppTool
.
getAppVersionCode
(
BaseApp
.
getApp
()).
toString
()
)
}
mView
.
homeDataResponse
(
homeList
)
SharedPreferencesEditor
.
putString
(
IS_NEW_CACHE_HOME_PAGER_DATA
,
true
.
toString
())
SharedPreferencesEditor
.
putString
(
HOME_PAGER_DATA_CACHE_VERISON
,
RxAppTool
.
getAppVersionCode
(
BaseApp
.
getApp
()).
toString
()
)
HomeLogPrinter
.
printLongLog
(
HomePresenterImpl
::
class
.
java
.
simpleName
,
Gson
().
toJson
(
homeList
)
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultItemView.kt
View file @
23099a89
...
...
@@ -49,7 +49,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//设置头像
setHead
(
bean
)
//设置名称
tv_consult_name
.
text
=
bean
.
doctorN
ame
tv_consult_name
.
text
=
bean
.
n
ame
//咨询师标签
tag_view
.
initData
(
StringUtils
.
strToList
(
bean
.
tags
))
//设置向TA倾诉人数
...
...
@@ -70,7 +70,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
* 设置头像
*/
private
fun
setHead
(
bean
:
HomeConsultBean
.
ListBean
)
{
YDLImageCacheManager
.
showImage
(
mContext
,
bean
?.
doctorH
ead
,
img_consult_head
)
YDLImageCacheManager
.
showImage
(
mContext
,
bean
?.
h
ead
,
img_consult_head
)
}
/**
...
...
@@ -139,7 +139,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
}
private
fun
setPrice
(
bodyBean
:
HomeConsultBean
.
ListBean
)
{
val
confideFee
=
bodyBean
.
serviceFe
e
val
confideFee
=
bodyBean
.
minBookingPric
e
tv_consult_price
.
text
=
"¥$confideFee"
}
}
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