✏️ 正在编辑: UsuariosEquipe.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/models/DbTable/UsuariosEquipe.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_UsuariosEquipe extends Core_DbTable { protected $_primary = 'id'; protected $_name = 'tb_usuarios_equipe'; protected $_referenceMap = array( 'Usuario' => array( 'columns' => array( 'usuario_id' ), 'refTableClass' => 'Model_DbTable_Usuario', 'refColumns' => array( 'id' ) ), 'Supervisor' => array( 'columns' => array( 'supervisor_id' ), 'refTableClass' => 'Model_DbTable_GerenteRota', 'refColumns' => array( 'id' ) ), 'Corretor' => array( 'columns' => array( 'corretor_id' ), 'refTableClass' => 'Model_DbTable_Corretor', 'refColumns' => array( 'id' ) ) ); public function insert(array $data) { $existCorretor = $this->fetchRow("usuario_id = {$data['usuario_id']} AND corretor_id = {$data['corretor_id']}"); $modelCorretor = new Model_Corretor; if( $existCorretor ){ $dadosCorretor = $modelCorretor->exibir($data['corretor_id']); throw new Exception("Este corretor ({$dadosCorretor->nome}) já esta cadastrado."); } return parent::insert($data); } public function getRedeAtendimentoCorretores() { $select = $this->getAdapter()->select()->from(array( 'rede_atendimento' => 'tb_usuarios_rede_atendimento' ), array( 'corretor_id' )) ->where("usuario_id = '" . Yuppie_Auth::getIdentity()->id . "'") ->where("rede_atendimento.excluido <> 1"); return $this->getAdapter()->fetchCol($select); } public function getAssistentes() { $select = $this->getAdapter()->select() ->from(array( 'rede_atendimento' => 'tb_usuarios_rede_atendimento' ), array()) ->joinInner(array("assistente" => 'tb_usuarios'), "assistente.id = rede_atendimento.usuario_id", array("id", "nome")) ->where("rede_atendimento.excluido <> 1") ->group("rede_atendimento.usuario_id"); return $this->getAdapter()->fetchAll($select); } }
💾 保存文件
← 返回文件管理器