master
王亚玲 3 years ago
parent e0012622d8
commit 7211d15be2

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -7,8 +7,10 @@ import 'package:flutter/services.dart';
import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_sms/flutter_sms.dart'; import 'package:flutter_sms/flutter_sms.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:fluwx/fluwx.dart' as fluwx;
import 'package:project_telephony/providers/user_provider.dart'; import 'package:project_telephony/providers/user_provider.dart';
import 'package:project_telephony/ui/tab_navigator.dart'; import 'package:project_telephony/ui/tab_navigator.dart';
@ -16,12 +18,14 @@ import 'package:provider/provider.dart';
import 'package:telephony/telephony.dart'; import 'package:telephony/telephony.dart';
import 'package:project_telephony/utils/hive_store.dart'; import 'package:project_telephony/utils/hive_store.dart';
void _sendSMS(String message, List<String> recipents) async { void _sendSMS(String message, List<String> recipients) async {
String _result = await sendSMS(message: message, recipients: recipents) try{
.catchError((onError) { String result =
print(onError); await sendSMS(message: message, recipients: recipients, sendDirect: true);
}); print(result);
print(_result); } on PlatformException catch(e){
print(e.toString());
}
} }
void main() async { void main() async {
@ -60,19 +64,18 @@ void onIosBackground() {
void onStart() { void onStart() {
int flag = 0; int flag = 0;
String? phoneNum, callState; String phoneNum;
String callState;
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
Timer.periodic(const Duration(seconds: 1), (timer) async { Timer.periodic(const Duration(seconds: 1), (timer) async {
CallState state = await Telephony.instance.callState; CallState state = await Telephony.instance.callState;
callState = state.name; callState = state.name;
print(callState!+" $flag"); // print(callState!+" $flag");
if (callState == "IDLE") { if (callState == "IDLE") {
if (flag != 0) { if (flag != 0) {
flag = 0; flag = 0;
// print("object"); // print("object");
final Iterable<CallLogEntry> result = await CallLog.query(); final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number;
// print(phoneNum); // print(phoneNum);
// String message = "This is a test message!"; // String message = "This is a test message!";
// List<String> recipents = ["10000", "10086"]; // List<String> recipents = ["10000", "10086"];
@ -81,18 +84,27 @@ void onStart() {
// print(onError); // print(onError);
// }); // });
// print(_result); // print(_result);
phoneNum = result.first.number; phoneNum = result.first.number!;
print(phoneNum); // List<String> recipents=[
final SmsSendStatusListener listener = (SendStatus status) { // phoneNum
print(status); // ];
}; if(phoneNum.isEmpty){
Phone.telephony.sendSms( print("At Least 1 Person or Message Required");
to: phoneNum!, }else{
message: "hello", print("你好"+phoneNum);
statusListener: listener, _sendSMS("你好", [phoneNum]);
isMultipart: true, print("你好"+phoneNum);
}
); // final SmsSendStatusListener listener = (SendStatus status) {
// print(status);
// };
// Phone.telephony.sendSms(
// to: phoneNum!,
// message: "hello",
// statusListener: listener,
// isMultipart: true,
//
// );
} }
} else if (callState == "RINGING") { } else if (callState == "RINGING") {
flag++; flag++;
@ -121,10 +133,14 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
final service = FlutterBackgroundService(); final service = FlutterBackgroundService();
Future.delayed(const Duration(milliseconds: 0), () async { Future.delayed(const Duration(milliseconds: 0), () async {
//Hive.initFlutter; //Hive.initFlutter;
await HiveStore.init(); await HiveStore.init();
registerWxApi(
appId: "wxd930ea5d5a228f5f",universalLink:"https://your.univerallink.com/link/ "
);
}); });
final inbox = Telephony.instance.getInboxSms(); final inbox = Telephony.instance.getInboxSms();
// JPush jPush=JPush(); // JPush jPush=JPush();

@ -27,6 +27,8 @@ class _ContentPageState extends State<ContentPage> {
int _select = 0; int _select = 0;
List<String> textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容']; List<String> textList = ['欢迎你的来电', '祝您生活愉快', '感谢您的来电我们会尽快处理的', '自定义短信内容'];
List<String> textList1 = ['自定义短信内容']; List<String> textList1 = ['自定义短信内容'];
late String phoneNum;
late String callState;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -71,6 +73,10 @@ class _ContentPageState extends State<ContentPage> {
)); ));
} else { } else {
bool? permissionsGranted = await telephony.requestPhonePermissions; bool? permissionsGranted = await telephony.requestPhonePermissions;
final Iterable<CallLogEntry> result = await CallLog.query();
phoneNum = result.first.number!;
print(phoneNum);
// print(permissionsGranted); // print(permissionsGranted);
// if(permissionsGranted!){ // if(permissionsGranted!){
// print(content); // print(content);
@ -89,20 +95,12 @@ class _ContentPageState extends State<ContentPage> {
// message: content, // message: content,
// isMultipart: true // isMultipart: true
// ); // );
List<String> recipents=["13395740386"]; List<String> recipents=[
phoneNum
];
_sendSMS(content,recipents); _sendSMS(content,recipents);
// CallState state = await telephony.callState; // String phoneNumber = await GetPhoneNumber().get();
// print(state); // print('getPhoneNumber result: $phoneNumber');
// DataState state1 = await telephony.cellularDataState;
// print(state1);
// String? operatorName = await telephony.networkOperatorName;
// print(operatorName);
// NetworkType type = await telephony.dataNetworkType;
// print(type);
// PhoneType type1 = await telephony.phoneType;
// print(type1);
String phoneNumber = await GetPhoneNumber().get();
print('getPhoneNumber result: $phoneNumber');
} }
setState(() {}); setState(() {});
// print("这是数据" + textList[_s lect]); // print("这是数据" + textList[_s lect]);

@ -1,11 +1,16 @@
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/base/base_style.dart';
import 'package:project_telephony/ui/user/members_page.dart';
import 'package:project_telephony/ui/widget/check_radio.dart'; import 'package:project_telephony/ui/widget/check_radio.dart';
import 'package:project_telephony/ui/widget/plone_back_button.dart'; import 'package:project_telephony/ui/widget/plone_back_button.dart';
import 'package:project_telephony/ui/widget/plone_bottom.dart'; import 'package:project_telephony/ui/widget/plone_bottom.dart';
import 'package:project_telephony/ui/widget/putup_widget.dart'; import 'package:project_telephony/ui/widget/putup_widget.dart';
import 'package:project_telephony/utils/headers.dart'; import 'package:project_telephony/utils/headers.dart';
import 'package:tobias/tobias.dart';
import 'package:fluwx/fluwx.dart' as fluwx;
import '../../model/pay/wx_pay_model.dart';
import '../../utils/pay_util.dart';
class MembersPage extends StatefulWidget { class MembersPage extends StatefulWidget {
const MembersPage({Key? key}) : super(key: key); const MembersPage({Key? key}) : super(key: key);
@ -34,10 +39,11 @@ List payWay = [
}, },
{'payName': '支付宝支付', 'payUrl': Assets.icons.zhifubao.path} {'payName': '支付宝支付', 'payUrl': Assets.icons.zhifubao.path}
]; ];
Map a = {};
class _MembersPageState extends State<MembersPage> { class _MembersPageState extends State<MembersPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Stack( body: Stack(
@ -69,7 +75,28 @@ class _MembersPageState extends State<MembersPage> {
PloneBottom( PloneBottom(
border: true, border: true,
onTap: () async { onTap: () async {
if (_selectIndex == 0) {} if(_chooseItem == null){
Get.snackbar('提示', "请先选择充值月份");
}else{
if (_selectIndex == 0) {
_wxPayFunc();
}else{
var result = await isAliPayInstalled(); //
if(!result){
Get.snackbar('提示', "请先安装支付宝");
}else{
aliPay("paySign").then((payResult) {
// map["paySign"]
print("支付宝:" + payResult.toString());
if (payResult['resultStatus'] == '9000') {
Get.snackbar('提示', "充值成功");
} else {
Get.snackbar('提示', payResult['memo']);
}
});
}
}
}
}, },
textColor: const Color(0xFF333333), textColor: const Color(0xFF333333),
text: "立即开通", text: "立即开通",
@ -172,21 +199,61 @@ class _MembersPageState extends State<MembersPage> {
); );
} }
// Future _wxPayFunc() async {
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: { Future _wxPayFunc() async{
// 'count': widget.count, bool isInstalled=await fluwx.isWeChatInstalled;
// 'payType': 2, if(!isInstalled){
// }); BotToast.showText(text: "请先安装微信");
// if (base.code == 0) { return ;
// var wxPayModel = WxPayModel.fromJson(base.data['content']); }
// await PayUtil().callWxPay( //
// payModel: wxPayModel, fluwx.payWithWeChat(
// ); appId: "wxd930ea5d5a228f5f",
partnerId: "partnerId",
prepayId: "prepayId",
packageValue: "packageValue",
nonceStr: "nonceStr",
timeStamp: 1597927308,
sign: "sign");
fluwx.weChatResponseEventHandler.listen((event) { if(event.isSuccessful){
BotToast.showText(text: "微信支付成功");
}else{
BotToast.showText(text: "微信支付失败");
}
});
// var wxPayModel = WxPayModel.fromJson({
// "prepayId": "wx121434071826969924754d7d3309520000",
// "partnerId": "1622850618",
// "timeStamp": "1660286047",
// "nonceStr": "W14Z6RbKcHcI6QTETFyrxteD3m2P7ZaF",
// "package": "Sign=WXPay",
// "sign": "i4LDk+FlAfXukLPet6oFdtVkAXHv8aKkajO4i2tiXETBqudWJPzYAaziPH3eBo1yCvkMOyoVddWDKqHXhwrN2uvubz8YpSICt9yZBcndVaXOK+X9hY765sYoFV6sGHz5iuPljTRUWWrmc8GYMEs8TlLDB5Q50NenzJSChdfDtZRV4kXtVK6xY9b0y++eUo/snzpmq/X6GwS9n0auKkT0TKW1C30/Hzpw3SMziXPP02TvBvbqj57f6rHuGJS/LUX2ZwCR8iFZsfuiXo+7lyHHsimr4jVczdS6VtobeekrPq4vTe72d/HU/ECEZRSYxsL5DbyS2TvSNzFA6Z7wGDzkpQ=="
// });
// await PayUtil().callWxPay(
// payModel: wxPayModel,
// );
}
// base ={
// "content": {
// "prepayId": "wx121434071826969924754d7d3309520000",
// "partnerId": "1622850618",
// "timeStamp": "1660286047",
// "nonceStr": "W14Z6RbKcHcI6QTETFyrxteD3m2P7ZaF",
// "package": "Sign=WXPay",
// "sign": "i4LDk+FlAfXukLPet6oFdtVkAXHv8aKkajO4i2tiXETBqudWJPzYAaziPH3eBo1yCvkMOyoVddWDKqHXhwrN2uvubz8YpSICt9yZBcndVaXOK+X9hY765sYoFV6sGHz5iuPljTRUWWrmc8GYMEs8TlLDB5Q50NenzJSChdfDtZRV4kXtVK6xY9b0y++eUo/snzpmq/X6GwS9n0auKkT0TKW1C30/Hzpw3SMziXPP02TvBvbqj57f6rHuGJS/LUX2ZwCR8iFZsfuiXo+7lyHHsimr4jVczdS6VtobeekrPq4vTe72d/HU/ECEZRSYxsL5DbyS2TvSNzFA6Z7wGDzkpQ=="
// }
// };
// await apiClient.request(API.user.wallet.assessRecharge, data: {
// 'count': widget.count,
// 'payType': 2,
// });
// if (base.code ==null) {
//
// } else { // } else {
// BotToast.showText(text: "${base.msg}"); // BotToast.showText(text: "${base.msg}");
// } // }
// } // }
//
// Future _aliPayFunc() async { // Future _aliPayFunc() async {
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: { // var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
// 'count': widget.count, // 'count': widget.count,

@ -129,6 +129,7 @@ class _UserPageState extends State<UserPage> {
), ),
) )
], ],
), ),
); );
} }

Loading…
Cancel
Save