From 00de2169b9ceb397b0617d1e16e7f0f31166aba0 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Fri, 29 Jul 2022 16:04:12 +0800 Subject: [PATCH] 11111 --- common/build.gradle | 9 +- .../main/java/com/yunbao/common/http/API.java | 52 +++++ .../yunbao/common/http/CommonHttpUtil.java | 39 ---- .../com/yunbao/common/http/HttpCallback.java | 4 + .../com/yunbao/common/http/HttpClient.java | 49 ++++- .../com/yunbao/common/http/PDLiveApi.java | 33 +++ .../yunbao/common/http/PDLiveInterceptor.java | 41 ++++ .../com/yunbao/common/http/ResponseData.java | 39 ++++ .../com/yunbao/common/http/ResponseModel.java | 49 +++++ .../com/yunbao/common/http/base/BaseApi.java | 93 +++++++++ .../common/http/base/CommonInterceptor.java | 35 ++++ .../yunbao/common/http/main/HttpCallback.java | 20 ++ .../common/http/main/MainNetManager.java | 64 ++++++ .../yunbao/common/manager/IMLoginManager.java | 4 +- .../manager/InstructorRemarkManager.java | 4 +- .../manager/NoviceInstructorManager.java | 2 +- .../res/layout/view_message_long_click.xml | 1 + config.gradle | 4 +- .../live/activity/LiveAnchorActivity.java | 2 - .../live/activity/LiveAudienceActivity.java | 1 - .../live/activity/LiveRyAnchorActivity.java | 2 - .../live/activity/PDLIiveChatActivity.java | 3 - .../yunbao/live/dialog/MenuPopuwWindow.java | 17 +- .../java/com/yunbao/live/http/ImHttpUtil.java | 12 -- .../com/yunbao/live/http/LiveHttpUtil.java | 193 ++---------------- .../com/yunbao/live/socket/SocketClient.java | 1 - .../live/socket/SocketLinkMicPkUtil.java | 2 - .../yunbao/live/socket/SocketRyClient.java | 1 - .../live/views/LiveAudienceViewHolder.java | 2 +- .../live/views/LivePlayRyViewHolder.java | 1 - .../live/views/LivePushRyViewHolder.java | 1 - .../live/views/LivePushTxViewHolder.java | 2 - .../live/views/LiveRyAnchorViewHolder.java | 2 - .../yunbao/main/activity/EntryActivity.java | 4 +- .../yunbao/main/activity/LoginActivity.java | 4 +- .../yunbao/main/dialog/OneLoginDialog.java | 4 - .../com/yunbao/main/http/MainHttpUtil.java | 78 +------ .../yunbao/main/views/HonorViewHolder.java | 3 +- .../com/yunbao/video/http/VideoHttpUtil.java | 39 +--- 39 files changed, 531 insertions(+), 385 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/http/API.java create mode 100644 common/src/main/java/com/yunbao/common/http/PDLiveApi.java create mode 100644 common/src/main/java/com/yunbao/common/http/PDLiveInterceptor.java create mode 100644 common/src/main/java/com/yunbao/common/http/ResponseData.java create mode 100644 common/src/main/java/com/yunbao/common/http/ResponseModel.java create mode 100644 common/src/main/java/com/yunbao/common/http/base/BaseApi.java create mode 100644 common/src/main/java/com/yunbao/common/http/base/CommonInterceptor.java create mode 100644 common/src/main/java/com/yunbao/common/http/main/HttpCallback.java create mode 100644 common/src/main/java/com/yunbao/common/http/main/MainNetManager.java diff --git a/common/build.gradle b/common/build.gradle index d7c4cca51..f993ab723 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -167,5 +167,12 @@ dependencies { api 'com.adjust.sdk:adjust-android:4.30.1' api 'com.android.installreferrer:installreferrer:2.2' api 'com.google.firebase:firebase-analytics:15.0.0' - + //Retrofit2库 + api 'com.squareup.retrofit2:retrofit:2.3.0' + api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' + //gson解析 + api 'com.squareup.retrofit2:converter-gson:2.3.0' + //rxjava2库 + api 'io.reactivex.rxjava2:rxjava:2.0.1' + api 'io.reactivex.rxjava2:rxandroid:2.0.1' } diff --git a/common/src/main/java/com/yunbao/common/http/API.java b/common/src/main/java/com/yunbao/common/http/API.java new file mode 100644 index 000000000..0b602d9bf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/API.java @@ -0,0 +1,52 @@ +package com.yunbao.common.http; + +import android.content.Context; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.internal.bind.DateTypeAdapter; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.http.base.BaseApi; + +import java.util.Date; + +import okhttp3.OkHttpClient; +import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; + +/** + * pdLive接口 + */ +public class API extends BaseApi { + private PDLiveApi pdLiveApi; + + private static API api; + + + /** + * 获取单利 + * + * @return + */ + public static API get() { + if (null == api) { + api = new API(); + } + return api; + } + + public PDLiveApi pdLiveApi(Context context) { + if (null == pdLiveApi) { + //实例化gson + Gson gson = new GsonBuilder() + .registerTypeAdapter(Date.class, new DateTypeAdapter()) + .create(); + OkHttpClient.Builder builder = new OkHttpClient() + .newBuilder() + .addInterceptor(new PDLiveInterceptor(context)); + pdLiveApi = create(builder.build(), + GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class); + } + return pdLiveApi; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index d1ef42584..b93ba123d 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -162,8 +162,6 @@ public class CommonHttpUtil { Log.i("来了", lang); //或者仅仅使用 locale = Locale.getDefault(); 不需要考虑接口 deprecated(弃用)问题 HttpClient.getInstance().get("Home.getConfig", CommonHttpConsts.GET_CONFIG) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("langue", lang) .execute(new HttpCallback() { @Override @@ -228,32 +226,6 @@ public class CommonHttpUtil { setAttention(CommonHttpConsts.SET_ATTENTION, touid, callback); } -// /** -// * 关注别人 或 取消对别人的关注的接口 -// */ -// public static void setAttention(String tag, final String touid, final CommonCallback callback) { -// if (touid.equals(CommonAppConfig.getInstance().getUid())) { -// ToastUtil.show(WordUtil.getString(R.string.cannot_follow_self)); -// return; -// } -// HttpClient.getInstance().get("User.setAttent", tag) -// .params("uid", CommonAppConfig.getInstance().getUid()) -// .params("token", CommonAppConfig.getInstance().getToken()) -// .params("touid", touid) -// .execute(new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// if (code == 0 && info.length > 0) { -// int isAttention = JSON.parseObject(info[0]).getIntValue("isattent");//1是 关注 0是未关注 -// EventBus.getDefault().post(new FollowEvent(touid, isAttention)); -// if (callback != null) { -// callback.callback(isAttention); -// } -// } -// } -// }); -// } - /** * 关注别人 或 取消对别人的关注的接口 */ @@ -263,8 +235,6 @@ public class CommonHttpUtil { return; } HttpClient.getInstance().get("User.setAttents", tag) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .execute(new HttpCallback() { @Override @@ -291,8 +261,6 @@ public class CommonHttpUtil { isGoogle = "-1"; } HttpClient.getInstance().get("User.getBalance", CommonHttpConsts.GET_BALANCE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("type", 0) .params("isGooglePay", isGoogle) .execute(callback); @@ -349,8 +317,6 @@ public class CommonHttpUtil { */ public static void checkTokenInvalid() { HttpClient.getInstance().get("User.ifToken", CommonHttpConsts.CHECK_TOKEN_INVALID) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(NO_CALLBACK); } @@ -391,8 +357,6 @@ public class CommonHttpUtil { if ("2".equals(community_type)) { request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT) .isMultipart(true) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("dynamic_id", dynamic_id) .params("report_type", report_type) .params("content", content) @@ -401,8 +365,6 @@ public class CommonHttpUtil { } else { request = HttpClient.getInstance().post(CommonHttpConsts.COMMUNITY_SETREPORT, CommonHttpConsts.COMMUNITY_SETREPORT) .isMultipart(true) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("dynamic_id", dynamic_id) .params("report_type", report_type) .params("content", content) @@ -425,7 +387,6 @@ public class CommonHttpUtil { */ public static void getUserBaseinfo(String touid, HttpCallback callback) { HttpClient.getInstance().get("User.getUserBaseinfo", CommonHttpConsts.GET_USER_BASEINFO) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .execute(callback); } diff --git a/common/src/main/java/com/yunbao/common/http/HttpCallback.java b/common/src/main/java/com/yunbao/common/http/HttpCallback.java index 3f33c8ff0..11637be1a 100644 --- a/common/src/main/java/com/yunbao/common/http/HttpCallback.java +++ b/common/src/main/java/com/yunbao/common/http/HttpCallback.java @@ -1,8 +1,10 @@ package com.yunbao.common.http; import android.app.Dialog; +import android.util.Log; import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; import com.lzy.okgo.callback.AbsCallback; import com.lzy.okgo.model.Response; import com.lzy.okgo.request.base.Request; @@ -33,6 +35,8 @@ public abstract class HttpCallback extends AbsCallback { @Override public void onSuccess(Response response) { JsonBean bean = response.body(); + String gson = new Gson().toJson(bean); + Log.e("onSuccess",gson); if (bean != null) { if (200 == bean.getRet()) { Data data = bean.getData(); diff --git a/common/src/main/java/com/yunbao/common/http/HttpClient.java b/common/src/main/java/com/yunbao/common/http/HttpClient.java index fecc3895a..1b2218350 100644 --- a/common/src/main/java/com/yunbao/common/http/HttpClient.java +++ b/common/src/main/java/com/yunbao/common/http/HttpClient.java @@ -1,5 +1,7 @@ package com.yunbao.common.http; +import android.content.Context; + import com.lzy.okgo.OkGo; import com.lzy.okgo.cache.CacheMode; import com.lzy.okgo.cookie.CookieJarImpl; @@ -8,7 +10,11 @@ import com.lzy.okgo.request.GetRequest; import com.lzy.okgo.request.PostRequest; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.manager.IMLoginManager; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; @@ -47,17 +53,12 @@ public class HttpClient { builder.writeTimeout(TIMEOUT, TimeUnit.MILLISECONDS); builder.cookieJar(new CookieJarImpl(new MemoryCookieStore())); builder.retryOnConnectionFailure(true); -// Dispatcher dispatcher = new Dispatcher(); -// dispatcher.setMaxRequests(20000); -// dispatcher.setMaxRequestsPerHost(10000); -// builder.dispatcher(dispatcher); - //输出HTTP请求 响应信息 HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("http"); loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY); builder.addInterceptor(loggingInterceptor); + //添加PDLive请求常用信息 mOkHttpClient = builder.build(); - OkGo.getInstance().init(CommonAppContext.sInstance) .setOkHttpClient(mOkHttpClient) .setCacheMode(CacheMode.NO_CACHE) @@ -66,23 +67,51 @@ public class HttpClient { } public GetRequest get(String serviceName, String tag) { + Context context = CommonAppContext.sInstance.getApplicationContext(); + //拼装基本信息 + Map map = new HashMap<>(); + if (IMLoginManager.isLogin(context)) { + IMLoginModel model = IMLoginManager.get(context).getUserInfo(); + map.put("uid", String.valueOf(model.getId())); + map.put("token", model.getToken()); + } return OkGo.get(mUrl + serviceName) - .headers("Connection","keep-alive") + .params(map, true) + .headers("Connection", "keep-alive") .tag(tag) .params(CommonHttpConsts.LANGUAGE, mLanguage); } - public GetRequest get(String url,String serviceName, String tag) { + public GetRequest get(String url, String serviceName, String tag) { + + Context context = CommonAppContext.sInstance.getApplicationContext(); + //拼装基本信息 + Map map = new HashMap<>(); + if (IMLoginManager.isLogin(context)) { + IMLoginModel model = IMLoginManager.get(context).getUserInfo(); + map.put("uid", String.valueOf(model.getId())); + map.put("token", model.getToken()); + } return OkGo.get(url + serviceName) - .headers("Connection","keep-alive") + .headers("Connection", "keep-alive") + .params(map, true) .tag(tag) .params(CommonHttpConsts.LANGUAGE, mLanguage); } public PostRequest post(String serviceName, String tag) { + Context context = CommonAppContext.sInstance.getApplicationContext(); + //拼装基本信息 + Map map = new HashMap<>(); + if (IMLoginManager.isLogin(context)) { + IMLoginModel model = IMLoginManager.get(context).getUserInfo(); + map.put("uid", String.valueOf(model.getId())); + map.put("token", model.getToken()); + } return OkGo.post(mUrl + serviceName) - .headers("Connection","keep-alive") + .headers("Connection", "keep-alive") + .params(map, true) .tag(tag) .params(CommonHttpConsts.LANGUAGE, mLanguage); } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java new file mode 100644 index 000000000..16984b744 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -0,0 +1,33 @@ +package com.yunbao.common.http; + +import com.yunbao.common.bean.IMLoginModel; + +import io.reactivex.Observable; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.POST; + +/** + * PDLive网络接口访问 + */ +public interface PDLiveApi { + /** + * 用户手机号登录 + * + * @param userName + * @param passWord + * @param uuidDevice + * @param pushid + * @param lastlogindevice + * @return + */ + @FormUrlEncoded + @POST("/api/public/?service=Login.userLogin") + Observable> loginByManager( + @Field("user_login") String userName, + @Field("user_pass") String passWord, + @Field("uuid_Device") String uuidDevice, + @Field("pushid") String pushid, + @Field("lastlogindevice") String lastlogindevice + ); +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveInterceptor.java b/common/src/main/java/com/yunbao/common/http/PDLiveInterceptor.java new file mode 100644 index 000000000..487830a79 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/PDLiveInterceptor.java @@ -0,0 +1,41 @@ +package com.yunbao.common.http; + +import android.content.Context; +import android.util.Log; + +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.manager.IMLoginManager; + +import java.io.IOException; + +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * PDlLive通用拦截器 + */ +public class PDLiveInterceptor implements Interceptor { + private Context context; + + PDLiveInterceptor(Context context) { + this.context = context; + } + + @Override + public Response intercept(Chain chain) throws IOException { + //拼接请求,添加头 + Request request = chain.request(); + Request.Builder builder = request.newBuilder(); + Log.e("TAG", "Request: " + request.toString()); + //已登录则添加全局参数 + if (IMLoginManager.isLogin(context)) { + IMLoginModel model = IMLoginManager.get(context).getUserInfo(); + builder.addHeader("userid", String.valueOf(model.getId())); + builder.addHeader("token", model.getToken()); + } + Response response = chain.proceed(builder.build()); + Log.e("TAG", "Request: " + response.toString()); + return response; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/ResponseData.java b/common/src/main/java/com/yunbao/common/http/ResponseData.java new file mode 100644 index 000000000..eed765701 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/ResponseData.java @@ -0,0 +1,39 @@ +package com.yunbao.common.http; + +import com.google.gson.annotations.SerializedName; + +public class ResponseData { + @SerializedName("code") + private int code; + @SerializedName("msg") + private String msg; + @SerializedName("info") + private T info; + + public int getCode() { + return code; + } + + public ResponseData setCode(int code) { + this.code = code; + return this; + } + + public String getMsg() { + return msg; + } + + public ResponseData setMsg(String msg) { + this.msg = msg; + return this; + } + + public T getInfo() { + return info; + } + + public ResponseData setInfo(T info) { + this.info = info; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/ResponseModel.java b/common/src/main/java/com/yunbao/common/http/ResponseModel.java new file mode 100644 index 000000000..3008ebf5f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/ResponseModel.java @@ -0,0 +1,49 @@ +package com.yunbao.common.http; + +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; + +/** + * 响应体基础结构(使用info字符串数组数据) + */ +public class ResponseModel { + /** + * ret : 200 + * data : {"code":0,"msg":"登录成功","info":{"id":139372,"user_nicename":"新手指导员05","avatar":"https://napi.yaoulive.com/default.jpg","avatar_thumb":"https://napi.yaoulive.com/default_thumb.jpg","sex":1,"signature":"这家伙很懒,什么都没留下","coin":0,"gold":470,"goldsumption":0,"consumption":7200,"votestotal":0,"province":"","city":"","birthday":"","user_status":1,"issuper":0,"location":"","noble_id":0,"goodnum":"","is_guess":null,"langue":"chinese","goodnum_expire_time":null,"avatar2":null,"front_task":1,"level":"5","level_anchor":"1","vip":{"type":"0"},"liang":{"name":"0"},"medal_level":"0","medal_name":"","token":"790b4a59b46e22e68e04ba76c505dbc3","first_login":"0","token_rong":"Qx7tt7henwUJC3NXkwaOsnQeHkqz/DDlzFfBg3prJ6c=@xln2.sg.rongnav.com;xln2.sg.rongcfg.com"}} + * msg : + */ + + @SerializedName("ret") + private int ret; + @SerializedName("data") + private ResponseData data; + @SerializedName("msg") + private String msg; + + public int getRet() { + return ret; + } + + public ResponseModel setRet(int ret) { + this.ret = ret; + return this; + } + + public ResponseData getData() { + return data; + } + + public ResponseModel setData(ResponseData data) { + this.data = data; + return this; + } + + public String getMsg() { + return msg; + } + + public ResponseModel setMsg(String msg) { + this.msg = msg; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/base/BaseApi.java b/common/src/main/java/com/yunbao/common/http/base/BaseApi.java new file mode 100644 index 000000000..2d6ab8e50 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/base/BaseApi.java @@ -0,0 +1,93 @@ +package com.yunbao.common.http.base; + +import java.util.HashMap; +import java.util.Map; + +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import retrofit2.CallAdapter; +import retrofit2.Converter; +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; + + +/** + * 网络请求基类 + */ +public class BaseApi { + /** + * 创建一个接口方法 + * + * @param okHttpClient okhttp客户端 + * @param converterFactory 处理工厂类 + * @param callAdapterFactory 请求适配器工厂 + * @param baseUrl 基础地质 + * @param service 接口 + * @param 接口泛型 + * @return 接口 + */ + public T create(OkHttpClient okHttpClient, Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, String baseUrl, Class service) { + Retrofit.Builder builder = new Retrofit.Builder() + //基础url + .baseUrl(baseUrl) + //客户端OKHttp + .client(okHttpClient); + //添加转换工厂 + if (null != converterFactory) { + builder.addConverterFactory(converterFactory); + } + //添加请求工厂 + if (null != callAdapterFactory) { + builder.addCallAdapterFactory(callAdapterFactory); + } + //创建retrofit对象 + Retrofit retrofit = builder.build(); + + //返回创建的api + return retrofit.create(service); + } + + public T createApi(Interceptor interceptor, Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, String baseUrl, Class service) { + OkHttpClient.Builder builder = new OkHttpClient().newBuilder(); + if (null != interceptor) { + builder.addInterceptor(interceptor); + } + return create(builder.build(), converterFactory, callAdapterFactory, baseUrl, service); + } + + public T createApi(Map headerMap, Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, String baseUrl, Class service) { + return createApi(new CommonInterceptor(headerMap), converterFactory, callAdapterFactory, baseUrl, service); + } + + public T createApi(Converter.Factory converterFactory, CallAdapter.Factory callAdapterFactory, String baseUrl, Class service) { + return createApi(new HashMap<>(), converterFactory, callAdapterFactory, baseUrl, service); + } + + public T createApi(CallAdapter.Factory callAdapterFactory, String baseUrl, Class service) { + return createApi(null, callAdapterFactory, baseUrl, service); + } + + public T createApi(String baseUrl, Class service) { + return createApi(null, baseUrl, service); + } + + public T createRxApi(Interceptor interceptor, Converter.Factory converterFactory, String baseUrl, Class service) { + OkHttpClient.Builder builder = new OkHttpClient().newBuilder(); + if (null != interceptor) { + builder.addInterceptor(interceptor); + } + return create(builder.build(), converterFactory, RxJava2CallAdapterFactory.create(), baseUrl, service); + } + + public T createRxApi(Map headerMap, Converter.Factory converterFactory, String baseUrl, Class service) { + return createRxApi(new CommonInterceptor(headerMap), converterFactory, baseUrl, service); + } + + public T createRxApi(Converter.Factory converterFactory, String baseUrl, Class service) { + return createRxApi(new HashMap<>(), converterFactory, baseUrl, service); + } + + public T createRxApi(String baseUrl, Class service) { + return createRxApi(null, baseUrl, service); + } +} diff --git a/common/src/main/java/com/yunbao/common/http/base/CommonInterceptor.java b/common/src/main/java/com/yunbao/common/http/base/CommonInterceptor.java new file mode 100644 index 000000000..987009d43 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/base/CommonInterceptor.java @@ -0,0 +1,35 @@ +package com.yunbao.common.http.base; + +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; + +import okhttp3.Interceptor; +import okhttp3.Request; + +/** + * 通用性拦截器 + */ +public class CommonInterceptor implements Interceptor { + private Map headerMap; + + public CommonInterceptor(Map headerMap) { + this.headerMap = headerMap; + } + + @Override + public okhttp3.Response intercept(Chain chain) throws IOException { + //拼接请求,添加头 + Request.Builder builder = chain.request() + .newBuilder(); + if (null != headerMap) { + Iterator iterator = headerMap.keySet().iterator(); + while (iterator.hasNext()) { + String key = iterator.next(); + String value = headerMap.get(key); + builder.addHeader(key, value); + } + } + return chain.proceed(builder.build()); + } +} diff --git a/common/src/main/java/com/yunbao/common/http/main/HttpCallback.java b/common/src/main/java/com/yunbao/common/http/main/HttpCallback.java new file mode 100644 index 000000000..26171f1cf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/main/HttpCallback.java @@ -0,0 +1,20 @@ +package com.yunbao.common.http.main; + +/** + * maim的请求回调接口 + */ +public interface HttpCallback { + /** + * 请求成功 + * + * @param data + */ + void onSuccess(T data); + + /** + * 请求失败 + * + * @param error + */ + void onError(String error); +} diff --git a/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java new file mode 100644 index 000000000..8105366e2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java @@ -0,0 +1,64 @@ +package com.yunbao.common.http.main; + +import android.app.Activity; + +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.http.API; +import com.yunbao.common.http.ResponseModel; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.functions.Consumer; +import io.reactivex.schedulers.Schedulers; + +/** + * main库的网络请求管理 + */ +public class MainNetManager { + private Activity mContext; + private static MainNetManager manager; + + public MainNetManager(Activity context) { + this.mContext = context; + } + + /** + * 获取单利 + * + * @return + */ + public static MainNetManager get(Activity context) { + if (null == manager) { + manager = new MainNetManager(context); + } + return manager; + } + + /** + * 手机号登录 + * + * @param phoneNum 手机号码 + * @param pwd 密码 + * @param uuid 设备码 + * @param callback 网络请求回调 + */ + public void login(String phoneNum, String pwd, String uuid, HttpCallback callback) { + API.get().pdLiveApi(mContext).loginByManager(phoneNum, pwd, uuid, "", "Android") + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel imLoginModelResponseModel) throws Exception { + if (callback != null) { + IMLoginModel model = imLoginModelResponseModel.getData().getInfo(); + callback.onSuccess(model); + } + } + }, throwable -> { + if (callback != null) { + callback.onError(throwable.getMessage()); + } + }).isDisposed(); + } + + +} diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 2d56ba11b..b0bf88e46 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -125,8 +125,8 @@ public class IMLoginManager extends BaseCacheManager { @Override public void run() { HttpClient.getInstance().get("User.isInstructor", "isInstructor") - .params("uid", userInfo.getId()) - .params("token", userInfo.getToken()) + .params("uid", userInfo.getId(),true) + .params("token", userInfo.getToken(),true) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/common/src/main/java/com/yunbao/common/manager/InstructorRemarkManager.java b/common/src/main/java/com/yunbao/common/manager/InstructorRemarkManager.java index ad995b8d3..4f725edf8 100644 --- a/common/src/main/java/com/yunbao/common/manager/InstructorRemarkManager.java +++ b/common/src/main/java/com/yunbao/common/manager/InstructorRemarkManager.java @@ -103,8 +103,8 @@ public class InstructorRemarkManager extends BaseCacheManager { public void run() { IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); HttpClient.getInstance().get("User.getInstructorRemark", "getInstructorRemark") - .params("uid", userInfo.getId()) - .params("token", userInfo.getToken()) + .params("uid", userInfo.getId(),true) + .params("token", userInfo.getToken(),true) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java index 8d969dc4d..d844e1626 100644 --- a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java @@ -112,7 +112,7 @@ public class NoviceInstructorManager extends BaseCacheManager { if (TextUtils.equals(userModel.getIsAdmin(), "1")) { IMLoginModel userInfo = IMLoginManager.get(context).getUserInfo(); HttpClient.getInstance().get("Message.setZdyMsg", "setZdyMsg") - .params("uid", userInfo.getId()) + .params("uid", userInfo.getId(),true) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/common/src/main/res/layout/view_message_long_click.xml b/common/src/main/res/layout/view_message_long_click.xml index 7b2caea00..63b130b66 100644 --- a/common/src/main/res/layout/view_message_long_click.xml +++ b/common/src/main/res/layout/view_message_long_click.xml @@ -59,6 +59,7 @@ android:id="@+id/quote_linear" android:layout_width="0dp" android:layout_weight="1" + android:visibility="gone" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" diff --git a/config.gradle b/config.gradle index 1cced9059..d190f2cce 100644 --- a/config.gradle +++ b/config.gradle @@ -9,9 +9,9 @@ ext { ] manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index 4c776fdf7..a3460b510 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -306,9 +306,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic sendSystemMessage(WordUtil.getString(R.string.live_anchor_come_back)); } HttpClient.getInstance().get("Live.isLeave", "Live.isLeave") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("isleave", leave) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(new Callback() { @Override public void onStart(Request request) { diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 2c1511aff..da0cb470c 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -920,7 +920,6 @@ public class LiveAudienceActivity extends LiveActivity { //退出多人房间 HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") .params("roomid", LiveActivity.mLiveUid) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index 8c3dba5a2..07c7aa105 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -247,7 +247,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl case Constants.LIVE_FUNC_DR://多人PK if(isDRPK != 1) { HttpClient.getInstance().get("live.getdrnum", "live.getdrnum") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -261,7 +260,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onConfirmClick(Dialog dialog, String content) { HttpClient.getInstance().get("live.createDRPKroom", "live.createDRPKroom") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", "1") .params("sign", "1") .execute(new HttpCallback() { diff --git a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java index ef55e0036..047fcd66f 100644 --- a/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/PDLIiveChatActivity.java @@ -1,6 +1,5 @@ package com.yunbao.live.activity; -import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.view.Gravity; @@ -20,7 +19,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; -import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.manager.IMLoginManager; @@ -59,7 +57,6 @@ public class PDLIiveChatActivity extends FragmentActivity { } - public void windowColor() { Window window = getWindow(); diff --git a/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java b/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java index 13f9da443..e8a4c64bb 100644 --- a/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java +++ b/live/src/main/java/com/yunbao/live/dialog/MenuPopuwWindow.java @@ -2,6 +2,7 @@ package com.yunbao.live.dialog; import android.app.Activity; import android.content.Intent; +import android.os.Handler; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -11,11 +12,12 @@ import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; -import com.yunbao.common.Constants; +import com.yunbao.common.http.HttpClient; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.activity.EditNameRemarksActivity; + import io.rong.imlib.RongIMClient; /** @@ -28,6 +30,7 @@ public class MenuPopuwWindow implements View.OnClickListener { private TextView tvBlack, tvBlackMove; private LinearLayout ltRemarks; private PopupWindow popupWindow; + private Handler netHandler = new Handler(); public MenuPopuwWindow(Activity context) { this.mContext = context; @@ -110,6 +113,7 @@ public class MenuPopuwWindow implements View.OnClickListener { popupWindow.dismiss(); tvBlack.setVisibility(View.VISIBLE); tvBlackMove.setVisibility(View.GONE); + netHandler.post(setBlackRunnable); } @Override @@ -126,6 +130,7 @@ public class MenuPopuwWindow implements View.OnClickListener { popupWindow.dismiss(); tvBlackMove.setVisibility(View.VISIBLE); tvBlack.setVisibility(View.GONE); + netHandler.post(setBlackRunnable); } @Override @@ -141,4 +146,14 @@ public class MenuPopuwWindow implements View.OnClickListener { popupWindow.dismiss(); } } + + //将对方拉黑或者解除拉黑(自己后台) + private Runnable setBlackRunnable = new Runnable() { + @Override + public void run() { + HttpClient.getInstance().get("User.setBlack", "setBlack") + .params("touid", userId); + } + }; + } diff --git a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java index 23ba62ff0..6fc4e6746 100644 --- a/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/ImHttpUtil.java @@ -22,8 +22,6 @@ public class ImHttpUtil { */ public static void getImUserInfo(String uids, HttpCallback callback) { HttpClient.getInstance().get("Message.getLists", ImHttpConsts.GET_IM_USER_INFO) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -32,8 +30,6 @@ public class ImHttpUtil { */ public static void sendDynamicComment(String dynamic_id, String content, String to_comment_id, HttpCallback callback) { HttpClient.getInstance().get("Community.sendDynamicComment", ImHttpConsts.SEND_DYNAMICCOMMENT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("dynamic_id", dynamic_id) .params("content", content) .params("to_comment_id", to_comment_id) @@ -45,8 +41,6 @@ public class ImHttpUtil { */ public static void getSystemMessageList(String type, int p, HttpCallback callback) { HttpClient.getInstance().get("Message.getListInfo", ImHttpConsts.GET_SYSTEM_MESSAGE_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .params("type", type) .execute(callback); @@ -57,8 +51,6 @@ public class ImHttpUtil { */ public static void getCommunityList(int p, HttpCallback callback) { HttpClient.getInstance().get("Community.guessYouLike", ImHttpConsts.GET_COMMUNITYLIST_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -69,8 +61,6 @@ public class ImHttpUtil { */ public static void checkBlack(String touid, HttpCallback callback) { HttpClient.getInstance().get("User.checkBlack", ImHttpConsts.CHECK_BLACK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .execute(callback); } @@ -80,8 +70,6 @@ public class ImHttpUtil { */ public static void setBlack(String touid, HttpCallback callback) { HttpClient.getInstance().get("User.setBlack", ImHttpConsts.SET_BLACK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .execute(callback); } diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index 7cd02634f..a51f7a3af 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -4,11 +4,13 @@ import android.text.TextUtils; import com.lzy.okgo.request.PostRequest; import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.CommonAppContext; import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.JsonBean; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.L; import com.yunbao.common.utils.MD5Util; @@ -47,7 +49,7 @@ public class LiveHttpUtil { */ public static void getMicList(String liveuid, int p, HttpCallback callback) { HttpClient.getInstance().get("Live.getDrLm", "Live.getDrLm") - .params("uid", liveuid) + .params("uid", liveuid, true) .execute(callback); } @@ -56,8 +58,6 @@ public class LiveHttpUtil { */ public static void getHDList(HttpCallback callback) { HttpClient.getInstance().get("Active.getActiveList", "Active.getActiveList") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -69,8 +69,6 @@ public class LiveHttpUtil { */ public static void roomCharge(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.roomCharge", LiveHttpConsts.ROOM_CHARGE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("liveuid", liveUid) .execute(callback); @@ -85,8 +83,6 @@ public class LiveHttpUtil { */ public static void timeCharge(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.timeCharge", LiveHttpConsts.TIME_CHARGE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("liveuid", liveUid) .execute(callback); @@ -98,8 +94,6 @@ public class LiveHttpUtil { */ public static void getCoin(HttpCallback callback) { HttpClient.getInstance().get("Live.getCoin", LiveHttpConsts.GET_COIN) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -110,7 +104,6 @@ public class LiveHttpUtil { */ public static void getLiveRecord(String touid, int p, HttpCallback callback) { HttpClient.getInstance().get("User.getLiverecord", LiveHttpConsts.GET_LIVE_RECORD) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .params("p", p) .execute(callback); @@ -133,7 +126,6 @@ public class LiveHttpUtil { */ public static void getAllImpress(String touid, HttpCallback callback) { HttpClient.getInstance().get("User.getUserLabel", LiveHttpConsts.GET_ALL_IMPRESS) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .execute(callback); } @@ -143,8 +135,6 @@ public class LiveHttpUtil { */ public static void setImpress(String touid, String ImpressIDs, HttpCallback callback) { HttpClient.getInstance().get("User.setUserLabel", LiveHttpConsts.SET_IMPRESS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .params("labels", ImpressIDs) .execute(callback); @@ -156,8 +146,6 @@ public class LiveHttpUtil { */ public static void getAdminList(String liveUid, HttpCallback callback) { HttpClient.getInstance().get("Live.getAdminList", LiveHttpConsts.GET_ADMIN_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .execute(callback); } @@ -167,8 +155,6 @@ public class LiveHttpUtil { */ public static void setAdmin(String liveUid, String touid, HttpCallback callback) { HttpClient.getInstance().get("Live.setAdmin", LiveHttpConsts.SET_ADMIN) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("touid", touid) .execute(callback); @@ -179,8 +165,6 @@ public class LiveHttpUtil { */ public static void getLiveShutUpList(String liveUid, int p, HttpCallback callback) { HttpClient.getInstance().get("Livemanage.getShutList", LiveHttpConsts.GET_LIVE_SHUT_UP_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("p", p) .execute(callback); @@ -191,8 +175,6 @@ public class LiveHttpUtil { */ public static void liveCancelShutUp(String liveUid, String toUid, HttpCallback callback) { HttpClient.getInstance().get("Livemanage.cancelShut", LiveHttpConsts.LIVE_CANCEL_SHUT_UP) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("touid", toUid) .execute(callback); @@ -203,8 +185,6 @@ public class LiveHttpUtil { */ public static void getLiveBlackList(String liveUid, int p, HttpCallback callback) { HttpClient.getInstance().get("Livemanage.getKickList", LiveHttpConsts.GET_LIVE_BLACK_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("p", p) .execute(callback); @@ -215,8 +195,6 @@ public class LiveHttpUtil { */ public static void liveCancelBlack(String liveUid, String toUid, HttpCallback callback) { HttpClient.getInstance().get("Livemanage.cancelKick", LiveHttpConsts.LIVE_CANCEL_BLACK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("touid", toUid) .execute(callback); @@ -245,8 +223,6 @@ public class LiveHttpUtil { */ public static void setReport(String touid, String content, HttpCallback callback) { HttpClient.getInstance().get("Live.setReport", LiveHttpConsts.SET_REPORT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .params("content", content) .execute(callback); @@ -258,8 +234,6 @@ public class LiveHttpUtil { public static void setReport(String touid, String content, File file1, File file2, File file3, String videoId, HttpCallback callback) { PostRequest request = HttpClient.getInstance().post("Live.setReport", LiveHttpConsts.SET_REPORT) .isMultipart(true) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .params("content", content); if (file1 != null) { @@ -282,7 +256,6 @@ public class LiveHttpUtil { */ public static void getLiveUser(String touid, String liveUid, HttpCallback callback) { HttpClient.getInstance().get("Live.getPop", LiveHttpConsts.GET_LIVE_USER) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .params("liveuid", liveUid) .execute(callback); @@ -293,8 +266,6 @@ public class LiveHttpUtil { */ public static void kicking(String liveUid, String touid, HttpCallback callback) { HttpClient.getInstance().get("Live.kicking", LiveHttpConsts.KICKING) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("touid", touid) .execute(callback); @@ -306,8 +277,6 @@ public class LiveHttpUtil { */ public static void setShutUp(String liveUid, String stream, int type, String touid, HttpCallback callback) { HttpClient.getInstance().get("Live.setShutUp", LiveHttpConsts.SET_SHUT_UP) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .params("type", type) @@ -323,8 +292,6 @@ public class LiveHttpUtil { */ public static void superCloseRoom(String liveUid, int type, HttpCallback callback) { HttpClient.getInstance().get("Live.superStopRoom", LiveHttpConsts.SUPER_CLOSE_ROOM) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("type", type) .execute(callback); @@ -336,8 +303,6 @@ public class LiveHttpUtil { */ public static void getGuardBuyList(HttpCallback callback) { HttpClient.getInstance().get("Guard.getList", LiveHttpConsts.GET_GUARD_BUY_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -346,8 +311,6 @@ public class LiveHttpUtil { */ public static void buyGuard(String liveUid, String stream, int guardId, HttpCallback callback) { HttpClient.getInstance().get("Guard.buyGuard", LiveHttpConsts.BUY_GUARD) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .params("guardid", guardId) @@ -360,8 +323,6 @@ public class LiveHttpUtil { */ public static void getGuardList(String liveUid, int p, HttpCallback callback) { HttpClient.getInstance().get("Guard.getGuardList", LiveHttpConsts.GET_GUARD_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("p", p) .execute(callback); @@ -373,7 +334,6 @@ public class LiveHttpUtil { */ public static void getLinkMicStream(HttpCallback callback) { HttpClient.getInstance().get("Linkmic.requestLVBAddrForLinkMic", LiveHttpConsts.GET_LINK_MIC_STREAM) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -385,8 +345,6 @@ public class LiveHttpUtil { */ public static void linkMicShowVideo(String touid, String pull_url) { HttpClient.getInstance().get("Live.showVideo", LiveHttpConsts.LINK_MIC_SHOW_VIDEO) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .params("pull_url", pull_url) @@ -403,8 +361,6 @@ public class LiveHttpUtil { */ public static void setLinkMicEnable(boolean linkMicEnable, HttpCallback callback) { HttpClient.getInstance().get("Linkmic.setMic", LiveHttpConsts.SET_LINK_MIC_ENABLE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("ismic", linkMicEnable ? 1 : 0) .execute(callback); } @@ -415,7 +371,6 @@ public class LiveHttpUtil { */ public static void checkLinkMicEnable(String liveUid, HttpCallback callback) { HttpClient.getInstance().get("Linkmic.isMic", LiveHttpConsts.CHECK_LINK_MIC_ENABLE) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("liveuid", liveUid) .execute(callback); } @@ -425,7 +380,7 @@ public class LiveHttpUtil { */ public static void livePkCheckLive(String liveUid, String stream, String uidStream, HttpCallback callback) { HttpClient.getInstance().get("Home.getisPk", "Home.getisPk") - .params("uid", liveUid) + .params("uid", liveUid, true) // .params("token", CommonAppConfig.getInstance().getToken()) // .params("liveuid", liveUid) // .params("stream", stream) @@ -438,8 +393,6 @@ public class LiveHttpUtil { */ public static void sendRedPack(String stream, String coin, String count, String title, int type, int sendType, HttpCallback callback) { HttpClient.getInstance().get("Red.SendRed", LiveHttpConsts.SEND_RED_PACK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("coin", coin) .params("nums", count) @@ -455,8 +408,6 @@ public class LiveHttpUtil { public static void getRedPackList(String stream, HttpCallback callback) { String sign = MD5Util.getMD5("stream=" + stream + "&" + SALT); HttpClient.getInstance().get("Red.GetRedList", LiveHttpConsts.GET_RED_PACK_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("sign", sign) .execute(callback); @@ -466,11 +417,10 @@ public class LiveHttpUtil { * 直播间抢红包 */ public static void robRedPack(String stream, int redPackId, HttpCallback callback) { - String uid = CommonAppConfig.getInstance().getUid(); + String uid = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo().getId() + ""; String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&uid=" + uid + "&" + SALT); HttpClient.getInstance().get("Red.RobRed", LiveHttpConsts.ROB_RED_PACK) - .params("uid", uid) - .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", uid,true) .params("stream", stream) .params("redid", redPackId) .params("sign", sign) @@ -482,11 +432,8 @@ public class LiveHttpUtil { * 直播间红包领取详情 */ public static void getRedPackResult(String stream, int redPackId, HttpCallback callback) { - String uid = CommonAppConfig.getInstance().getUid(); String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&" + SALT); HttpClient.getInstance().get("Red.GetRedRobList", LiveHttpConsts.GET_RED_PACK_RESULT) - .params("uid", uid) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("redid", redPackId) .params("sign", sign) @@ -498,8 +445,6 @@ public class LiveHttpUtil { */ public static void sendDanmu(String content, String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.sendBarrage", LiveHttpConsts.SEND_DANMU) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .params("giftid", "1") @@ -516,8 +461,6 @@ public class LiveHttpUtil { */ public static void checkLive(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.checkLive", LiveHttpConsts.CHECK_LIVE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .execute(callback); @@ -529,8 +472,6 @@ public class LiveHttpUtil { */ public static void enterRoom(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.enterRoom", LiveHttpConsts.ENTER_ROOM) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("city", CommonAppConfig.getInstance().getCity()) .params("liveuid", liveUid) .params("stream", stream) @@ -542,7 +483,6 @@ public class LiveHttpUtil { */ public static void enterBackRoom(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Tx.userjoinroom", "Tx.userjoinroom") - .params("token", CommonAppConfig.getInstance().getToken()) .params("GroupId", "g" + liveUid) .params("stream", stream) .execute(callback); @@ -553,7 +493,6 @@ public class LiveHttpUtil { */ public static void qBackRoom(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Tx.leave_room", "Tx.leave_room") - .params("token", CommonAppConfig.getInstance().getToken()) .params("GroupId", "g" + liveUid) .params("stream", stream) .execute(callback); @@ -564,8 +503,6 @@ public class LiveHttpUtil { */ public static void getGiftList(HttpCallback callback) { HttpClient.getInstance().get("Live.getGiftList", LiveHttpConsts.GET_GIFT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -574,8 +511,6 @@ public class LiveHttpUtil { */ public static void getNewGiftList(HttpCallback callback) { HttpClient.getInstance().get("Live.getGiftListApp", LiveHttpConsts.GET_GIFT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -584,8 +519,6 @@ public class LiveHttpUtil { */ public static void getWrapList(HttpCallback callback) { HttpClient.getInstance().get("Live.getPackList", LiveHttpConsts.GET_WRAP_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -594,50 +527,45 @@ public class LiveHttpUtil { */ public static void getWishList(HttpCallback callback) { HttpClient.getInstance().get("Guide.getWishlist", LiveHttpConsts.GET_WISH_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } - /** + /** * 用户获取主播的心愿单列表 */ public static void getWishList(String liveId, HttpCallback callback) { HttpClient.getInstance().get("Guide.getWishlist", LiveHttpConsts.GET_WISH_LIST) - .params("token", CommonAppConfig.getInstance().getToken()) - .params("uid", liveId) + .params("uid", liveId, true) .execute(callback); } /** * 獲取新手任務 + * * @param callback */ public static void getFrontTask(HttpCallback callback) { HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask") - .params("token", CommonAppConfig.getInstance().getToken()) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } /** * 獲取新手任務 + * * @param callback */ - public static void getFrontTask(String Token,String uid,HttpCallback callback) { + public static void getFrontTask(String Token, String uid, HttpCallback callback) { HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask") - .params("token", Token) - .params("uid", uid) + .params("token", Token, true) + .params("uid", uid, true) .execute(callback); } /** * 完成新手任務 */ - public static void setFrontTask(String type , HttpCallback callback) { + public static void setFrontTask(String type, HttpCallback callback) { HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask") - .params("token", CommonAppConfig.getInstance().getToken()) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", type) .execute(callback); } @@ -645,21 +573,18 @@ public class LiveHttpUtil { /** * 完成新手任務 */ - public static void setFrontTask(String type ,String liveuid , HttpCallback callback) { + public static void setFrontTask(String type, String liveuid, HttpCallback callback) { HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask") - .params("token", CommonAppConfig.getInstance().getToken()) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", type) .params("liveuid", liveuid) .execute(callback); } + /** * 修改心愿单列表 */ public static void modifyWishList(String list, HttpCallback callback) { HttpClient.getInstance().get("Guide.setWishlist", LiveHttpConsts.SET_WISH_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("list", list) .execute(callback); } @@ -669,8 +594,6 @@ public class LiveHttpUtil { */ public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) { HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .params("giftid", giftId) @@ -697,8 +620,6 @@ public class LiveHttpUtil { public static void sendZAN(String liveUid, HttpCallback callback) { HttpClient.getInstance().get("Fans.doubleClickLight", "Fans.DoubleClickLight") .params("liveuid", liveUid) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -707,7 +628,6 @@ public class LiveHttpUtil { */ public static void livePkSearchAnchor(String key, int p, HttpCallback callback) { HttpClient.getInstance().get("Livepk.search", LiveHttpConsts.LIVE_PK_SEARCH_ANCHOR) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("key", key) .params("p", p) .execute(callback); @@ -719,8 +639,6 @@ public class LiveHttpUtil { */ public static void getLivePkList(int p, HttpCallback callback) { HttpClient.getInstance().get("Livepk.getLiveList", LiveHttpConsts.GET_LIVE_PK_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -746,44 +664,6 @@ public class LiveHttpUtil { .execute(callback); } - - /** - * 主播开播 - * - * @param title 直播标题 - * @param type 直播类型 普通 密码 收费等 - * @param typeVal 密码 价格等 - * @param file 封面图片文件 - * @param callback - */ - public static void createRoom(String title, int liveClassId, int type, int typeVal, File file, boolean openLocation, HttpCallback callback) { -// CommonAppConfig appConfig = CommonAppConfig.getInstance(); -// UserBean u = appConfig.getUserBean(); -// if (u == null) { -// return; -// } -// PostRequest request = HttpClient.getInstance().post("Live.createRoom", LiveHttpConsts.CREATE_ROOM) -// .params("uid", appConfig.getUid()) -// .params("token", appConfig.getToken()) -// .params("user_nicename", u.getUserNiceName()) -// .params("avatar", u.getAvatar()) -// .params("avatar_thumb", u.getAvatarThumb()) -// .params("city", openLocation ? appConfig.getCity() : "") -// .params("province", openLocation ? appConfig.getProvince() : "") -// .params("lat", openLocation ? String.valueOf(appConfig.getLat()) : "") -// .params("lng", openLocation ? String.valueOf(appConfig.getLng()) : "") -// .params("title", title) -// .params("liveclassid", liveClassId) -// .params("type", type) -// .params("type_val", typeVal) -// .params("deviceinfo", LiveConfig.getSystemParams()); -// ; -// if (file != null) { -// request.params("file", file); -// } -// request.execute(callback); - } - /** * 新主播开播 * @@ -794,14 +674,8 @@ public class LiveHttpUtil { * @param callback */ public static void newcreateRoom(String title, int liveClassId, int type, int typeVal, File file, HttpCallback callback) { - CommonAppConfig appConfig = CommonAppConfig.getInstance(); - UserBean u = appConfig.getUserBean(); - if (u == null) { - return; - } + PostRequest request = HttpClient.getInstance().post("Live.createRoom2", LiveHttpConsts.CREATE_ROOM) - .params("uid", appConfig.getUid()) - .params("token", appConfig.getToken()) .params("title", title) .params("liveclassid", liveClassId) .params("type", type) @@ -819,8 +693,6 @@ public class LiveHttpUtil { */ public static void changeLive(String stream) { HttpClient.getInstance().get("Live.changeLive", LiveHttpConsts.CHANGE_LIVE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("stream", stream) .params("status", "1") .execute(new HttpCallback() { @@ -837,8 +709,6 @@ public class LiveHttpUtil { public static void stopLive(String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.stopRoom", LiveHttpConsts.STOP_LIVE) .params("stream", stream) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -852,7 +722,6 @@ public class LiveHttpUtil { public static void getisRong(HttpCallback callback) { HttpClient.getInstance().get("Live.isRong", "Live.isRong") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -861,7 +730,6 @@ public class LiveHttpUtil { */ public static void getTxLinkMicAccUrl(String originStreamUrl, HttpCallback callback) { HttpClient.getInstance().get("Linkmic.requestPlayUrlWithSignForLinkMic", LiveHttpConsts.GET_TX_LINK_MIC_ACC_URL) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("originStreamUrl", originStreamUrl) .execute(callback); } @@ -872,7 +740,6 @@ public class LiveHttpUtil { */ public static void linkMicTxMixStream(String mergeparams) { HttpClient.getInstance().get("Linkmic.mergeVideoStream", LiveHttpConsts.LINK_MIC_TX_MIX_STREAM) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("mergeparams", mergeparams) .execute(CommonHttpUtil.NO_CALLBACK); } @@ -883,8 +750,6 @@ public class LiveHttpUtil { */ public static void getMyAdminRoomList(int p, HttpCallback callback) { HttpClient.getInstance().get("Livemanage.getRoomList", LiveHttpConsts.GET_MY_ADMIN_ROOM_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -895,8 +760,6 @@ public class LiveHttpUtil { */ public static void getLiveGiftPrizePool(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Jackpot.getJackpot", LiveHttpConsts.GET_LIVE_GIFT_PRIZE_POOL) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .execute(callback); @@ -907,8 +770,6 @@ public class LiveHttpUtil { */ public static void anchorCheckLive(String liveUid, String stream, HttpCallback callback) { HttpClient.getInstance().get("Live.checkLiveing", LiveHttpConsts.ANCHOR_CHECK_LIVE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("liveuid", liveUid) .params("stream", stream) .execute(callback); @@ -931,8 +792,6 @@ public class LiveHttpUtil { public static void getHcGiftList(HttpCallback callback) { HttpClient.getInstance().get("Live.getSvgaList", LiveHttpConsts.GET_GIFT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -943,8 +802,6 @@ public class LiveHttpUtil { public static void getHczGiftList(HttpCallback callback) { HttpClient.getInstance().get("Home.aoto_load", "Home.aoto_load") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -955,8 +812,6 @@ public class LiveHttpUtil { public static void geteEvent(String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Rank.isActivity", LiveHttpConsts.GET_EVENT) .params("anchorUid", anchor_id) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -966,8 +821,6 @@ public class LiveHttpUtil { public static void setEvent(String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Rank.crystalTimeEnd", LiveHttpConsts.GET_EVENT) .params("anchor_id", anchor_id) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -976,8 +829,6 @@ public class LiveHttpUtil { */ public static void userHopePrankTurntable(String anchor_id, String prankid, HttpCallback callback) { HttpClient.getInstance().get("Prank.userHopePrankTurntable", LiveHttpConsts.USERHOPEPRANKTURNTABLE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("prankid", prankid) .params("anchor_id", anchor_id) .execute(callback); @@ -988,8 +839,6 @@ public class LiveHttpUtil { */ public static void endPrankTurntable(String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Prank.endPrankTurntable", LiveHttpConsts.ENDPRANKTURNTABLE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("anchor_id", anchor_id) .execute(callback); } @@ -999,8 +848,6 @@ public class LiveHttpUtil { */ public static void getAnchorLastWeekList(HttpCallback callback) { HttpClient.getInstance().get("WeekStar.getAnchorLastWeekList", LiveHttpConsts.GETANCHORLASTWEEKLIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -1009,8 +856,6 @@ public class LiveHttpUtil { */ public static void useHotCardUserList(String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Live.useHotCardUserList", LiveHttpConsts.USEHOTCARDUSERLIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("anchor_id", anchor_id) .execute(callback); } @@ -1020,8 +865,6 @@ public class LiveHttpUtil { */ public static void isHotCard(String anchor_id, HttpCallback callback) { HttpClient.getInstance().get("Live.isHotCard", LiveHttpConsts.ISHOTCARD) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("anchor_id", anchor_id) .execute(callback); } @@ -1031,8 +874,6 @@ public class LiveHttpUtil { */ public static void setInstructorRemark(String touid, String remark, HttpCallback callback) { HttpClient.getInstance().get("User.setInstructorRemark", LiveHttpConsts.SETINSTRUCTORREMARK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", touid) .params("remark", remark) .execute(callback); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketClient.java b/live/src/main/java/com/yunbao/live/socket/SocketClient.java index 07314dae4..e56abe0d5 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketClient.java @@ -784,7 +784,6 @@ public class SocketClient { LivePushTxViewHolder.mPreView.setLayoutParams(params); //断开连麦 HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketLinkMicPkUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketLinkMicPkUtil.java index b5f388a34..8ec8ae0ca 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketLinkMicPkUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketLinkMicPkUtil.java @@ -44,7 +44,6 @@ public class SocketLinkMicPkUtil { public static void linkMicPkAccept(SocketClient client, String pkUid, String url, String name) { Log.i("pksend", "发送的pkurl=" + url + "****发送的pkname=" + name); HttpClient.getInstance().get("Livepk.changeLive", "Livepk.changeLive") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("pkuid", pkUid) .params("type", "1") .params("sign", "1") @@ -53,7 +52,6 @@ public class SocketLinkMicPkUtil { public void onSuccess(int code, String msgs, String[] info) { if (code == 0) { HttpClient.getInstance().get("Livepk.setPK", "Livepk.setPK") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("pkuid", pkUid) .params("type", "1") .params("sign", "1") diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 0c4c14d79..dc3d9fe92 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -910,7 +910,6 @@ public class SocketRyClient { LivePushRyViewHolder.mPreView.setLayoutParams(params); //断开连麦 HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 2ffe30f4b..bc322ba97 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -179,7 +179,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { public void onClick(View v) { //获取房间连麦状态 HttpClient.getInstance().get("live.getDrLm", "live.getDrLm") - .params("uid", mLiveUid) + .params("uid", mLiveUid,true) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 73970e17e..a5f11df1b 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -727,7 +727,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { HttpClient.getInstance().get("live.joinDrLm", "live.joinDrLm") .params("roomid", LiveActivity.mLiveUid) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java index 4f0a26145..d6c58072e 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushRyViewHolder.java @@ -354,7 +354,6 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX public void onConfirmClick(Dialog dialog, String content) { //断开连麦 HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java index 5113d0f4e..490c4f583 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePushTxViewHolder.java @@ -108,7 +108,6 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi public void onConfirmClick(Dialog dialog, String content) { //断开连麦 HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -117,7 +116,6 @@ public class LivePushTxViewHolder extends AbsLivePushViewHolder implements ITXLi }); HttpClient.getInstance().get("Livepk.endPK", "Livepk.endPK") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("addtime", "00:00") .params("type", "0") .params("sign", "1") diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index 261044370..f6806a611 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -81,7 +81,6 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { public void onClick(View view) { //開始多人PK HttpClient.getInstance().post("live.startDRPK", "live.startDRPK") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("roomid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override @@ -103,7 +102,6 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { @Override public void onClick(View view) { HttpClient.getInstance().get("live.endDRpk", "live.endDRpk") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("roomid", CommonAppConfig.getInstance().getUid()) .execute(new HttpCallback() { @Override diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index 669d37a27..98edc6447 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -209,6 +209,7 @@ public class EntryActivity extends AppCompatActivity { @Override public void onClick(View view) { WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1); + } }); @@ -571,6 +572,7 @@ public class EntryActivity extends AppCompatActivity { public static void ToLogin() { activity.startActivity(new Intent(activity, LoginActivity.class)); + activity.finish(); } private static final String EMAIL = "email"; @@ -725,8 +727,6 @@ public class EntryActivity extends AppCompatActivity { EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class)); } else { HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java index da575418a..40097ecc3 100644 --- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java @@ -311,14 +311,13 @@ public class LoginActivity extends AbsActivity { logger.logEvent("FB_login"); Adjust.trackEvent(adjustEvent1); HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (info[0] != null && mFirstLogin == true) { JSONObject obj = JSON.parseObject(info[0]); MainActivity.forward(LoginActivity.this, false); + finish(); gotoLive(obj.getString("anchor_id")); IMLoginManager.get(mContext).setisNewUserOne(true); IMLoginManager.get(mContext).setNewUserGif(true); @@ -327,6 +326,7 @@ public class LoginActivity extends AbsActivity { } } else { MainActivity.forward(LoginActivity.this, false); + finish(); } } diff --git a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java index 6db60e826..60448707f 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -94,8 +94,6 @@ public class OneLoginDialog extends AbsDialogFragment { @Override public void onClick(View v) { HttpClient.getInstance().post("User.userBindAgentAdmin", "User.userBindAgentAdmin") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("invitation_code", bundle.getString("code")) .params("user_nicename", bundle.getString("name")) .execute(new HttpCallback() { @@ -114,8 +112,6 @@ public class OneLoginDialog extends AbsDialogFragment { } }); HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index e81e5a5ae..147bf8f26 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -95,8 +95,6 @@ public class MainHttpUtil { public static void requestBonus(HttpCallback callback) { String appVer = AppUtils.getAppVersionName(); HttpClient.getInstance().get("User.bonus", MainHttpConsts.REQUEST_BONUS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("appAndroidVersion", appVer) .execute(callback); } @@ -106,9 +104,6 @@ public class MainHttpUtil { */ public static void requestNewBonus(HttpCallback callback) { HttpClient.getInstance().get("Sign.userSign", MainHttpConsts.REQUEST_BONUS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("uuid_Device", DeviceUtils.getUniqueDeviceId()) .params("lastlogindevice", "Android") .params("model", android.os.Build.BRAND + android.os.Build.MODEL) @@ -120,8 +115,6 @@ public class MainHttpUtil { */ public static void getBonus(HttpCallback callback) { HttpClient.getInstance().get("User.getBonus", MainHttpConsts.GET_BONUS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -130,8 +123,6 @@ public class MainHttpUtil { */ public static void setDistribut(String code, HttpCallback callback) { HttpClient.getInstance().get("User.setDistribut", MainHttpConsts.SET_DISTRIBUT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("code", code) .execute(callback); } @@ -142,7 +133,6 @@ public class MainHttpUtil { public static void getHot(int p, HttpCallback callback) { HttpClient.getInstance().get("Home.getHot", MainHttpConsts.GET_HOT) .params("p", p) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -151,7 +141,6 @@ public class MainHttpUtil { */ public static void getRandom(int p, HttpCallback callback) { HttpClient.getInstance().get("Home.getRandom", MainHttpConsts.GET_RANDOM) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -161,7 +150,6 @@ public class MainHttpUtil { public static void getHomeFollow(int p, HttpCallback callback) { HttpClient.getInstance().get("Home.getFollow", MainHttpConsts.GET_HOME_FOLLOW) .params("p", p) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -171,7 +159,6 @@ public class MainHttpUtil { */ public static void getFollow(int p, HttpCallback callback) { HttpClient.getInstance().get("Home.getFollow", MainHttpConsts.GET_FOLLOW) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("p", p) .execute(callback); } @@ -191,7 +178,6 @@ public class MainHttpUtil { //排行榜 收益榜 public static void profitList(String type, int p, HttpCallback callback) { HttpClient.getInstance().get("Home.profitList", MainHttpConsts.PROFIT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", type) .params("p", p) .execute(callback); @@ -200,7 +186,6 @@ public class MainHttpUtil { //排行榜 贡献榜 public static void consumeList(String type, int p, HttpCallback callback) { HttpClient.getInstance().get("Home.consumeList", MainHttpConsts.CONSUME_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", type) .params("p", p) .execute(callback); @@ -242,8 +227,6 @@ public class MainHttpUtil { */ public static void getBaseInfo(String uid, String token, final CommonCallback commonCallback) { HttpClient.getInstance().get("User.getBaseInfos", MainHttpConsts.GET_BASE_INFO) - .params("uid", uid) - .params("token", token) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -277,8 +260,6 @@ public class MainHttpUtil { public static void getBaseInfos(String uid, String token, HttpCallback callback) { HttpClient.getInstance().get("User.getBaseInfos", MainHttpConsts.GET_BASE_INFO) - .params("uid", uid) - .params("token", token) .execute(callback); } @@ -296,8 +277,6 @@ public class MainHttpUtil { */ public static void getBalance(HttpCallback callback) { HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance") - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -314,8 +293,6 @@ public class MainHttpUtil { */ public static void setBlack(String toUid, HttpCallback callback) { HttpClient.getInstance().get("User.setBlack", MainHttpConsts.SET_BLACK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", toUid) .execute(callback); } @@ -325,8 +302,6 @@ public class MainHttpUtil { */ public static void getSettingList(HttpCallback callback) { HttpClient.getInstance().get("User.getPerSetting", MainHttpConsts.GET_SETTING_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -335,8 +310,6 @@ public class MainHttpUtil { */ public static void search(String key, int type, int p, HttpCallback callback) { HttpClient.getInstance().get("Home.search", MainHttpConsts.SEARCH) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("key", key) .params("type", type) .params("p", p) @@ -348,7 +321,6 @@ public class MainHttpUtil { */ public static void getBlackList(int p, HttpCallback callback) { HttpClient.getInstance().get("User.getBlackList", "User.getBlackList") - .params("uid", CommonAppConfig.getInstance().getUid()) .params("p", p) .execute(callback); } @@ -360,7 +332,6 @@ public class MainHttpUtil { */ public static void getFollowList(String touid, int p, HttpCallback callback) { HttpClient.getInstance().get("User.getFollowsList", MainHttpConsts.GET_FOLLOW_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .params("p", p) .execute(callback); @@ -373,7 +344,6 @@ public class MainHttpUtil { */ public static void getFansList(String touid, int p, HttpCallback callback) { HttpClient.getInstance().get("User.getFansList", MainHttpConsts.GET_FANS_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .params("p", p) .execute(callback); @@ -386,8 +356,6 @@ public class MainHttpUtil { public static void updateAvatar(File file, HttpCallback callback) { HttpClient.getInstance().post("User.updateAvatar", MainHttpConsts.UPDATE_AVATAR) .isMultipart(true) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("file", file) .execute(callback); } @@ -399,8 +367,6 @@ public class MainHttpUtil { */ public static void updateFields(String fields, HttpCallback callback) { HttpClient.getInstance().get("User.updateFields", MainHttpConsts.UPDATE_FIELDS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("fields", fields) .execute(callback); } @@ -411,8 +377,6 @@ public class MainHttpUtil { */ public static void getProfit(HttpCallback callback) { HttpClient.getInstance().get("User.getProfit", MainHttpConsts.GET_PROFIT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -421,8 +385,6 @@ public class MainHttpUtil { */ public static void getCashAccountList(HttpCallback callback) { HttpClient.getInstance().get("User.getUserAccountList", MainHttpConsts.GET_USER_ACCOUNT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -432,8 +394,6 @@ public class MainHttpUtil { */ public static void addCashAccount(String account, String name, String bank, int type, HttpCallback callback) { HttpClient.getInstance().get("User.setUserAccount", MainHttpConsts.ADD_CASH_ACCOUNT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("account", account) .params("name", name) .params("account_bank", bank) @@ -446,8 +406,6 @@ public class MainHttpUtil { */ public static void deleteCashAccount(String accountId, HttpCallback callback) { HttpClient.getInstance().get("User.delUserAccount", MainHttpConsts.DEL_CASH_ACCOUNT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("id", accountId) .execute(callback); } @@ -457,8 +415,6 @@ public class MainHttpUtil { */ public static void doCash(String votes, String accountId, HttpCallback callback) { HttpClient.getInstance().get("User.setCash", MainHttpConsts.DO_CASH) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("cashvote", votes)//提现的票数 .params("accountid", accountId)//账号ID .execute(callback); @@ -471,7 +427,6 @@ public class MainHttpUtil { public static void getClassLive(int classId, int p, HttpCallback callback) { HttpClient.getInstance().get("Home.getClassLive", MainHttpConsts.GET_CLASS_LIVE) .params("liveclassid", classId) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("p", p) .execute(callback); } @@ -481,8 +436,6 @@ public class MainHttpUtil { */ public static void getMyImpress(HttpCallback callback) { HttpClient.getInstance().get("User.getMyLabel", MainHttpConsts.GET_MY_IMPRESS) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -491,7 +444,6 @@ public class MainHttpUtil { */ public static void getRecommend(HttpCallback callback) { HttpClient.getInstance().get("Home.getRecommend", MainHttpConsts.GET_RECOMMEND) - .params("uid", CommonAppConfig.getInstance().getUid()) .execute(callback); } @@ -501,7 +453,6 @@ public class MainHttpUtil { */ public static void recommendFollow(String touid, HttpCallback callback) { HttpClient.getInstance().get("Home.attentRecommend", MainHttpConsts.RECOMMEND_FOLLOW) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("touid", touid) .execute(callback); } @@ -545,8 +496,8 @@ public class MainHttpUtil { HttpClient.getInstance().get("Login.bindMobile", MainHttpConsts.BINDMOBILE) .params("mobile", mobile) .params("country_code", countryCode + "") - .params("uid", uid) - .params("token", token) + .params("uid", uid,true) + .params("token", token,true) .params("user_pass", user_pass) .params("user_pass2", user_pass2) .params("code", code) @@ -560,8 +511,8 @@ public class MainHttpUtil { HttpClient.getInstance().get("Login.updateBindMobile", MainHttpConsts.UPDATEBINDMOBILE) .params("mobile", mobile) .params("country_code", countryCode + "") - .params("uid", uid) - .params("token", token) + .params("uid", uid,true) + .params("token", token,true) .params("code", code) .execute(callback); } @@ -618,8 +569,6 @@ public class MainHttpUtil { */ public static void modifyPwd(String oldpass, String pass, String pass2, HttpCallback callback) { HttpClient.getInstance().get("User.updatePass", MainHttpConsts.MODIFY_PWD) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("oldpass", oldpass) .params("pass", pass) .params("pass2", pass2) @@ -644,8 +593,6 @@ public class MainHttpUtil { */ public static void getQrCode(HttpCallback callback) { HttpClient.getInstance().get("Agent.getCode", MainHttpConsts.GET_QR_CODE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -655,7 +602,6 @@ public class MainHttpUtil { */ public static void getHomeTop(HttpCallback callback) { HttpClient.getInstance().get("Home.consumeproList", MainHttpConsts.HOME_TOP) - .params("uid", CommonAppConfig.getInstance().getUid()) .params("type", "month") .params("p", "1") .execute(callback); @@ -666,8 +612,6 @@ public class MainHttpUtil { */ public static void sendDynamicGift(String id, int gift_num, String gift_id, HttpCallback callback) { HttpClient.getInstance().get("Community.sendDynamicGift", MainHttpConsts.SEND_DYNAMICGIFT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("dynamic_id", id) .params("gift_num", gift_num) .params("gift_id", gift_id) @@ -679,8 +623,6 @@ public class MainHttpUtil { */ public static void getDynamicGiftInfo(HttpCallback callback) { HttpClient.getInstance().get("Community.getDynamicGiftInfo", MainHttpConsts.GET_DYNAMICGIFTINFO) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -689,8 +631,6 @@ public class MainHttpUtil { */ public static void getDynamicSendGiftList(String id, HttpCallback callback) { HttpClient.getInstance().get("Community.getDynamicSendGiftList", MainHttpConsts.GET_DYNAMICSENDGIFTLIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("dynamic_id", id) .execute(callback); } @@ -700,8 +640,6 @@ public class MainHttpUtil { */ public static void isAnchor(HttpCallback callback) { HttpClient.getInstance().get("User.isAnchor", MainHttpConsts.ISANCHOR) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -710,8 +648,6 @@ public class MainHttpUtil { */ public static void getUserFrontTaskType(HttpCallback callback) { HttpClient.getInstance().get("Task.getUserFrontTaskType", MainHttpConsts.GET_USER_FRONTTASKTYPE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -720,8 +656,6 @@ public class MainHttpUtil { */ public static void getCustomerService(HttpCallback callback) { HttpClient.getInstance().get("Home.getCustomerService", MainHttpConsts.GETCUSTOMERSERVICE) -// .params("uid", CommonAppConfig.getInstance().getUid()) -// .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -730,8 +664,6 @@ public class MainHttpUtil { */ public static void getInstructorRemark(HttpCallback callback) { HttpClient.getInstance().get("User.getInstructorRemark", MainHttpConsts.GETINSTRUCTORREMARK) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -740,8 +672,6 @@ public class MainHttpUtil { */ public static void isInstructor(HttpCallback callback) { HttpClient.getInstance().get("User.isInstructor", MainHttpConsts.ISINSTRUCTOR) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } diff --git a/main/src/main/java/com/yunbao/main/views/HonorViewHolder.java b/main/src/main/java/com/yunbao/main/views/HonorViewHolder.java index e259a3321..e008e1b1d 100644 --- a/main/src/main/java/com/yunbao/main/views/HonorViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/HonorViewHolder.java @@ -76,8 +76,7 @@ public class HonorViewHolder extends AbsUserHomeViewHolder { * 获取用户荣誉和座骑 */ HttpClient.getInstance().get("User.medalCarList", LiveHttpConsts.GET_USER_LIST) - .params("uid", mToUid) - .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", mToUid,true) .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/video/src/main/java/com/yunbao/video/http/VideoHttpUtil.java b/video/src/main/java/com/yunbao/video/http/VideoHttpUtil.java index e3adcee19..167407ed8 100644 --- a/video/src/main/java/com/yunbao/video/http/VideoHttpUtil.java +++ b/video/src/main/java/com/yunbao/video/http/VideoHttpUtil.java @@ -30,8 +30,6 @@ public class VideoHttpUtil { */ public static void getHomeVideoList(int p, HttpCallback callback) { HttpClient.getInstance().get("Video.getVideoList", VideoHttpConsts.GET_HOME_VIDEO_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -42,8 +40,6 @@ public class VideoHttpUtil { */ public static void setVideoLike(String tag, String videoid, HttpCallback callback) { HttpClient.getInstance().get("Video.addLike", tag) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("videoid", videoid) .execute(callback); } @@ -53,8 +49,6 @@ public class VideoHttpUtil { */ public static void getVideoCommentList(String videoid, int p, HttpCallback callback) { HttpClient.getInstance().get("Video.getComments", VideoHttpConsts.GET_VIDEO_COMMENT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("videoid", videoid) .params("p", p) .execute(callback); @@ -66,8 +60,6 @@ public class VideoHttpUtil { public static void setCommentLike(String commentid, HttpCallback callback) { HttpClient.getInstance().get("Video.addCommentLike", VideoHttpConsts.SET_COMMENT_LIKE) .params("commentid", commentid) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .execute(callback); } @@ -76,8 +68,6 @@ public class VideoHttpUtil { */ public static void setComment(String toUid, String videoId, String content, String commentId, String parentId, HttpCallback callback) { HttpClient.getInstance().get("Video.setComment", VideoHttpConsts.SET_COMMENT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", toUid) .params("videoid", videoId) .params("commentid", commentId) @@ -94,8 +84,6 @@ public class VideoHttpUtil { public static void getCommentReply(String commentid, int p, HttpCallback callback) { HttpClient.getInstance().get("Video.getReplys", VideoHttpConsts.GET_COMMENT_REPLY) .params("commentid", commentid) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -113,8 +101,6 @@ public class VideoHttpUtil { */ public static void getHotMusicList(int p, HttpCallback callback) { HttpClient.getInstance().get("Music.hotLists", VideoHttpConsts.GET_HOT_MUSIC_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -124,8 +110,6 @@ public class VideoHttpUtil { */ public static void setMusicCollect(int muiscId, HttpCallback callback) { HttpClient.getInstance().get("Music.collectMusic", VideoHttpConsts.SET_MUSIC_COLLECT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("musicid", muiscId) .execute(callback); } @@ -135,8 +119,6 @@ public class VideoHttpUtil { */ public static void getMusicCollectList(int p, HttpCallback callback) { HttpClient.getInstance().get("Music.getCollectMusicLists", VideoHttpConsts.GET_MUSIC_COLLECT_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("p", p) .execute(callback); } @@ -146,8 +128,6 @@ public class VideoHttpUtil { */ public static void getMusicList(String classId, int p, HttpCallback callback) { HttpClient.getInstance().get("Music.music_list", VideoHttpConsts.GET_MUSIC_LIST) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("classify", classId) .params("p", p) .execute(callback); @@ -159,8 +139,6 @@ public class VideoHttpUtil { */ public static void videoSearchMusic(String key, int p, HttpCallback callback) { HttpClient.getInstance().get("Music.searchMusic", VideoHttpConsts.VIDEO_SEARCH_MUSIC) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("key", key) .params("p", p) .execute(callback); @@ -186,8 +164,6 @@ public class VideoHttpUtil { */ public static void saveUploadVideoInfo(String title, String thumb, String href, int musicId, boolean openLocation, HttpCallback callback) { HttpClient.getInstance().get("Video.setVideo", VideoHttpConsts.SAVE_UPLOAD_VIDEO_INFO) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("lat", openLocation ? String.valueOf(CommonAppConfig.getInstance().getLat()) : "") .params("lng", openLocation ? String.valueOf(CommonAppConfig.getInstance().getLng()) : "") .params("city", openLocation ? CommonAppConfig.getInstance().getCity() : "") @@ -211,8 +187,6 @@ public class VideoHttpUtil { */ public static void getHomeVideo(String toUid, int p, HttpCallback callback) { HttpClient.getInstance().get("Video.getHomeVideo", VideoHttpConsts.GET_HOME_VIDEO) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("touid", toUid) .params("p", p) .execute(callback); @@ -232,8 +206,6 @@ public class VideoHttpUtil { */ public static void videoReport(String videoId, String reportId, String content, HttpCallback callback) { HttpClient.getInstance().get("Video.report", VideoHttpConsts.VIDEO_REPORT) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("videoid", videoId) .params("type", reportId) .params("content", content) @@ -245,8 +217,6 @@ public class VideoHttpUtil { */ public static void videoDelete(String videoid, HttpCallback callback) { HttpClient.getInstance().get("Video.del", VideoHttpConsts.VIDEO_DELETE) - .params("uid", CommonAppConfig.getInstance().getUid()) - .params("token", CommonAppConfig.getInstance().getToken()) .params("videoid", videoid) .execute(callback); } @@ -258,8 +228,7 @@ public class VideoHttpUtil { String uid = CommonAppConfig.getInstance().getUid(); String s = MD5Util.getMD5(uid + "-" + videoid + "-" + VIDEO_SALT); HttpClient.getInstance().get("Video.addShare", VideoHttpConsts.SET_VIDEO_SHARE) - .params("uid", uid) - .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", uid,true) .params("videoid", videoid) .params("random_str", s) .execute(callback); @@ -277,8 +246,7 @@ public class VideoHttpUtil { VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_START); String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT); HttpClient.getInstance().get("Video.addView", VideoHttpConsts.VIDEO_WATCH_START) - .params("uid", uid) - .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", uid,true) .params("videoid", videoId) .params("random_str", s) .execute(CommonHttpUtil.NO_CALLBACK); @@ -295,8 +263,7 @@ public class VideoHttpUtil { VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_END); String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT); HttpClient.getInstance().get("Video.setConversion", VideoHttpConsts.VIDEO_WATCH_END) - .params("uid", uid) - .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", uid,true) .params("videoid", videoId) .params("random_str", s) .execute(CommonHttpUtil.NO_CALLBACK);