|
@@ -55,7 +55,7 @@ class TurnChainUtil { |
|
|
/// 微盘: sinavdisk:// |
|
|
/// 微盘: sinavdisk:// |
|
|
/// 名片全能王: camcard:// |
|
|
/// 名片全能王: camcard:// |
|
|
/// |
|
|
/// |
|
|
static Future<void> openReceiveCoupon(BuildContext context, UserInfoModel userInfoModel, String goodsId, String provider, Map<String, dynamic> data, {bool isFree=false}) async { |
|
|
|
|
|
|
|
|
static Future<void> openReceiveCoupon(BuildContext context, UserInfoModel userInfoModel, String goodsId, String provider, Map<String, dynamic> data, {bool isFree = false}) async { |
|
|
///iOS 审核状态 |
|
|
///iOS 审核状态 |
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
String is_ios_review = await SharedPreferencesUtil.getStringValue(GlobalConfig.IS_IOS_REVIEW, defaultVal: '0'); |
|
|
|
|
|
|
|
@@ -119,25 +119,25 @@ class TurnChainUtil { |
|
|
case GlobalConfig.PROVIDER_KL: |
|
|
case GlobalConfig.PROVIDER_KL: |
|
|
case GlobalConfig.PROVIDER_PDD: |
|
|
case GlobalConfig.PROVIDER_PDD: |
|
|
case GlobalConfig.PROVIDER_SN: |
|
|
case GlobalConfig.PROVIDER_SN: |
|
|
bool launchable = await canLaunch(appUrl); |
|
|
|
|
|
if (Platform.isIOS) { |
|
|
|
|
|
launchable = await launch(appUrl); |
|
|
|
|
|
} |
|
|
|
|
|
if (launchable) { |
|
|
|
|
|
if (!Platform.isIOS) { |
|
|
|
|
|
if(appUrl.startsWith("suning")){ |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
}else{ |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
|
|
|
bool launchable = await canLaunch(appUrl); |
|
|
|
|
|
if (Platform.isIOS) { |
|
|
|
|
|
launchable = await launch(appUrl); |
|
|
|
|
|
} |
|
|
|
|
|
if (launchable) { |
|
|
|
|
|
if (!Platform.isIOS) { |
|
|
|
|
|
if (appUrl.startsWith("suning")) { |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} else { |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} else if (!EmptyUtil.isEmpty(webUrl)) { |
|
|
|
|
|
Logger.log('打开${provider} webUrl, url = ${webUrl}'); |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} else { |
|
|
|
|
|
Fluttertoast.cancel(); |
|
|
|
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
} |
|
|
} |
|
|
} else if (!EmptyUtil.isEmpty(webUrl)) { |
|
|
|
|
|
Logger.log('打开${provider} webUrl, url = ${webUrl}'); |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} else { |
|
|
|
|
|
Fluttertoast.cancel(); |
|
|
|
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
break; |
|
|
case GlobalConfig.PROVIDER_VIP: |
|
|
case GlobalConfig.PROVIDER_VIP: |
|
|
bool launchable = await canLaunch(appUrl); |
|
|
bool launchable = await canLaunch(appUrl); |
|
@@ -156,6 +156,28 @@ class TurnChainUtil { |
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
if (!EmptyUtil.isEmpty(openAppUrl)) { |
|
|
|
|
|
bool launchable = await canLaunch(appUrl); |
|
|
|
|
|
if (launchable) { |
|
|
|
|
|
launchable = await launch(appUrl); |
|
|
|
|
|
} |
|
|
|
|
|
if (launchable) { |
|
|
|
|
|
if (!Platform.isIOS) { |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} |
|
|
|
|
|
} else if (!EmptyUtil.isEmpty(webUrl)) { |
|
|
|
|
|
Logger.log('打开${provider} webUrl, url = ${webUrl}'); |
|
|
|
|
|
RouterUtil.openWebview(webUrl, context); |
|
|
|
|
|
} else { |
|
|
|
|
|
Fluttertoast.cancel(); |
|
|
|
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
Fluttertoast.cancel(); |
|
|
|
|
|
Fluttertoast.showToast(msg: '购买链接不存在'); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
Fluttertoast.cancel(); |
|
|
Fluttertoast.cancel(); |
|
@@ -187,7 +209,7 @@ class TurnChainUtil { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// 3、获取转链的结果 |
|
|
/// 3、获取转链的结果 |
|
|
Map<String, dynamic> result = await getTurnChainResult(context, goodsId, provider, data, isShare: true ); |
|
|
|
|
|
|
|
|
Map<String, dynamic> result = await getTurnChainResult(context, goodsId, provider, data, isShare: true); |
|
|
if (!EmptyUtil.isEmpty(result) && !EmptyUtil.isEmpty(result['open_app_url'])) { |
|
|
if (!EmptyUtil.isEmpty(result) && !EmptyUtil.isEmpty(result['open_app_url'])) { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
@@ -232,8 +254,8 @@ class TurnChainUtil { |
|
|
data['is_share'] = isShare ? '1' : '0'; |
|
|
data['is_share'] = isShare ? '1' : '0'; |
|
|
|
|
|
|
|
|
///1为免单,0为普通 |
|
|
///1为免单,0为普通 |
|
|
data['is_free'] = (isFree??false) ? "1" : "0"; |
|
|
|
|
|
(isFree??false) ? print("免单") : print("普通"); |
|
|
|
|
|
|
|
|
data['is_free'] = (isFree ?? false) ? "1" : "0"; |
|
|
|
|
|
(isFree ?? false) ? print("免单") : print("普通"); |
|
|
|
|
|
|
|
|
if (EmptyUtil.isEmpty(model)) { |
|
|
if (EmptyUtil.isEmpty(model)) { |
|
|
// 开启loading |
|
|
// 开启loading |
|
|