✏️ 正在编辑: NotificacaoComissionamento.php
路径:
/srv/systems_dir/yuppiecred/application/models/DbTable/NotificacaoComissionamento.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_NotificacaoComissionamento extends Zend_Db_Table_Abstract { protected $_name = 'tb_notificacao_comissionamento'; protected $_dependentTables = ['Model_DbTable_Corretor']; protected $_referenceMap = [ 'Corretor' => [ 'columns' => ['corretor_id'], 'refTableClass' => 'Model_DbTable_Corretor', 'refColumns' => ['id'] ], 'GrupoComissao' => [ 'columns' => ['grupo_id'], 'refTableClass' => 'Model_DbTable_GrupoComissao', 'refColumns' => ['id'] ] ]; public function insert(array $data) { $data['data_cadastro'] = date('Y-m-d'); $where = [ "banco_id = ?" => $data['banco_id'], "convenio_id = ?" => $data['convenio_id'], "tipo_produto = ?" => $data['tipo_produto'], "data_cadastro = ?" => $data['data_cadastro'] ]; if (!empty($data['corretor_id'])) { $where['corretor_id = ?'] = $data['corretor_id']; } if (!empty($data['grupo_id'])) { $where['grupo_id = ?'] = $data['grupo_id']; } $existe = $this->fetchRow($where); if ($existe) { return; } return parent::insert($data); } public function getGruposNotificacoes($fields) { $select = $this->getAdapter()->select()->from(['notificacoes' => $this->_name], ['grupo_id']) ->where("notificacoes.grupo_id is not null AND notificacoes.grupo_id > 0") ->where('notificacoes.excluido = 0') ->where('notificacoes.data_notificacao IS NULL') ->group("notificacoes.grupo_id"); $this->_prepareFilter($select, $fields); return $this->getAdapter()->fetchAll($select); } public function getCorretoresNotificacoes($fields) { $select = $this->getAdapter()->select()->from(['notificacoes' => $this->_name], ['corretor_id']) ->where("notificacoes.corretor_id is not null AND notificacoes.corretor_id > 0") ->where('notificacoes.excluido = 0') ->where('notificacoes.data_notificacao IS NULL') ->group("notificacoes.corretor_id"); $this->_prepareFilter($select, $fields); return $this->getAdapter()->fetchAll($select); } public function getNotificacoesEnviar($fields) { $select = $this->getAdapter()->select()->from(['notificacoes' => $this->_name], ['*']) ->joinInner(["b" => "tb_bancos"], "b.id = notificacoes.banco_id", ["banco" => "nome"]) ->joinInner(["c" => "tb_convenios"], "c.id = notificacoes.convenio_id", ["convenio" => "nome"]) ->where('notificacoes.excluido = 0') ->where('notificacoes.data_notificacao IS NULL'); $this->_prepareFilter($select, $fields); return $this->getAdapter()->fetchAll($select); } protected function _prepareFilter(&$select, array $fields) { if (!empty($fields['data_cadastro'])) { $data = new Zend_Date($fields['data_cadastro'], 'dd/MM/yyyy'); $select->where("notificacoes.data_cadastro >= ?", $data->get('yyyy-MM-dd') . " 00:00:00") ->where("notificacoes.data_cadastro <= ?", $data->get('yyyy-MM-dd') . " 23:59:59"); } if (!empty($fields['corretor_id'])) { $select->where("corretor_id = ?", $fields['corretor_id']); } if (!empty($fields['grupo_id'])) { $select->where("grupo_id = ?", $fields['grupo_id']); } if (!empty($fields['banco_id'])) { $select->where("notificacoes.banco_id = ?", $fields['banco_id']); } if (!empty($fields['convenio_id'])) { $select->where("convenio_id = ?", $fields['convenio_id']); } if (!empty($fields['tipo_produto'])) { $select->where("tipo_produto = ?", $fields['tipo_produto']); } } }
💾 保存文件
← 返回文件管理器