1
0

2 کامیت‌ها 40d1bc4827 ... 1be1092eca

نویسنده SHA1 پیام تاریخ
  Administrator 1be1092eca Merge branch 'master' of http://zhi-edu.com:3000/lan/zedu_client 3 سال پیش
  Administrator 63e5bc8a7b shuhao 3 سال پیش

+ 8 - 0
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/zedu/cocos/congming/app/device/DevicePrefs.java

@@ -1,5 +1,6 @@
 package com.zedu.cocos.congming.app.device;
 
+import org.androidannotations.annotations.sharedpreferences.DefaultInt;
 import org.androidannotations.annotations.sharedpreferences.DefaultString;
 import org.androidannotations.annotations.sharedpreferences.SharedPref;
 
@@ -8,4 +9,11 @@ public interface DevicePrefs {
 
     @DefaultString("")
     String deviceId();
+
+    /**
+     * 设备状态 1禁用 0未禁用
+     * @return
+     */
+    @DefaultInt(0)
+    int status();
 }

+ 2 - 2
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/zedu/cocos/congming/app/request/OkgoApi.java

@@ -5,8 +5,8 @@ package com.zedu.cocos.congming.app.request;
  */
 public class OkgoApi {
 
-    public static final String HOST = "api.zhi-edu.com";
-//     public static final String HOST = "192.168.0.120";
+//    public static final String HOST = "api.zhi-edu.com";
+     public static final String HOST = "192.168.0.120";
 
     // ============公共
 

+ 5 - 1
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/zedu/cocos/congming/page/activate/ActivateActivity.java

@@ -56,7 +56,7 @@ public class ActivateActivity extends ZeduFragmentActivity {
 
     QMUICommonListItemView productItem1, productItem2;
 
-    QMUICommonListItemView activateItem1, activateItem2, activateItem3, activateItem4;
+    QMUICommonListItemView activateItem1, activateItem2, activateItem3, activateItem4, activateItem5;
 
     String deviceId;
 
@@ -102,12 +102,14 @@ public class ActivateActivity extends ZeduFragmentActivity {
         activateItem2 = mBinding.qglv.createItemView("过期时间");
         activateItem3 = mBinding.qglv.createItemView("激活类型");
         activateItem4 = mBinding.qglv.createItemView("激活状态");
+        activateItem5 = mBinding.qglv.createItemView("设备状态");
         QMUIGroupListView.newSection(this)
                 .setTitle("激 活")
                 .addItemView(activateItem1, v -> copyToClipBoard())
                 .addItemView(activateItem2, v -> copyToClipBoard())
                 .addItemView(activateItem3, v -> copyToClipBoard())
                 .addItemView(activateItem4, v -> copyToClipBoard())
+                .addItemView(activateItem5, v -> copyToClipBoard())
                 .addTo(mBinding.qglv);
     }
 
@@ -159,6 +161,8 @@ public class ActivateActivity extends ZeduFragmentActivity {
         activateItem3.setDetailText(activate.getTypeFormat());
         // 激活状态
         activateItem4.setDetailText(activate.getStateFormat());
+        // 设备状态
+        activateItem5.setDetailText(mDevicePrefs.status().get() == 1 ? "禁用" : "启用");
         //
         if (mBinding.srl.isRefreshing()) {
             mBinding.srl.setRefreshing(false);

+ 23 - 1
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/com/zedu/cocos/congming/page/launcher/LauncherActivity.java

@@ -81,6 +81,7 @@ public class LauncherActivity extends BaseFragmentActivity {
     @Bean(OrganClientZedu.class)
     OrganClient mOrganClient;
     public static String deviceId;
+    private boolean nextStartExit = false;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -129,6 +130,9 @@ public class LauncherActivity extends BaseFragmentActivity {
     protected void onStart() {
         super.onStart();
         initPermission();
+        if(nextStartExit) {
+            finish();
+        }
     }
 
     public void gotoMain() {
@@ -142,6 +146,13 @@ public class LauncherActivity extends BaseFragmentActivity {
             DeviceActivity_.intent(this).start();
             return;
         }
+
+        //判断设备是否被禁用
+        if(mDevicePrefs.status().get() == 1){
+            DeviceActivity_.intent(this).start();
+            return;
+        }
+
         // 获取激活信息
         String cacheKey = String.format("activate-%s-%s", deviceId, item.productId);
         CacheEntity<?> cacheEntity = CacheManager.getInstance().get(cacheKey);
@@ -211,6 +222,17 @@ public class LauncherActivity extends BaseFragmentActivity {
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void initEvent(Object object) {
         super.initEvent(object);
+        //此处验证设备是否被禁用
+        if (object instanceof DeviceEvent) {
+            DeviceEntity.DeviceRegisterEntity entity = ((DeviceEvent) object).device;
+            mDevicePrefs.status().put(entity.status);
+            if(entity.status == 1){
+                ActivateActivity_.intent(this).packageName(APP_COCOS_CMB_ID).start();
+                return;
+            }
+        }
+
+        //此处验证机构是否欠费
         if (object instanceof ArrearsEvent) {
             OrganEntity entity = ((ArrearsEvent) object).organ;
             if (entity == null || entity.isArrears.equals(1)) {
@@ -245,7 +267,7 @@ public class LauncherActivity extends BaseFragmentActivity {
     public void startAppActivity() {
         Intent intent = new Intent(this, AppActivity.class);
         this.startActivity(intent);
-        finish();
+        nextStartExit = true;
     }
 
 }

+ 22 - 5
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/AppActivity.java

@@ -24,6 +24,8 @@
  ****************************************************************************/
 package org.cocos2dx.javascript;
 
+import org.androidannotations.annotations.sharedpreferences.Pref;
+import org.androidannotations.api.sharedpreferences.IntPrefField;
 import org.cocos2dx.lib.Cocos2dxActivity;
 import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
 
@@ -66,13 +68,17 @@ import androidx.core.os.EnvironmentCompat;
 
 import com.lzy.okgo.cache.CacheEntity;
 import com.lzy.okgo.db.CacheManager;
+import com.lzy.okgo.model.HttpParams;
 import com.orhanobut.logger.Logger;
 import com.zedu.R;
 import com.zedu.cocos.congming.app.device.DeviceEntity;
+import com.zedu.cocos.congming.app.device.DevicePrefs_;
 import com.zedu.cocos.congming.component.apk.ApkInfo;
 import com.zedu.cocos.congming.page.activate.ActivateActivity_;
+import com.zedu.cocos.congming.page.device.DeviceActivity_;
 import com.zedu.cocos.congming.page.launcher.LauncherActivity;
 import com.zedu.cocos.congming.page.launcher.LauncherActivity_;
+import com.zedu.support.request.OkgoClientCache;
 import com.zedu.support.request.response.BaseResponse;
 
 import java.io.File;
@@ -90,7 +96,7 @@ public class AppActivity extends Cocos2dxActivity {
     private static Cocos2dxActivity sCocos2dxActivity;
     private static ImageView sSplashBgImageView = null;
     public static Toast mToast;
-    private boolean checkActivity = false;
+    private boolean checkActivity = true;
     public static Uri faceImageUri;
     // 用于保存图片的文件路径,Android 10以下使用图片路径访问图片
     private String mCameraImagePath;
@@ -126,7 +132,7 @@ public class AppActivity extends Cocos2dxActivity {
                     e.printStackTrace();
                 }
                 this.runOnUiThread(() -> {
-                    checkActivity();
+                    checkActivityAndDeviceStatus();
                 });
             }
         }).start();
@@ -162,14 +168,14 @@ public class AppActivity extends Cocos2dxActivity {
     }
 
     /**
-     * 检查激活信息
+     * 检查激活信息和设备状态
      */
-    public void checkActivity() {
+    public void checkActivityAndDeviceStatus() {
         if (!checkActivity) {
             Logger.d("激活验证开关未开启");
             return;
         }
-        Logger.d("开始验证激活信息");
+
         // 获取设备信息
         ApkInfo item = new ApkInfo("聪明宝", R.mipmap.ic_launcher, APP_COCOS_CMB_ID, APP_COCOS_CMB_BIND);
         if (StringUtils.isEmpty(LauncherActivity.deviceId)) {
@@ -177,6 +183,17 @@ public class AppActivity extends Cocos2dxActivity {
             LauncherActivity_.intent(this).start();
             return;
         }
+
+        Logger.d("开始验证设备状态");
+        // 获取设备信息
+        Integer status = getSharedPreferences("DevicePrefs", 0).getInt("status",0);
+        if(status == 1){
+            Logger.d("跳转到LauncherActivity_");
+            DeviceActivity_.intent(this).start();
+            return;
+        }
+
+        Logger.d("开始验证激活信息");
         // 获取激活信息
         String cacheKey = String.format("activate-%s-%s", LauncherActivity.deviceId, item.productId);
         CacheEntity<?> cacheEntity = CacheManager.getInstance().get(cacheKey);