Commit fef69e63962b28296d148966ee4a6bafa4f3715f

Authored by Ezequiel Lafuente
1 parent c5255ce4
Exists in master and in 1 other branch desenv

Primeiro commit em relação a primeira demanda

Showing 1 changed file with 29 additions and 0 deletions   Show diff stats
controlador_ws.php
@@ -539,6 +539,35 @@ $app->group('/api/v1',function(){ @@ -539,6 +539,35 @@ $app->group('/api/v1',function(){
539 } 539 }
540 //return $response->withJSON(); 540 //return $response->withJSON();
541 }); 541 });
  542 +
  543 + $this->post('/linkedicao', function ($request, $response, $args) {
  544 + try {
  545 + session_start();
  546 +
  547 + if(empty($request->getParam('id_documento')))
  548 + throw new InfraException('Deve ser passado valor para o (id_documento).');
  549 +
  550 + // Recupera o id do procedimento
  551 + $protocoloDTO = new DocumentoDTO();
  552 + $protocoloDTO->setDblIdDocumento($request->getParam('id_documento'));
  553 + $protocoloDTO->retDblIdProcedimento();
  554 + $protocoloRN = new DocumentoRN();
  555 + $protocoloDTO = $protocoloRN->consultarRN0005($protocoloDTO);
  556 +
  557 + if(empty($protocoloDTO))
  558 + throw new InfraException('Documento não encontrado');
  559 +
  560 + $linkassinado = SessaoSEI::getInstance()->assinarLink('controlador.php?acao=editor_montar&acao_origem=arvore_visualizar&id_procedimento=' . $protocoloDTO->getDblIdProcedimento() . '&id_documento=' . $request->getParam('id_documento'));
  561 +
  562 + return $response->withJSON(
  563 + array("link" => $linkassinado, "phpsessid" => session_id())
  564 + );
  565 +
  566 + } catch (InfraException $e) {
  567 + die($e->getStrDescricao());
  568 + }
  569 + });
  570 +
542 571
543 })->add( new TokenValidationMiddleware()); 572 })->add( new TokenValidationMiddleware());
544 573