初始化
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.request;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.news.NewsActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.news.NewsFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.OkDate;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.OkHttpUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.RequestUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Request;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/7/31 17:34
|
||||
* @description:消息模块的请求
|
||||
*/
|
||||
public class NewsRequest {
|
||||
|
||||
String token;
|
||||
private Gson gson=new Gson();
|
||||
public String getToken(Context con) {
|
||||
return SPUtil.getSP(con, LoginActivity.USER,LoginActivity.USER_TOKEN);
|
||||
}
|
||||
public void getXiaoXiLists(Context con, Handler hd){
|
||||
token= SPUtil.getSP(con, LoginActivity.USER,LoginActivity.USER_TOKEN);
|
||||
String mt="";
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getXiaoXiListUrl(), mt),token,con);
|
||||
RequestUtil.start(1, NewsFragment.XIAOXILIST,re,con,hd);
|
||||
}
|
||||
public void getXiaoXiList(Context con, Handler hd,int type,int page){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("cate",type);
|
||||
map.put("content","");
|
||||
map.put("createTimeEnd","");
|
||||
map.put("createTimeStart","");
|
||||
map.put("createUserName","");
|
||||
map.put("limit",10);
|
||||
map.put("messageTypes","");
|
||||
map.put("page",page);
|
||||
map.put("receiverId",0);
|
||||
map.put("receiverName","");
|
||||
map.put("roleId",0);
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getXiaoxiAll(), MapUtil.mapJson(map)),getToken(con),con);
|
||||
RequestUtil.start(1, NewsActivity.XIAOXILIST_TYPE,re,con,hd);
|
||||
}
|
||||
|
||||
public void DelNews(Context con, Handler hd,int id){
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("id",id);
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getXiaoxiDel(),MapUtil.mapJson(map)),getToken(con),con);
|
||||
RequestUtil.start(1, NewsActivity.NEWS_DEL,re,con,hd);
|
||||
}
|
||||
|
||||
public void delNewsAll(Context con, Handler hd,Model m){
|
||||
m.setId(0);
|
||||
token= SPUtil.getSP(con, LoginActivity.USER,LoginActivity.USER_TOKEN);
|
||||
Log.e("-xm-",gson.toJson(m));
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getXiaoxiDelAll(),gson.toJson(m)),getToken(con),con);
|
||||
RequestUtil.start(1, NewsActivity.NEWS_DEL,re,con,hd);
|
||||
///app/message/setReadAll
|
||||
}
|
||||
|
||||
public static class Model{
|
||||
|
||||
private int id;
|
||||
private List<Integer> ids;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<?> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<Integer> ids) {
|
||||
this.ids = ids;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user