瀏覽代碼

新增访问接口请求头currentTime

Administrator 2 年之前
父節點
當前提交
b0dceabf7f

+ 5 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/zedu/cocos/congming/app/organ/OrganClientZedu.java

@@ -5,6 +5,8 @@ import com.lzy.okgo.model.HttpParams;
 import com.lzy.okgo.model.Response;
 import com.zedu.cocos.congming.app.device.DeviceClient;
 import com.zedu.cocos.congming.app.device.DeviceClientZedu;
+import com.zedu.cocos.congming.app.time.TimeClient;
+import com.zedu.cocos.congming.app.time.TimeClientZedu;
 import com.zedu.core.global.ErrorEvent;
 import com.zedu.support.request.OkgoClient;
 import com.zedu.support.request.OkgoTask;
@@ -31,6 +33,8 @@ public class OrganClientZedu extends OkgoTask implements OrganClient {
     DeviceClient mDeviceClient;
     @Pref
     OrganPrefs_ mOrganPrefs;
+    @Bean(TimeClientZedu.class)
+    TimeClient mTimeClient;
 
     @Override
     public void login(String key, String androidId) {
@@ -48,6 +52,7 @@ public class OrganClientZedu extends OkgoTask implements OrganClient {
                 if (code == ResponseCode.RES_SUCCESS) {
                     if (result.data != null) {
                         mBus.post(new OrganEvent(result.data));
+                        mTimeClient.updateLastTime();
                         mDeviceClient.register(result.data.organKey);
                     }
                 } else if (code == ResponseCode.RES_Try) {

+ 1 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/lib_core/src/main/java/com/zedu/support/request/OkgoClientCache.java

@@ -104,6 +104,7 @@ public class OkgoClientCache {
         String key = MD5Coder.getMD5Code(url + "?" + SignParams.getSortParams(params));
         // 构造请求
         OkGo.<T>post(url)// 地址
+                .headers("currentTime",Long.toString(System.currentTimeMillis()))
                 .params(params)// 参数
                 .cacheKey(StringUtils.isEmpty(cacheKey) ? key : cacheKey)// 缓存key
                 .cacheMode(cacheMode) // 缓存模式