自定义短信模板

master
戴余标 2 years ago
parent 09f93e1996
commit d93f50e318

@ -6,12 +6,11 @@ class API {
///HOST
static String get host {
if (DevEV.instance.dev) {
// return 'http://10.0.2.2:8088/';
return 'http://api.dxbs.vip';
return 'http://10.0.2.2:8088/';
// return 'http://api.dxbs.vip';
} else {
// return 'http://10.0.2.2:8088/';
return 'http://api.dxbs.vip/';
return 'http://10.0.2.2:8088/';
// return 'http://api.dxbs.vip/';
}
}
@ -48,6 +47,8 @@ class _App {
String get delete => '/app/user/content/delete';
///
String get checked => '/app/user/content/checked';
///
String get find => '/app/user/content/find';
///VIP
String get updateVip => '/app/user/updateVip';
}

@ -74,7 +74,7 @@ class _MyAppState extends State<MyApp> {
// final service = FlutterBackgroundService();
_Getpermission();
registerWxApi(
appId: "wxd930ea5d5a228f5f",
appId: "wx3a0b41d12afef4e2",
// universalLink:"http://api.dxbs.vip/ "
);
}

@ -10,11 +10,13 @@ import '../utils/toast/cloud_toast.dart';
class UserProvider extends ChangeNotifier {
bool _isLogin = false;
bool get isLogin => _isLogin;
late UserInfoModel _userInfo;
UserInfoModel get userInfo => _userInfo;
late String _contentCon;
String get contentCon=>_contentCon;
late String _contentRef;
String get contentRef=>_contentRef;
Future<bool> init() async {
if (HiveStore.appBox?.containsKey('token') ?? false) {
@ -29,14 +31,14 @@ class UserProvider extends ChangeNotifier {
}
}
Future setToken(String token, {User? user}) async {
apiClient.setToken(token);
await HiveStore.appBox!.put('token', token);
_isLogin = true;
//app
await updateUserInfo();
await updateConSms();
await updateRefSms();
}
Future logout() async {
@ -55,4 +57,24 @@ class UserProvider extends ChangeNotifier {
}
notifyListeners();
}
Future updateConSms() async {
var base = await apiClient.request(API.app.find,data: {'status': 1});
if (base.code == 0) {
_contentCon = base.data['content'];
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
Future updateRefSms() async {
var base = await apiClient.request(API.app.find,data: {'status': 2});
if (base.code == 0) {
_contentRef = base.data['content'];
} else {
CloudToast.show(base.msg);
}
notifyListeners();
}
}

@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart';
import 'package:project_telephony/utils/user_tool.dart';
import 'package:telephony/telephony.dart';
@ -53,7 +54,7 @@ void onStart(ServiceInstance service ) async {
Timer.periodic(const Duration(seconds: 1), (timer) async {
CallState state = await Telephony.instance.callState;
callState = state.name;
// print(callState!+" $flag");
print(123);
if (callState == "IDLE") {
if (flag != 0) {
flag = 0;
@ -68,7 +69,7 @@ void onStart(ServiceInstance service ) async {
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "接通了");
}else{
print("没接通");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: "没接通");
Telephony.backgroundInstance.sendSms(to: phoneNum!, message: UserTool.userProvider.contentCon);
// print('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.first.timestamp!)}');//
// print("你好$phoneNum");
// // final inbox = telephony.getInboxSms();
@ -83,6 +84,7 @@ void onStart(ServiceInstance service ) async {
// print('flag $flag');
} else if (callState == "OFFHOOK") {
flag++;
flag*=-1;
// print('flag $flag');
}
});

@ -111,6 +111,7 @@ class _ContentConnectPageState extends State<ContentConnectPage> {
if (res.code == 0) {
setState(() {});
UserTool.userProvider.updateUserInfo();
UserTool.userProvider.updateConSms();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);

@ -112,6 +112,7 @@ class _ContentRefusePageState extends State<ContentRefusePage> {
if (res.code == 0) {
setState(() {});
userProvider.updateUserInfo();
userProvider.updateRefSms();
_easyRefreshController.callRefresh();
} else {
CloudToast.show(res.msg);

@ -36,16 +36,12 @@ class _LoadingState extends State<Loading> {
Future.delayed(const Duration(milliseconds: 1000), () async {
await initialAll();
if (!await userProvider.init()) {
await Get.offAll(() => const LoginPage());
await Get.offAll(() => const TabNavigator());
// await Get.offAll(() => const LoginPage());
} else {
await Get.offAll(() => const TabNavigator());
}
});
Future.delayed(const Duration(seconds: 3),(){
//3
Navigator.of(context).pushReplacementNamed("/TabNavigator");
});
}
@override

@ -36,7 +36,7 @@ final Telephony telephony = Telephony.instance;
class _UserPageState extends State<UserPage> {
// bool vle = PermissionStatus.denied.isGranted;
//bool vle =PermissionStatus.denied.isGranted;
// final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
bool isVip = false;
String? endDate;

@ -36,11 +36,7 @@ class SortWidget extends StatelessWidget {
required this.childAspectRatio,
this.haveButton = false,
required this.pickItem});
// @override
// void initState() {
// super.initState();
// }
@override
Widget build(BuildContext context) {

Loading…
Cancel
Save