Commit ee99bd53 by konghaorui

升级组件版本号

parent 0b17daf5
...@@ -25,9 +25,12 @@ public final class DemoGlobalConfig implements IConfigModule { ...@@ -25,9 +25,12 @@ public final class DemoGlobalConfig implements IConfigModule {
@Override @Override
public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) { public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) {
String env = YDLConstants.ENV_AUTO_TEST;
// String env = YDLConstants.ENV_PROD;
builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX) builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX)
.addUrl("github", APP_DOMAIN) .addUrl("github", APP_DOMAIN)
.setEnv(YDLConstants.ENV_PROD) .setEnv(env)
.setDebug(BuildConfig.DEBUG); .setDebug(BuildConfig.DEBUG);
} }
} }
...@@ -39,6 +39,10 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(), ...@@ -39,6 +39,10 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
} }
override fun onSuccess(users: JsonObject) { override fun onSuccess(users: JsonObject) {
if (users.getAsJsonObject("data")==null){
mView.setData("")
return
}
var cateTitle = users.getAsJsonObject("data").getAsJsonArray("askCategoryData").get(0).asJsonObject.get("cateTitle").asString; var cateTitle = users.getAsJsonObject("data").getAsJsonArray("askCategoryData").get(0).asJsonObject.get("cateTitle").asString;
mView.setData(cateTitle) mView.setData(cateTitle)
} }
......
...@@ -64,7 +64,7 @@ ext { ...@@ -64,7 +64,7 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.28", "ydl-platform" : "0.0.28.1",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.28", "ydl-webview" : "0.0.28",
......
...@@ -219,29 +219,37 @@ class HttpConfig { ...@@ -219,29 +219,37 @@ class HttpConfig {
private fun requestHead(appFrom: String): Interceptor { private fun requestHead(appFrom: String): Interceptor {
return Interceptor { return Interceptor {
val request = it.request() val request = it.request()
val body = request.body()
val paramsString = StringBuilder() val paramsString = StringBuilder()
val params = ArrayList<Param>() val params = ArrayList<Param>()
if (body is FormBody) { if ("POST"==request.method()){
(0 until body.size()).mapTo(destination = params) { val body = request.body()
Param( if (body is FormBody) {
body.name(it), (0 until body.size()).mapTo(destination = params) {
body.value(it) Param(
) body.name(it),
} body.value(it)
)
}
} else if (body is MultipartBody) { } else if (body is MultipartBody) {
for (part in body.parts()) { for (part in body.parts()) {
if ("text/plain; charset=utf-8" == part.body().contentType()!!.toString()) { if ("text/plain; charset=utf-8" == part.body().contentType()!!.toString()) {
val headerStr = part.headers()!!.toString() val headerStr = part.headers()!!.toString()
val name = val name =
headerStr.split("\"\\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].split("=\"".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1] headerStr.split("\"\\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].split("=\"".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val buffer = Buffer() val buffer = Buffer()
part.body().writeTo(buffer as BufferedSink) part.body().writeTo(buffer as BufferedSink)
val value = buffer.readUtf8() val value = buffer.readUtf8()
params.add(Param(name, value)) params.add(Param(name, value))
}
} }
} }
} else if ("GET"==request.method()){
val url = request.url()
val queryParameterNames = url.queryParameterNames()
queryParameterNames.forEach { string ->
params.add(Param(string, url.queryParameter(string)?:""))
}
} }
params.sortWith(Comparator { o1, o2 -> params.sortWith(Comparator { o1, o2 ->
...@@ -286,9 +294,8 @@ class HttpConfig { ...@@ -286,9 +294,8 @@ class HttpConfig {
} }
private fun getOldAuth(paramsString: StringBuilder): String { private fun getOldAuth(paramsString: StringBuilder): String {
paramsString.append(SESSION_KEY)
return "$YDL ${EncryptUtils.encryptMD5ToString( return "$YDL ${EncryptUtils.encryptMD5ToString(
paramsString.toString() paramsString.toString()+ SESSION_KEY
)}" )}"
} }
......
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