Commit 294b669f by 徐健
parents e16c56dc 9b0a306e
......@@ -43,13 +43,13 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.28",
"m-consultant" : "0.0.39",
"m-course" : "0.0.25",
"m-fm" : "0.0.20",
"m-muse" : "0.0.14",
"m-tests" : "0.0.11",
"m-user" : "0.0.33",
"m-confide" : "0.0.29",
"m-consultant" : "0.0.40",
"m-course" : "0.0.26",
"m-fm" : "0.0.21",
"m-muse" : "0.0.15",
"m-tests" : "0.0.12",
"m-user" : "0.0.34",
//-------------- 业务模块 API 层 --------------
......@@ -64,13 +64,13 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.26",
"ydl-platform" : "0.0.27",
//第二步 若干
"ydl-webview" : "0.0.27",
"ydl-media" : "0.0.13",
"ydl-pay" : "0.0.10",
"m-audioim" : "0.0.28",
"ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11",
"m-audioim" : "0.0.29",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -101,13 +101,13 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.26",
"ydl-platform" : "0.0.27",
//第二步 若干
"ydl-webview" : "0.0.27",
"ydl-media" : "0.0.13",
"ydl-pay" : "0.0.10",
"m-audioim" : "0.0.28",
"ydl-webview" : "0.0.28",
"ydl-media" : "0.0.14",
"ydl-pay" : "0.0.11",
"m-audioim" : "0.0.29",
//以下 几乎不会动
......
......@@ -208,7 +208,7 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
//私聊文案
if (TextUtils.isEmpty(itemBean.chatBtnText)){
holder.tvChat.text = "私聊"
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.white))
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.consultant_confirm_text_color))
holder.tvChat.background = ContextCompat.getDrawable(context,R.drawable.consultant_expert_search_chat)
}else{
holder.tvChat.text = itemBean.chatBtnText
......
......@@ -18,12 +18,7 @@ import okhttp3.OkHttpClient
import okio.Buffer
import okio.BufferedSink
import java.util.*
import kotlin.collections.ArrayList
/**
......@@ -95,34 +90,25 @@ class HttpConfig {
//如果是POST请求,则再在Body中增加公共参数
if ("POST"==request.method()){
var body = request.body()
if (body is FormBody) {
val paramsName = mutableSetOf<String>()
val bodyBuild = FormBody.Builder()
for (i in 0 until body.size()) {
val name = body.name(i)
paramsName.add(name)
val value = body.value(i)
// 去除假参数和值为空的参数
if (YDLConstants.HOLDER_PARAM != name && !TextUtils.isEmpty(value)) {
bodyBuild.addEncoded(name, value)
}
}
bodyBuild.addEncoded(FFROM, PlatformDataManager.getRam().getChannelName())
.addEncoded(IS_FROM_APP, "1")
.addEncoded(
OS_BUILD,
"""${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${RxAppTool.getAppVersionName(
BaseApp.getApp()
)}"""
)
.addEncoded(TS, (System.currentTimeMillis() / 1000).toString())
.addEncoded(
VERSION, RxAppTool.getAppVersionName(
BaseApp.getApp()
)
)
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
if (loginBean != null) {
bodyBuild.addEncoded(UID, loginBean.userId)
bodyBuild.addEncoded(TOKEN, loginBean.token)
val paramsValue = getCommonParams(paramsName)
paramsValue.forEach { entry->
bodyBuild.addEncoded(entry.key,entry.value)
}
body = bodyBuild.build()
......@@ -132,34 +118,11 @@ class HttpConfig {
val url = request.url()
val newBuilder = url.newBuilder()
// for (i in 0 until url.querySize()) {
// //取出url中?后的参数
// val key = url.queryParameterName(i)
// val value = url.queryParameterValue(i)
// newBuilder.
// addQueryParameter(key, value)
// }
newBuilder.
addQueryParameter(FFROM, PlatformDataManager.getRam().getChannelName())
.addQueryParameter(IS_FROM_APP, "1")
.addQueryParameter(
OS_BUILD,
"""${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${RxAppTool.getAppVersionName(
BaseApp.getApp()
)}"""
)
.addQueryParameter(TS, (System.currentTimeMillis() / 1000).toString())
.addQueryParameter(
VERSION, RxAppTool.getAppVersionName(
BaseApp.getApp()
)
)
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
if (loginBean != null) {
newBuilder.addQueryParameter(UID, loginBean.userId)
.addQueryParameter(TOKEN, loginBean.token)
val paramsName = url.queryParameterNames()
val paramsValue = getCommonParams(paramsName)
paramsValue.forEach { entry->
newBuilder.
addQueryParameter(entry.key,entry.value)
}
it.proceed(request.newBuilder().url(newBuilder.build()).build())
......@@ -170,6 +133,43 @@ class HttpConfig {
}
}
/**
* 获取公共参数
* 在原有请求中没有该参数的情况下才添加
*/
private fun getCommonParams(paramsName: MutableSet<String>): HashMap<String, String> {
val paramsValue = hashMapOf<String, String>()
if (!paramsName.contains(FFROM)) {
paramsValue[FFROM] = PlatformDataManager.getRam().getChannelName()
}
if (!paramsName.contains(IS_FROM_APP)) {
paramsValue[IS_FROM_APP] = "1"
}
if (!paramsName.contains(OS_BUILD)) {
paramsValue[OS_BUILD] =
"""${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()},${RxAppTool.getAppVersionName(
BaseApp.getApp()
)}"""
}
if (!paramsName.contains(TS)) {
paramsValue[TS] = (System.currentTimeMillis() / 1000).toString()
}
if (!paramsName.contains(VERSION)) {
paramsValue[VERSION] = RxAppTool.getAppVersionName(
BaseApp.getApp()
)
}
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
if (loginBean != null && !paramsName.contains(UID)) {
paramsValue[UID] = loginBean.userId
}
if (loginBean != null && !paramsName.contains(TOKEN)) {
paramsValue[TOKEN] = loginBean.token
}
return paramsValue
}
private data class Param(val name: String, val value: String)
......
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