浏览代码

完善中医支付体系

carlos 1 年之前
父节点
当前提交
a65905bea1

+ 1 - 1
app/android/app/src/main/kotlin/com/yak/app/tcm/NativeTCMApiImpl.kt

@@ -68,7 +68,7 @@ class NativeTCMApiImpl(private val context: Context, private val flutterEngine:
 
     override fun isPay(): Boolean {
         Log.d(TAG, "tcm isPay")
-        return LibSktcm.isPay
+        return LibSktcm.isPay()
     }
 
     override fun startPayActivity() {

+ 8 - 2
app/lib/module/health/health_controller.dart

@@ -39,7 +39,7 @@ import 'models/health_model.dart';
 
 class HealthController extends GetxController with WatchRequestOption {
   final api = HealthApi();
-  var unlock = true.obs; //true 解锁中医诊脉 false 未解锁
+  var unlock = false.obs; //true 解锁中医诊脉 false 未解锁
   var tcmLogin = false; //中医登录
   StreamSubscription? _streamSubscription;
   final HostTCMApi hostTCMApi = HostTCMApi();
@@ -119,7 +119,11 @@ class HealthController extends GetxController with WatchRequestOption {
     var userId = GlobalConfig.prefs.getString(PreferenceConst.USER_ID) ?? '';
     mac = GlobalConfig.prefs.getString(PreferenceConst.PRE_DEVICE_MAC) ?? '';
 
-    if (token.isEmpty || userId.isEmpty || mac.isEmpty || !connectCore.deviceConnected.value) {
+    if (token.isEmpty ||
+        userId.isEmpty ||
+        mac.isEmpty ||
+        !connectCore.deviceConnected.value) {
+      debugPrint('*** didnot connected, return ***');
       return;
     }
     var sex = '男';
@@ -140,6 +144,8 @@ class HealthController extends GetxController with WatchRequestOption {
         userId, mac, sex, birthday, height, weight, token);
     tcmLogin = await hostTCMApi.login();
     if (tcmLogin) {
+      bool isPay = await hostTCMApi.isPay();
+      unlock.value = isPay;
       var tcmLevels = await hostTCMApi.getRecentReport();
       if (tcmLevels == null ||
           tcmLevels.healthPoints == null ||