| @@ 317-340 (lines=24) @@ | ||
| 314 | return; |
|
| 315 | } |
|
| 316 | ||
| 317 | public function loginClient($dados) |
|
| 318 | { |
|
| 319 | ||
| 320 | $conditions = array( |
|
| 321 | 'ativo' => 1, |
|
| 322 | 'id_usuario' => $this->getIdUser(), |
|
| 323 | 'email' => $dados['email'], |
|
| 324 | 'senha' => sha1($dados['senha']) |
|
| 325 | ); |
|
| 326 | ||
| 327 | $cliente = $this->Cliente->find('all', |
|
| 328 | array('conditions' => |
|
| 329 | $conditions |
|
| 330 | ) |
|
| 331 | ); |
|
| 332 | ||
| 333 | if (!empty($cliente)) { |
|
| 334 | $this->response->body('{"message": "success", "result":'.json_encode($cliente).'}'); |
|
| 335 | return; |
|
| 336 | } |
|
| 337 | ||
| 338 | $this->response->body('{"message": "error"}'); |
|
| 339 | return; |
|
| 340 | } |
|
| 341 | ||
| 342 | public function postClient($dados) |
|
| 343 | { |
|
| @@ 422-439 (lines=18) @@ | ||
| 419 | return $this->response->body('{"message": "success", "result":' . json_encode($dados) . '}'); |
|
| 420 | } |
|
| 421 | ||
| 422 | public function postParent($dados) |
|
| 423 | { |
|
| 424 | $dados = array( |
|
| 425 | 'senha' => sha1($dados['senha']), |
|
| 426 | 'usuario_id' => $this->getIdUser(), |
|
| 427 | 'cliente_id' => $dados['cliente_id'], |
|
| 428 | 'login' => $dados['login'], |
|
| 429 | 'ativo' => 1, |
|
| 430 | ); |
|
| 431 | ||
| 432 | if ($this->Parente->save($dados)) { |
|
| 433 | $this->response->body('{"message": "success", "result":'.json_encode($dados).'}'); |
|
| 434 | return; |
|
| 435 | } |
|
| 436 | ||
| 437 | $this->response->body('{"message": "error"}'); |
|
| 438 | return; |
|
| 439 | } |
|
| 440 | ||
| 441 | public function loginParent($dados) |
|
| 442 | { |
|
| @@ 441-463 (lines=23) @@ | ||
| 438 | return; |
|
| 439 | } |
|
| 440 | ||
| 441 | public function loginParent($dados) |
|
| 442 | { |
|
| 443 | $conditions = array( |
|
| 444 | 'ativo' => 1, |
|
| 445 | 'usuario_id' => $this->getIdUser(), |
|
| 446 | 'login' => $dados['login'], |
|
| 447 | 'senha' => sha1($dados['senha']) |
|
| 448 | ); |
|
| 449 | ||
| 450 | $parente = $this->Parente->find('all', |
|
| 451 | array('conditions' => |
|
| 452 | $conditions |
|
| 453 | ) |
|
| 454 | ); |
|
| 455 | ||
| 456 | if (!empty($parente)) { |
|
| 457 | $this->response->body('{"message": "success", "result":'.json_encode($parente).'}'); |
|
| 458 | return; |
|
| 459 | } |
|
| 460 | ||
| 461 | $this->response->body('{"message": "error"}'); |
|
| 462 | return; |
|
| 463 | } |
|
| 464 | ||
| 465 | public function putParent($dados, $id_parente) |
|
| 466 | { |
|