master
戴余标 2 years ago
parent 4925905faf
commit 30fa9d8b57

@ -75,7 +75,7 @@ class UserProvider extends ChangeNotifier {
notifyListeners();
}
Future updateConSms(int num ) async {
Future updateConSms() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 1});
@ -121,6 +121,52 @@ class UserProvider extends ChangeNotifier {
notifyListeners();
}
Future updateSms() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 2});
if (base.code == 0) {
await prefs.remove('refSms');
await prefs.setString(
'refSms',
(UserTool.userProvider.userInfo.tag) == ""
? "${base.data['content']}"
: "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
service.invoke("stopService");
if (prefs.getBool('kg')!) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future updateIdleSms() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.content.find, data: {'status': 2});
if (base.code == 0) {
await prefs.remove('refSms');
await prefs.setString(
'refSms',
(UserTool.userProvider.userInfo.tag) == ""
? "${base.data['content']}"
: "${UserTool.userProvider.userInfo.tag}${base.data['content']}");
service.invoke("stopService");
if (prefs.getBool('kg')!) {
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future getExclude() async {
final prefs = await SharedPreferences.getInstance();
final service = FlutterBackgroundService();

@ -2,7 +2,6 @@ import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:project_telephony/ui/home/func/contant_func.dart';
import 'package:project_telephony/utils/headers.dart';
import 'package:provider/provider.dart';
@ -21,7 +20,6 @@ class AnswerIdleList extends StatefulWidget {
final EasyRefreshController refreshController;
final bool isIdle;
final int num;
// final List contant;
const AnswerIdleList(
{Key? key, required this.refreshController, required this.isIdle,required this.num})
@ -61,7 +59,6 @@ class _AnswerIdleListState extends State<AnswerIdleList>
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
answerList=await ContantFunc.getFindByStatus(widget.num);
print("这是数据$answerList");
// userProvider.updateRefSms();
// updateList();
@ -85,7 +82,6 @@ class _AnswerIdleListState extends State<AnswerIdleList>
// footer: MaterialFooter(),
onRefresh: () async {
await userProvider.updateUserInfo();
answerList=await ContantFunc.getFindByStatus(widget.num);
print("这是数据$answerList");
// userProvider.updateRefSms();
// updateList();
@ -166,7 +162,7 @@ class _AnswerIdleListState extends State<AnswerIdleList>
return GestureDetector(
onTap: () async {
if (item.content != "自定义短信内容") {
BaseModel res = await apiClient.request(API.app.checked,
BaseModel res = await apiClient.request(API.content.checked,
data: {'id': item.id, 'status': 1});
if (res.code == 0) {
setState(() {});

@ -112,7 +112,6 @@ final FocusNode verifyNode=FocusNode();
widget.ploneBack(_controller.text);
UserTool.userProvider.updateUserInfo();
UserTool.userProvider.updateConSms();
UserTool.userProvider.updateRefSms();
Get.back();
} else {
CloudToast.show(res.msg);

Loading…
Cancel
Save