Skip to content

Commit

Permalink
动态环境
Browse files Browse the repository at this point in the history
  • Loading branch information
dingliufan committed Apr 23, 2020
1 parent 010fd34 commit d268677
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 47 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/mebooth/text/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class Application extends AppApplication {
@Override
public void onCreate() {
super.onCreate();
this.setDebug(true);
//传递用户信息
UserTokenJson userTokenJson = new UserTokenJson();
//冬shan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public UserTokenJson getUserTokenJson() {
private boolean isShowBack;

private TextMessage rongMsg;

public boolean isShowBack() {
return isShowBack;
}
Expand All @@ -86,11 +87,11 @@ public void setUserTokenJson(UserTokenJson userTokenJson) {
intent.putExtra("index", "refreshList");
sendBroadcast(intent);

try{
if(RongIM.getInstance().getRongIMClient().getCurrentConnectionStatus() == RongIMClient.ConnectionStatusListener.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT){
try {
if (RongIM.getInstance().getRongIMClient().getCurrentConnectionStatus() == RongIMClient.ConnectionStatusListener.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT) {
RongIM.getInstance().logout();
}
}catch (Exception e){
} catch (Exception e) {

}

Expand Down Expand Up @@ -164,16 +165,38 @@ public void setLogOut(boolean isLogOut) {
sendBroadcast(intent);

SharedPreferencesUtils.writeString("token", "");
try{
if(RongIM.getInstance().getRongIMClient().getCurrentConnectionStatus() != RongIMClient.ConnectionStatusListener.ConnectionStatus.DISCONNECTED){
try {
if (RongIM.getInstance().getRongIMClient().getCurrentConnectionStatus() != RongIMClient.ConnectionStatusListener.ConnectionStatus.DISCONNECTED) {
RongIM.getInstance().logout();
}
}catch (Exception e){
} catch (Exception e) {

}

}
}

public boolean isDebug;

public boolean isDebug() {
return isDebug;
}

public void setDebug(boolean debug) {
isDebug = debug;
}

public static String baseUrl() {

if (AppApplication.getInstance().isDebug()) {

return "http://test-tataclub.baojiawangluo.com/";

}
return "http://tataclub.baojiawangluo.com/";

}

@Override
public void onCreate() {
super.onCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

public interface YService {
//测试
String BASE_URL = "http://test-tataclub.baojiawangluo.com/";
// public static String BASE_URL = "";
// String BASE_URL = "http://test-tataclub.baojiawangluo.com/";
public static String BASE_URL = AppApplication.baseUrl();
//外网s
// String BASE_URL = "http://test.tatabike.com/";
// String BASE_URL = "http://tataclub.baojiawangluo.com/";
Expand All @@ -50,200 +50,200 @@ public interface YService {

//推荐列表
@FormUrlEncoded
@POST(BASE_URL + "topic/getFeeds")
@POST("topic/getFeeds")
Observable<GetRecommendJson> getRecommend(@Field("name") String name, @Field("offset") String offset, @Field("num") int num);

// Observable<GetRecommendJson> getRecommend(@Field("name") String name);
//此刻列表
@FormUrlEncoded
@POST(BASE_URL + "topic/getLatest")
@POST("topic/getLatest")
Observable<GetNowJson> getNow(@Field("platform") String platform, @Field("offset") String offset, @Field("num") int num);

// Observable<GetNowJson> getNow();
//此刻列表详情
@FormUrlEncoded
@POST(BASE_URL + "topic/getTopicInfo")
@POST("topic/getTopicInfo")
Observable<GetNowDetailsJson> getNow(@Field("tid") int tid);

//发布帖子
@FormUrlEncoded
@POST(BASE_URL + "topic/add")
@POST("topic/add")
Observable<PublicBean> getAddTopic(@Field("content") String content, @Field("location") String location, @Field("images") String images);

//新闻详情
@FormUrlEncoded
@POST(BASE_URL + "topic/getNewsInfo")
@POST("topic/getNewsInfo")
Observable<GetNewInfoJson> getNewInfo(@Field("newsid") int newsid);

//是否关注
@FormUrlEncoded
@POST(BASE_URL + "follow/isFollowed")
@POST("follow/isFollowed")
Observable<GetIsFollowJson> getIsFollow(@Field("fids") int fids);

//是否收藏
@FormUrlEncoded
@POST(BASE_URL + "praise/isPraised")
@POST("praise/isPraised")
Observable<GetIsCollectJson> getIsCollect(@Field("tid") int tid);

//评论列表
@FormUrlEncoded
@POST(BASE_URL + "reply/getReplies")
@POST("reply/getReplies")
Observable<CommentOnJson> getCommentInfo(@Field("tid") int tid, @Field("type") int type, @Field("direct") int direct);

//回复评论
@FormUrlEncoded
@POST(BASE_URL + "reply/add")
@POST("reply/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> requestComment(@Field("tid") int tid, @Field("pid") int pid, @Field("content") String content, @Field("type") int type);

//上传图片
@Multipart
@POST(BASE_URL + "image/upload")
@POST("image/upload")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<UpdateHeaderFileJson> updateRepairFile(@Part MultipartBody.Part file);

//发布帖子
@FormUrlEncoded
@POST(BASE_URL + "topic/add")
@POST("topic/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> publishTopic(@Field("content") String content, @Field("location") String location, @Field("images") String images, @Field("platform") String platform);

//发布新闻
@FormUrlEncoded
@POST(BASE_URL + "news/add")
@POST("news/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> publishNews(@Field("title") String title, @Field("cover") String cover, @Field("content") String content, @Field("location") String location);

//关注
@FormUrlEncoded
@POST(BASE_URL + "follow/add")
@POST("follow/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> addFollow(@Field("uid") int uid);

//取消关注
@FormUrlEncoded
@POST(BASE_URL + "follow/cancel")
@POST("follow/cancel")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> cancelFollow(@Field("uid") int uid);

//点赞
@FormUrlEncoded
@POST(BASE_URL + "praise/add")
@POST("praise/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> addPraises(@Field("tid") int tid, @Field("type") int type);

//取消点赞
@FormUrlEncoded
@POST(BASE_URL + "praise/cancel")
@POST("praise/cancel")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> cancelPraises(@Field("tid") int tid, @Field("type") int type);

//收藏
@FormUrlEncoded
@POST(BASE_URL + "favorite/add")
@POST("favorite/add")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> addFavorite(@Field("relateid") int newsid);

//取消收藏
@FormUrlEncoded
@POST(BASE_URL + "favorite/cancel")
@POST("favorite/cancel")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> cancelFavorite(@Field("relateid") int newsid);

//获取用户个人信息
// @FormUrlEncoded
@POST(BASE_URL + "user/getMyUserInfo")
@POST("user/getMyUserInfo")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetMyUserInfo> userInfo();

//修改头像
@FormUrlEncoded
@POST(BASE_URL + "user/setAvatar")
@POST("user/setAvatar")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> udateHeaderIcon(@Field("avatar") String avatar);

//修改昵称
@FormUrlEncoded
@POST(BASE_URL + "user/setNickname")
@POST("user/setNickname")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> udateNickName(@Field("nickname") String nickname);

//我发布的帖子
@FormUrlEncoded
@POST(BASE_URL + "topic/getUserTopicList")
@POST("topic/getUserTopicList")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetNowJson> userPublishList(@Field("uid") int uid, @Field("offset") String offset, @Field("num") int num);

//我收藏的帖子
@FormUrlEncoded
@POST(BASE_URL + "favorite/getFavoriteList")
@POST("favorite/getFavoriteList")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetMeCollectJson> userPraiseList(@Field("offset") String offset, @Field("num") int num);

//删除我发布的帖子
@FormUrlEncoded
@POST(BASE_URL + "topic/delete")
@POST("topic/delete")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> deleteTopic(@Field("tid") int tid);

//我关注的人
@FormUrlEncoded
@POST(BASE_URL + "follow/getFollowings")
@POST("follow/getFollowings")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetCareJson> getCareList(@Field("offset") String offset, @Field("num") int num);
//我的粉丝
@FormUrlEncoded
@POST(BASE_URL + "follow/getFollowers")
@POST("follow/getFollowers")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetCareJson> getFansList(@Field("offset") String offset, @Field("num") int num);

//用户关注的人
@FormUrlEncoded
@POST(BASE_URL + "follow/getUserFollowings")
@POST("follow/getUserFollowings")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<GetCareJson> getUserCareList(@Field("uid") int uid);


//获取融云token
@POST(BASE_URL + "message/getToken")
@POST("message/getToken")
Observable<GetRongIMTokenJson> getRongTokenInfo();

//获取分享信息
@FormUrlEncoded
@POST(BASE_URL + "share/getShareInfo")
@POST("share/getShareInfo")
Observable<GetShareInfoJson> getShareInfo(@Field("scene") String scene, @Field("relateid") int relateid, @Field("type") String type);

//获取我的界面数量信息
@FormUrlEncoded
@POST(BASE_URL + "user/getUserInfo")
@POST("user/getUserInfo")
Observable<GetMineCountJson> getMineCountInfo(@Field("uid") int uid);

//获取我的界面数量信息
@FormUrlEncoded
@POST(BASE_URL + "user/getUserInfos")
@POST("user/getUserInfos")
Observable<GetIMUserInfoJson> getIMUserInfo(@Field("uids") String uids);

//获取banner页面
@FormUrlEncoded
@POST(BASE_URL + "config/getConfig")
@POST("config/getConfig")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<FlushJson> bannerList(@Field("name") String name);

//获取专题页面
@FormUrlEncoded
@POST(BASE_URL + "config/getConfig")
@POST("config/getConfig")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<EntranceJson> entranceList(@Field("name") String name);

//获取我发布的新闻列表
@FormUrlEncoded
@POST(BASE_URL + "news/getUserNewsList")
@POST("news/getUserNewsList")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<UserNewsListJson> userNewsList(@Field("uid") int uid, @Field("offset") String offset, @Field("num") int num);

//删除我发布的单个新闻
@FormUrlEncoded
@POST(BASE_URL + "news/delete")
@POST("news/delete")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> deleteNews(@Field("newsid") int newsid);

Expand All @@ -255,25 +255,25 @@ public interface YService {

//获取附近地点
@FormUrlEncoded
@POST(BASE_URL + "config/getPlaces")
@POST("config/getPlaces")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PlacesInfoJson> placesInfo(@Field("lng") String lng, @Field("lat") String lat);

//获取省份
// @FormUrlEncoded
@POST(BASE_URL + "config/getProvinces")
@POST("config/getProvinces")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<ProvincesListJson> ProvincesListInfo();

//获取省份所管辖的市
@FormUrlEncoded
@POST(BASE_URL + "config/getCitys")
@POST("config/getCitys")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<CityListJson> CityListInfo(@Field("province") String province);

//保存个人信息
@FormUrlEncoded
@POST(BASE_URL + "user/setUserInfo")
@POST("user/setUserInfo")
// Observable<UpdateHeaderFileJson> updateRepairFile(@PartMap Map<String, RequestBody> params);
Observable<PublicBean> setUserInfo(@Field("avatar") String avatar,@Field("nickname") String nickname,@Field("gender") String gender,@Field("city") String city,@Field("signature") String signature);
}

0 comments on commit d268677

Please sign in to comment.