From 548dce0bcff06ee7a1795defe8e7789b9d7aad94 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 25 四月 2025 16:52:50 +0800
Subject: [PATCH] refactor(nfc): 重构 NFC 读写助手类并优化相关功能

---
 generallibrary/src/main/java/com/dayu/general/activity/LoginActivity.kt |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/generallibrary/src/main/java/com/dayu/general/activity/LoginActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/LoginActivity.kt
index 762fc90..0ba2d6c 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/LoginActivity.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/LoginActivity.kt
@@ -1,9 +1,11 @@
 package com.dayu.general.activity
 
-import android.content.Context
+import android.app.Activity
+import android.content.Intent
 import com.dayu.baselibrary.net.subscribers.SubscriberListener
 import com.dayu.baselibrary.utils.ToastUtil
-import com.dayu.general.bean.net.SearchUserResult
+import com.dayu.general.BaseApplication
+import com.dayu.general.bean.net.LoginResult
 import com.dayu.general.net.ApiManager
 import com.dayu.general.net.BaseResponse
 
@@ -16,7 +18,7 @@
 
     companion object {
         @JvmStatic
-        fun login(phone: String, password: String, myContext: Context) {
+        fun login(phone: String, password: String, myContext: Activity) {
             val map = mutableMapOf<String, Any>()
 
             if (phone.isNotEmpty()) {
@@ -27,18 +29,22 @@
                 map["password"] = password
             }
 
-            map["orgTag"] = "ym"
+            map["orgTag"] = BaseApplication.tag
 
             // 浣跨敤姝g‘鐨勭被鍨嬪弬鏁�
             ApiManager.getInstance().requestPostLoading(
                 myContext,
                 "sso/sso/loginJson",
-                SearchUserResult::class.java,
+                LoginResult::class.java,
                 map,
-                object : SubscriberListener<BaseResponse<SearchUserResult>>() {
-                    override fun onNext(t: BaseResponse<SearchUserResult>) {
+                object : SubscriberListener<BaseResponse<LoginResult>>() {
+                    override fun onNext(t: BaseResponse<LoginResult>) {
                         if (t.success) {
-
+                            BaseApplication.token = t.content?.token ?: ""
+                            BaseApplication.userId = t.content?.id ?: ""
+                            val intent = Intent(myContext, MainActivity::class.java)
+                            myContext.startActivity(intent)
+                            myContext.finish()
                         } else {
                             // 澶勭悊鎼滅储澶辫触鐨勬儏鍐�
                             ToastUtil.show(t.msg)

--
Gitblit v1.8.0