王亚玲 2 years ago
commit de66471af6

@ -27,7 +27,6 @@ class UserProvider extends ChangeNotifier {
String get contentRef => _contentRef;
Future<bool> init() async {
if (HiveStore.appBox?.containsKey('token') ?? false) {
final token = HiveStore.appBox?.get('token') as String;
@ -75,29 +74,37 @@ class UserProvider extends ChangeNotifier {
Future updateConSms() async {
final prefs = await SharedPreferences.getInstance();
final service=FlutterBackgroundService();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 1});
if (base.code == 0) {
await prefs.remove('conSms');
await prefs.setString('conSms', 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 updateRefSms() async {
final prefs = await SharedPreferences.getInstance();
final service=FlutterBackgroundService();
final service = FlutterBackgroundService();
var base = await apiClient.request(API.app.find, data: {'status': 2});
if (base.code == 0) {
await prefs.remove('refSms');
print(base.data['content']);
await prefs.setString('refSms', base.data['content']);
print(prefs.getString('refSms'));
service.invoke("stopService");
if(prefs.getBool('kg')!){
Future.delayed(const Duration(seconds: 1), () async {
service.startService();
});
}
} else {
CloudToast.show(base.msg);
}

@ -117,7 +117,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
CloudToast.show(res.msg);
}
} else {
if (UserTool.userProvider.isLogin) {
if (UserTool.userProvider.userInfo.isVip==1) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
@ -129,7 +129,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
));
}
} else {
BotToast.showText(text: '请先登录');
BotToast.showText(text: '请先开通会员');
}
}
setState(() {});

@ -118,7 +118,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
CloudToast.show(res.msg);
}
} else {
if (userProvider.isLogin) {
if (userProvider.userInfo.isVip==1) {
if (textListSMS.length > 5) {
BotToast.showText(text: '自定义数量已达上限,请先删除不需要的短信');
} else {
@ -130,7 +130,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
));
}
} else {
BotToast.showText(text: '请先登录');
BotToast.showText(text: '请先开通会员');
}
}
setState(() {});

Loading…
Cancel
Save