Commit ee99bd53 by konghaorui

升级组件版本号

parent 0b17daf5
......@@ -25,9 +25,12 @@ public final class DemoGlobalConfig implements IConfigModule {
@Override
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)
.addUrl("github", APP_DOMAIN)
.setEnv(YDLConstants.ENV_PROD)
.setEnv(env)
.setDebug(BuildConfig.DEBUG);
}
}
......@@ -39,6 +39,10 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
}
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;
mView.setData(cateTitle)
}
......
......@@ -64,7 +64,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.28",
"ydl-platform" : "0.0.28.1",
//第二步 若干
"ydl-webview" : "0.0.28",
......
......@@ -219,29 +219,37 @@ class HttpConfig {
private fun requestHead(appFrom: String): Interceptor {
return Interceptor {
val request = it.request()
val body = request.body()
val paramsString = StringBuilder()
val params = ArrayList<Param>()
if (body is FormBody) {
(0 until body.size()).mapTo(destination = params) {
Param(
body.name(it),
body.value(it)
)
}
if ("POST"==request.method()){
val body = request.body()
if (body is FormBody) {
(0 until body.size()).mapTo(destination = params) {
Param(
body.name(it),
body.value(it)
)
}
} else if (body is MultipartBody) {
for (part in body.parts()) {
if ("text/plain; charset=utf-8" == part.body().contentType()!!.toString()) {
val headerStr = part.headers()!!.toString()
val name =
headerStr.split("\"\\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].split("=\"".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val buffer = Buffer()
part.body().writeTo(buffer as BufferedSink)
val value = buffer.readUtf8()
params.add(Param(name, value))
} else if (body is MultipartBody) {
for (part in body.parts()) {
if ("text/plain; charset=utf-8" == part.body().contentType()!!.toString()) {
val headerStr = part.headers()!!.toString()
val name =
headerStr.split("\"\\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].split("=\"".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
val buffer = Buffer()
part.body().writeTo(buffer as BufferedSink)
val value = buffer.readUtf8()
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 ->
......@@ -286,9 +294,8 @@ class HttpConfig {
}
private fun getOldAuth(paramsString: StringBuilder): String {
paramsString.append(SESSION_KEY)
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