| @@ 316-339 (lines=24) @@ | ||
| 313 | return; |
|
| 314 | } |
|
| 315 | ||
| 316 | public function loginClient($dados) |
|
| 317 | { |
|
| 318 | ||
| 319 | $conditions = array( |
|
| 320 | 'ativo' => 1, |
|
| 321 | 'id_usuario' => $this->getIdUser(), |
|
| 322 | 'email' => $dados['email'], |
|
| 323 | 'senha' => sha1($dados['senha']) |
|
| 324 | ); |
|
| 325 | ||
| 326 | $cliente = $this->Cliente->find('all', |
|
| 327 | array('conditions' => |
|
| 328 | $conditions |
|
| 329 | ) |
|
| 330 | ); |
|
| 331 | ||
| 332 | if (!empty($cliente)) { |
|
| 333 | $this->response->body('{"message": "success", "result":'.json_encode($cliente).'}'); |
|
| 334 | return; |
|
| 335 | } |
|
| 336 | ||
| 337 | $this->response->body('{"message": "error"}'); |
|
| 338 | return; |
|
| 339 | } |
|
| 340 | ||
| 341 | public function postClient($dados) |
|
| 342 | { |
|
| @@ 414-431 (lines=18) @@ | ||
| 411 | exit(); |
|
| 412 | } |
|
| 413 | ||
| 414 | public function postParent($dados) |
|
| 415 | { |
|
| 416 | $dados = array( |
|
| 417 | 'senha' => sha1($dados['senha']), |
|
| 418 | 'usuario_id' => $this->getIdUser(), |
|
| 419 | 'cliente_id' => $dados['cliente_id'], |
|
| 420 | 'login' => $dados['login'], |
|
| 421 | 'ativo' => 1, |
|
| 422 | ); |
|
| 423 | ||
| 424 | if ($this->Parente->save($dados)) { |
|
| 425 | $this->response->body('{"message": "success", "result":'.json_encode($dados).'}'); |
|
| 426 | return; |
|
| 427 | } |
|
| 428 | ||
| 429 | $this->response->body('{"message": "error"}'); |
|
| 430 | return; |
|
| 431 | } |
|
| 432 | ||
| 433 | public function loginParent($dados) |
|
| 434 | { |
|
| @@ 433-455 (lines=23) @@ | ||
| 430 | return; |
|
| 431 | } |
|
| 432 | ||
| 433 | public function loginParent($dados) |
|
| 434 | { |
|
| 435 | $conditions = array( |
|
| 436 | 'ativo' => 1, |
|
| 437 | 'usuario_id' => $this->getIdUser(), |
|
| 438 | 'login' => $dados['login'], |
|
| 439 | 'senha' => sha1($dados['senha']) |
|
| 440 | ); |
|
| 441 | ||
| 442 | $parente = $this->Parente->find('all', |
|
| 443 | array('conditions' => |
|
| 444 | $conditions |
|
| 445 | ) |
|
| 446 | ); |
|
| 447 | ||
| 448 | if (!empty($parente)) { |
|
| 449 | $this->response->body('{"message": "success", "result":'.json_encode($parente).'}'); |
|
| 450 | return; |
|
| 451 | } |
|
| 452 | ||
| 453 | $this->response->body('{"message": "error"}'); |
|
| 454 | return; |
|
| 455 | } |
|
| 456 | ||
| 457 | public function putParent($dados, $id_parente) |
|
| 458 | { |
|
| @@ 490-508 (lines=19) @@ | ||
| 487 | } |
|
| 488 | } |
|
| 489 | ||
| 490 | public function postConsulta($dados) |
|
| 491 | { |
|
| 492 | $dados = array( |
|
| 493 | 'nome' => $dados['nome'], |
|
| 494 | 'email' => $dados['email'], |
|
| 495 | 'data' => $dados['date'], |
|
| 496 | 'hora' => $dados['hora'], |
|
| 497 | 'id_usuario' => $this->getIdUser(), |
|
| 498 | 'ativo' => 1, |
|
| 499 | ); |
|
| 500 | ||
| 501 | if ($this->Consulta->save($dados)) { |
|
| 502 | $this->response->body('{"message": "success", "result":' . json_encode($dados) . '}'); |
|
| 503 | return; |
|
| 504 | } |
|
| 505 | ||
| 506 | $this->response->body('{"message": "error"}'); |
|
| 507 | return; |
|
| 508 | } |
|
| 509 | ||
| 510 | /** |
|
| 511 | * Valida o usuario que está tentando usar a api |
|