副屏
This commit is contained in:
1 parent
154122a847
commit
2e929c199b
21 files changed
+5517
-85
No files matched your search
@@ -376,6 +376,8 @@ mixin OrderMixin {
|
||||
sqlOrderDetail.payTime = DateTime.now();
|
||||
await orderDao.edit(sqlOrderDetail);
|
||||
if (orderPayType.value != OrderPayType.WALLET_QR_CODE_SCAN) {
|
||||
// 支付结果已落库,副屏通知只能尽力发送,不能等待其回执阻塞主屏订单收尾。
|
||||
unawaited(sendSubScreenPaySuccess());
|
||||
if (sqlOrderDetail.payPrice != 0) {
|
||||
final price = AppPriceTool.fenToYuan(sqlOrderDetail.payPrice);
|
||||
TtsManage.speak("购买成功总金额$price元");
|
||||
@@ -513,6 +515,27 @@ mixin OrderMixin {
|
||||
);
|
||||
}
|
||||
|
||||
/// 尽力通知副屏展示通用支付成功页,不参与主屏订单成功与否的判定。
|
||||
///
|
||||
/// 副屏收到后保留商品与金额并展示成功提示,十秒倒计时结束自动清屏回欢迎页;
|
||||
/// 使用原生单向通道规避双屏插件业务消息不回包的问题,并限制等待时间。
|
||||
Future<void> sendSubScreenPaySuccess() async {
|
||||
try {
|
||||
final delivered = await AppRuntimeTool.sendViceMessage(
|
||||
SubScreenAction.orderPaySuccess.code,
|
||||
).timeout(const Duration(seconds: 1));
|
||||
if (!delivered) {
|
||||
logger.w('|$_tag|副屏不可用,支付成功消息未投递|');
|
||||
}
|
||||
} on TimeoutException {
|
||||
logger.w('|$_tag|通知副屏支付成功超时,主屏继续完成订单收尾|');
|
||||
} catch (error, stack) {
|
||||
logger.e(
|
||||
'|$_tag|通知副屏支付成功失败error:|$error|stack:|$stack|',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> sendSubScreen() async {
|
||||
if (shopCardList.isEmpty) {
|
||||
await SubScreenPlugin.sendMsgToViceScreen(
|
||||
|
||||
Reference in new issue
Block a user