ajuste da busca e cadastro pelos cpfs dos pais
This commit is contained in:
@@ -84,13 +84,31 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
}
|
||||
|
||||
buscarCPF()async{
|
||||
final url = '${widget.api}/buscarcpf?CPF=${inputCPF.text.replaceAll('.','').replaceAll('-', '')}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||
final url = '${widget.api}/buscarCPFMae?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
if(response.body == 'false'){
|
||||
showSnackBar(context, 'CPF não encontrado entre em contato com a escola!', Colors.red);
|
||||
carregando = false;
|
||||
setState(() {});
|
||||
final url = '${widget.api}/buscarCPFPai?CPF=${inputCPF.text}&CIDADE=${cidadeQuery.toUpperCase()}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
mapAluno = json.decode(response.body);
|
||||
print(mapAluno);
|
||||
print(mapAluno!['CD_ALUNO']);
|
||||
// inserirDB(map);
|
||||
if(tentativas <=3){
|
||||
tentativas = tentativas + 1;
|
||||
criarNumero(mapAluno!['DDD_CELULAR_PAI'].toString(),mapAluno!['CELULAR_PAI'].toString());
|
||||
}else{
|
||||
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
||||
carregando = false;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
if(response.body == 'false'){
|
||||
showSnackBar(context, 'CPF não encontrado entre em contato com a escola!', Colors.red);
|
||||
carregando = false;
|
||||
setState(() {});
|
||||
}
|
||||
}else{
|
||||
mapAluno = json.decode(response.body);
|
||||
print(mapAluno);
|
||||
@@ -98,20 +116,22 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
// inserirDB(map);
|
||||
if(tentativas <=3){
|
||||
tentativas = tentativas + 1;
|
||||
criarNumero();
|
||||
criarNumero(mapAluno!['DDD_CELULAR_MAE'].toString(),mapAluno!['CELULAR_MAE'].toString());
|
||||
}else{
|
||||
showSnackBar(context, 'Excedeu suas tentativas, entre em contato com a escola', Colors.red);
|
||||
carregando = false;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
criarNumero(){
|
||||
criarNumero(String DDD, String numero){
|
||||
var random = Random();
|
||||
nroSMS = (random.nextInt(900000) + 100000).toString();
|
||||
apiSMS();
|
||||
apiSMS(DDD,numero);
|
||||
}
|
||||
|
||||
apiSMS()async{
|
||||
apiSMS(String DDD, String numero)async{
|
||||
final String apiUrl = 'https://api-rest.zenvia.com/services/send-sms';
|
||||
final String authToken = '6nPV7rkTncLaugyoEBHQklHrvD5-GzDVMCeI';
|
||||
final headers = {
|
||||
@@ -124,12 +144,14 @@ class _TelaCadastroState extends State<TelaCadastro> {
|
||||
final data = {
|
||||
"sendSmsRequest": {
|
||||
"from": "RKM EDUCA",
|
||||
"to": "+5515996083456",
|
||||
"to": "+55$DDD$numero",
|
||||
"msg": "Seu codigo de acesso : $nroSMS",
|
||||
"flashSms": true,
|
||||
}
|
||||
};
|
||||
|
||||
print('deu certo +55$DDD$numero');
|
||||
|
||||
final response = await http.post(
|
||||
Uri.parse(apiUrl),
|
||||
headers: headers,
|
||||
|
||||
Reference in New Issue
Block a user