| | |
| | | public class OpenInterceptor implements Interceptor { |
| | | |
| | | protected final Charset UTF8 = Charset.forName("UTF-8"); |
| | | protected final String ENCRYPT = "body"; |
| | | protected final String ENCRYPT = "paramsString"; |
| | | |
| | | @Override |
| | | public Response intercept(Chain chain) throws IOException { |
| | |
| | | Request.Builder requestBuild = request.newBuilder() |
| | | .addHeader("device", new Gson().toJson(PhoneDevice.getDevice())) |
| | | .addHeader("appVersion", DeviceUtil.getAppVersionName(OpenApplication.Companion.getApplication())) |
| | | .addHeader("appVersionCode", DeviceUtil.getAppVersionCode(OpenApplication.Companion.getApplication())+"") |
| | | .addHeader("os", DeviceUtil.isHarmonyOS()? "harmony" : "android"); |
| | | /*if(UserBean.getUser() != null){ |
| | | requestBuild.addHeader("token", UserBean.getUser().getToken()); |
| | |
| | | |
| | | protected String encryptJson(String json){ |
| | | try { |
| | | return RSAUtils.encrypt(json,RSAUtils.getPublicKey(RSAUtils.PUBLIC_KEY)); |
| | | return RSAUtils.encrypt(json); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |