Commit e4f090c2 authored by 张释方's avatar 张释方

提交代码

parent be03d715
......@@ -23,7 +23,7 @@ interface MainApi {
* @return
*/
@POST("api/sendMobileCode")
fun sendMobileCode(@Body vo: @JvmSuppressWildcards Map<String, Any>): Observable<Response<BaseResponse<Any>>>
fun sendMobileCode(@Body vo: Map<String, String>): Observable<Response<BaseResponse<Any>>>
/**
* 登录
......
......@@ -12,7 +12,8 @@ import java.io.Serializable;
*/
public class BaseResponse<T> implements Serializable {
private int status;
private String message;
private String message="";
// @JsonAdapter(value = JsonAdapterGsonDeserializer.class)
@SerializedName("data")
......@@ -27,6 +28,11 @@ public class BaseResponse<T> implements Serializable {
this.result = result;
}
public BaseResponse(int status) {
this.status = status;
}
public int getstatus() {
return status;
}
......
......@@ -32,15 +32,15 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
* @param mobile
*/
fun sendMobileCode(mobile: String) {
val vo = HashMap<String, Any>()
val vo = HashMap<String, String>()
vo["mobile"] = mobile
vo["type"] = 1
// vo["type"] = 1
ApiModel.sendMobileCode(lifecycleProvider,vo).safeSubscribe(
ApiModel.sendMobileCode(lifecycleProvider,vo).subscribe(
object : HttpSubscribeImpl<BaseResponse<Any>>(
this@LoginViewModel, true) {
override fun onBusinessSuccess(response: BaseResponse<Any>) {
KLog.e("sendMobileCode", response.result.toString())
// KLog.e("sendMobileCode", response.result.toString())
}
override fun onError(e: Throwable) {
data.value = "失败"
......
......@@ -16,7 +16,7 @@ object ApiModel {
/**
* 发送验证码
*/
fun sendMobileCode(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, Any>): Observable<Response<BaseResponse<Any>>> {
fun sendMobileCode(lifecycleProvider: LifecycleProvider<Any>?, map: Map<String, String>): Observable<Response<BaseResponse<Any>>> {
return HttpManager.getInstance()
.execute(lifecycleProvider, MainApi.newInstance().sendMobileCode(map))
}
......
......@@ -6,7 +6,7 @@ package me.goldze.mvvmhabit.http;
public class ResponseThrowable extends Exception {
public int code;
public String message;
public String message = "";
public ResponseThrowable(Throwable throwable, int code) {
super(throwable);
......
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