Commit 05090e8c0b572ea284d3f1ff293d53a2d1dd9d77

Authored by weixin_45529955
1 parent a52a03d1

发短信防抖

@@ -457,7 +457,7 @@ @@ -457,7 +457,7 @@
457 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 457 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
458 CLANG_ENABLE_MODULES = YES; 458 CLANG_ENABLE_MODULES = YES;
459 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 459 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
460 - CURRENT_PROJECT_VERSION = 5600; 460 + CURRENT_PROJECT_VERSION = 5601;
461 DEVELOPMENT_TEAM = 8J59HM8B82; 461 DEVELOPMENT_TEAM = 8J59HM8B82;
462 ENABLE_BITCODE = NO; 462 ENABLE_BITCODE = NO;
463 INFOPLIST_FILE = Runner/Info.plist; 463 INFOPLIST_FILE = Runner/Info.plist;
@@ -640,7 +640,7 @@ @@ -640,7 +640,7 @@
640 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 640 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
641 CLANG_ENABLE_MODULES = YES; 641 CLANG_ENABLE_MODULES = YES;
642 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 642 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
643 - CURRENT_PROJECT_VERSION = 5600; 643 + CURRENT_PROJECT_VERSION = 5601;
644 DEVELOPMENT_TEAM = 8J59HM8B82; 644 DEVELOPMENT_TEAM = 8J59HM8B82;
645 ENABLE_BITCODE = NO; 645 ENABLE_BITCODE = NO;
646 INFOPLIST_FILE = Runner/Info.plist; 646 INFOPLIST_FILE = Runner/Info.plist;
@@ -666,7 +666,7 @@ @@ -666,7 +666,7 @@
666 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 666 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
667 CLANG_ENABLE_MODULES = YES; 667 CLANG_ENABLE_MODULES = YES;
668 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 668 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
669 - CURRENT_PROJECT_VERSION = 5600; 669 + CURRENT_PROJECT_VERSION = 5601;
670 DEVELOPMENT_TEAM = 8J59HM8B82; 670 DEVELOPMENT_TEAM = 8J59HM8B82;
671 ENABLE_BITCODE = NO; 671 ENABLE_BITCODE = NO;
672 INFOPLIST_FILE = Runner/Info.plist; 672 INFOPLIST_FILE = Runner/Info.plist;
@@ -5341,6 +5341,31 @@ class InvicationPageState extends State<InvicationPage> @@ -5341,6 +5341,31 @@ class InvicationPageState extends State<InvicationPage>
5341 } 5341 }
5342 } 5342 }
5343 5343
  5344 + _send() async {
  5345 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  5346 + Map<String, String?> params = {
  5347 + "rid": widget.rid,
  5348 + "sid": userModel.user!.sellerid
  5349 + };
  5350 +
  5351 + bool success = await couponProvider.sendSMSWxSendSms(context, params);
  5352 + print(success);
  5353 + if (success) {
  5354 + setState(() {
  5355 + smsTitle = '已发${couponProvider.sendSMS}次';
  5356 + });
  5357 + canSendSms = false;
  5358 + startCountdown(120);
  5359 + } else {
  5360 + if (couponProvider.errorSMS != '') {
  5361 + setState(() {
  5362 + showErroInfo = true;
  5363 + erroInfo = couponProvider.errorSMS;
  5364 + });
  5365 + }
  5366 + }
  5367 + }
  5368 +
5344 ///微信通知、发短信 5369 ///微信通知、发短信
5345 Widget _btnWidget() { 5370 Widget _btnWidget() {
5346 return Padding( 5371 return Padding(
@@ -5459,30 +5484,9 @@ class InvicationPageState extends State<InvicationPage> @@ -5459,30 +5484,9 @@ class InvicationPageState extends State<InvicationPage>
5459 showErroInfo = false; 5484 showErroInfo = false;
5460 erroInfo = ''; 5485 erroInfo = '';
5461 }); 5486 });
5462 - UserModel userModel = Provider.of<UserModel>(  
5463 - context,  
5464 - listen: false);  
5465 - Map<String, String?> params = {  
5466 - "rid": widget.rid,  
5467 - "sid": userModel.user!.sellerid  
5468 - };  
5469 - bool success = await couponProvider  
5470 - .sendSMSWxSendSms(context, params);  
5471 - print(success);  
5472 - if (success) {  
5473 - setState(() {  
5474 - smsTitle = '已发${couponProvider.sendSMS}次';  
5475 - });  
5476 - canSendSms = false;  
5477 - startCountdown(120);  
5478 - } else {  
5479 - if (couponProvider.errorSMS != '') {  
5480 - setState(() {  
5481 - showErroInfo = true;  
5482 - erroInfo = couponProvider.errorSMS;  
5483 - });  
5484 - }  
5485 - } 5487 +
  5488 + JhCommonUtils.debounce(() => _send());
  5489 +
5486 // if (success) { 5490 // if (success) {
5487 // Utils.showToast('短信已经发送成功!'); 5491 // Utils.showToast('短信已经发送成功!');
5488 // } else { 5492 // } else {
@@ -5542,29 +5546,8 @@ class InvicationPageState extends State<InvicationPage> @@ -5542,29 +5546,8 @@ class InvicationPageState extends State<InvicationPage>
5542 showErroInfo = false; 5546 showErroInfo = false;
5543 erroInfo = ''; 5547 erroInfo = '';
5544 }); 5548 });
5545 - UserModel userModel =  
5546 - Provider.of<UserModel>(context, listen: false);  
5547 - Map<String, String?> params = {  
5548 - "rid": widget.rid,  
5549 - "sid": userModel.user!.sellerid  
5550 - };  
5551 - bool success = await couponProvider.sendSMSWxSendSms(  
5552 - context, params);  
5553 - print(success);  
5554 - if (success) {  
5555 - setState(() {  
5556 - smsTitle = '已发${couponProvider.sendSMS}次';  
5557 - });  
5558 - canSendSms = false;  
5559 - startCountdown(120);  
5560 - } else {  
5561 - if (couponProvider.errorSMS != '') {  
5562 - setState(() {  
5563 - showErroInfo = true;  
5564 - erroInfo = couponProvider.errorSMS;  
5565 - });  
5566 - }  
5567 - } 5549 +
  5550 + JhCommonUtils.debounce(() => _send());
5568 } 5551 }
5569 } else { 5552 } else {
5570 //显示2分钟只能发1次短信 5553 //显示2分钟只能发1次短信