✏️ 正在编辑: CorretorAssinaturaTermo.php
路径:
/srv/systems_dir/yuppiecred/application/models/DbTable/CorretorAssinaturaTermo.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_CorretorAssinaturaTermo extends Zend_Db_Table_Abstract { protected $_primary = 'id'; protected $_name = 'tb_corretor_assinatura_termo'; /** * @param int|null $corretor * @param string|null $uuid * @return array */ public function findByCorretorId(?int $corretor, ?string $uuid = null) { if (!$corretor && !$uuid) { return []; } $query = $this->getAdapter() ->select() ->from($this->_name) ->where('excluido <> ?', '1') ->where('data_assinatura IS NULL') ->order('id DESC') ->limit(1) ; if ($corretor) { $query->where('corretor_id = ?', $corretor); } if ($uuid) { $query->where('uuid = ?', $uuid); } return $this->getAdapter()->fetchRow($query); } /** * @param int $termoId * @param int|null $corretor * @param string|null $email */ public function findTermoEnviado(int $termoId, ?int $corretor = null, ?string $email = null) { $query = $this->getAdapter() ->select() ->from($this->_name) ->where('termo_id = ?', $termoId) ->where('excluido <> ?', '1') ->order('id DESC') ; if ($corretor) { $query->where('corretor_id = ?', $corretor); } if ($email) { $query->where('corretor_email = ?', $email); } return $this->getAdapter()->fetchRow($query); } /** * @param int $corretor * @return array */ public function findTermoAssinado(int $id): array { $query = $this->getAdapter() ->select() ->from($this->_name) ->where('id = ?', $id) ->where('excluido <> ?', '1') ->where('data_assinatura IS NOT NULL') ->order('id DESC') ->limit(1) ; $data = $this->getAdapter()->fetchRow($query); return !empty($data) ? $data : []; } /** * @param array|string $where * @return int */ public function delete($where) { return $this->update(['excluido' => 1], $where); } /** * @param int $corretor * @param string $email * @param int $termoId * @return array */ public function findTermosEnviados(int $corretor): array { $query = $this->getAdapter() ->select() ->from(['corretor_termos' => $this->_name]) ->join(['termos' => 'tb_termo_responsabilidade'], 'corretor_termos.termo_id = termos.id', ['descricao']) ->where('corretor_id = ?', $corretor) ->where('corretor_termos.excluido <> ?', '1') ->where('termos.excluido <> ?', '1') ->order('id DESC') ; $data = $this->getAdapter()->fetchAll($query); return !empty($data) ? $data : []; } }
💾 保存文件
← 返回文件管理器