This commit is contained in:
mazengfei
2026-03-30 18:03:01 +08:00
parent 5c230e38c3
commit ee9f27bb9c
3 changed files with 34 additions and 14 deletions
@@ -154,9 +154,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private var isStartRecognize = false
//0-联合支付,1-独立支付
val settlementMode by lazy {
SPUtil.getInstance().get(GlobalKey.KEY_SETTLEMENT_MODE, 1)
}
var settlementMode: Int = 1
// val settlementMode by lazy {
// SPUtil.getInstance().get(GlobalKey.KEY_SETTLEMENT_MODE, 1)
// }
override fun getViewModel(): BaseViewModel {
return viewModel
@@ -192,7 +193,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
return@runOnUiThread
}
//结算模式:1-独立支付,2-联合结算
val settlementMode = if (deviceConfig.payType == 2) 0 else 1
settlementMode = if (deviceConfig.payType == 2) 0 else 1
SPUtil.getInstance().put(GlobalKey.KEY_SETTLEMENT_MODE, settlementMode)
GlobalData.appId = deviceConfig.arcsoftAppId ?: ""
@@ -4,6 +4,7 @@ import com.sw.dualscreen.BuildConfig
import com.sw.dualscreen.MyApp
import com.sw.dualscreen.network.api.ApiService
import com.sw.dualscreen.network.interceptor.RequestInterceptor
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
@@ -20,14 +21,20 @@ object ApiClient {
.connectTimeout(TIME_OUT, TimeUnit.SECONDS)
.readTimeout(TIME_OUT, TimeUnit.SECONDS)
.writeTimeout(TIME_OUT, TimeUnit.SECONDS)
.addNetworkInterceptor(HttpLoggingInterceptor(logger = {
Timber.d("okhttp logger ==>${it}")
}).apply {
level = if (BuildConfig.DEBUG) {
HttpLoggingInterceptor.Level.BODY
} else {
HttpLoggingInterceptor.Level.NONE
.addNetworkInterceptor(Interceptor {chain ->
val request = chain.request()
val url = request.url.toString()
val tag = if (url.contains("terminal/neglect/common/app/faceFeature/increment/list")) "faceIncrement" else "ApiClient"
val loggingInterceptor = HttpLoggingInterceptor(logger = {
Timber.tag(tag).d("okhttp logger ==>${it}")
}).apply {
level = if (BuildConfig.DEBUG) {
HttpLoggingInterceptor.Level.BODY
} else {
HttpLoggingInterceptor.Level.NONE
}
}
loggingInterceptor.intercept(chain)
})
.addInterceptor(RequestInterceptor())
.build()
@@ -295,6 +295,8 @@ class MainScreenPresentation(
}
}
private var isGoRecognize = true
/**
* 显示识别出的菜品信息
*/
@@ -316,6 +318,7 @@ class MainScreenPresentation(
//独立支队
loadUserNutritionData(userId)
}
step3Debouncer.reset()
}
}
@@ -702,7 +705,7 @@ class MainScreenPresentation(
private var lastAddWeight = 0
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
Log.d(TAG, "addFoodToOrder: ${weight == lastAddWeight}")
if (weight == lastAddWeight) return
// if (weight == lastAddWeight) return
lastAddWeight = weight
if (weight <= 10) {
//0-即放即取,1-余量计量
@@ -922,9 +925,15 @@ class MainScreenPresentation(
Timber.tag(TAG).d("resumeCamera isRecognition = $isRecognition")
isRecognition = true
if (rgbCameraHelper == null) {
Timber.tag(TAG).d("resumeCamera isRecognition ---1")
setupArcCamera()
rgbCameraHelper!!.start()
binding.root.postDelayed({
if (rgbCameraHelper != null) {
rgbCameraHelper!!.start()
}
}, 2000)
} else if (rgbCameraHelper!!.isStopped) {
Timber.tag(TAG).d("resumeCamera isRecognition ---2")
rgbCameraHelper!!.start()
}
}
@@ -1000,9 +1009,12 @@ class MainScreenPresentation(
activity,
Observer { compareResult: CompareResult ->
if (currentStep != 2 || System.currentTimeMillis() - recognizeTime <= 2000) {
//忽略非识别中及秒内的再次识别
//忽略非识别中及5秒内的再次识别
return@Observer
}
// if (isGoRecognize.not()) {
// return@Observer
// }
recognizeTime = System.currentTimeMillis()
activity.runOnUiThread {
activity.showWaitingDialog("加载中,请稍后……")