cloudroam
2025-04-01 acda5f7095fd8ccc2d6d86129d1e7f8cff2f5e4e
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) {