You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
package com.community.pocket.data.main.visitor;
|
|
|
|
import androidx.lifecycle.MutableLiveData;
|
|
|
|
import com.community.pocket.data.model.LocalToken;
|
|
import com.community.pocket.ui.main.ui.visitor.appointment.VisitorPeopleResponse;
|
|
import com.community.pocket.ui.main.ui.visitor.appointment.VisitorResponse;
|
|
import com.community.pocket.util.HttpRequest;
|
|
import com.community.pocket.util.HttpUtil;
|
|
import com.community.pocket.util.SimpleHttpParse;
|
|
|
|
import okhttp3.FormBody;
|
|
|
|
/**
|
|
* 访客接口
|
|
*/
|
|
public class VisitorRequest {
|
|
|
|
private static volatile VisitorRequest instance;
|
|
|
|
private VisitorRequest() {
|
|
}
|
|
|
|
public static VisitorRequest getInstance() {
|
|
if (instance == null) {
|
|
instance = new VisitorRequest();
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
//访客预约
|
|
@HttpRequest("/visitor/visitor")
|
|
public void appointment(MutableLiveData<VisitorResponse> liveData, String appointment, String chooseDate, String chooseTime, String notes, boolean checked) {
|
|
HttpUtil.getRequest(HttpUtil.Method.POST,
|
|
new SimpleHttpParse<VisitorResponse>(liveData).getInterface(VisitorResponse.class),
|
|
new FormBody.Builder()
|
|
.add("appointment", appointment)
|
|
.add("chooseDate", chooseDate)
|
|
.add("chooseTime", chooseTime)
|
|
.add("notes", notes)
|
|
.add("isOutPeople", String.valueOf(checked))
|
|
.add("token", LocalToken.getToken())
|
|
.add("username", LocalToken.getUsername())
|
|
.build());
|
|
}
|
|
|
|
//获取预约人
|
|
@HttpRequest("/visitor/people")
|
|
public void searchPeople(MutableLiveData<VisitorPeopleResponse> liveData, String name, Boolean isOutPeople) {
|
|
HttpUtil.getRequest(HttpUtil.Method.GET,
|
|
new SimpleHttpParse<VisitorPeopleResponse>(liveData).getInterface(VisitorPeopleResponse.class),
|
|
new FormBody.Builder()
|
|
.add("name", name)
|
|
.add("outPeople", String.valueOf(isOutPeople))
|
|
.add("username", LocalToken.getUsername())
|
|
.build());
|
|
}
|
|
|
|
|
|
}
|
|
|