cloudroam
2025-03-31 a7820e2f1ee06a7b43b4d351cced3343d7e1a5e2
app/src/main/java/com/example/firstapp/MainActivity.kt
@@ -26,6 +26,7 @@
import com.example.firstapp.database.entity.Code
import com.example.firstapp.database.entity.Msg
import com.example.firstapp.database.service.RetrofitClient
import com.example.firstapp.database.service.RetrofitModelClient
import com.example.firstapp.ui.home.HomeViewModel
import com.example.firstapp.utils.Log
import com.example.firstapp.workers.KeywordUpdateWorker
@@ -256,7 +257,7 @@
                    CoroutineScope(Dispatchers.IO).launch {
                        try {
                            // API调用移到synchronized块外
                            val response = RetrofitClient.apiService.processSms(mapOf("content" to messageBody))
                            val response = RetrofitModelClient.modelService.processSms(mapOf("content" to messageBody))
                            
                            // 数据库操作放在synchronized块内
                            synchronized(syncLock) {