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