✏️ 正在编辑: CorretorBot.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/CorretorBot.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_CorretorBot { private $_id; private $_corretorId; private $_userId; private $_servico; private $_contatoFone; private $_contatoNome; public function getId() { return $this->_id; } public function getCorretorId() { return $this->_corretorId; } public function setCorretorId($corretorId) { $this->_corretorId = $corretorId; } public function getUserId() { return $this->_userId; } public function getServico() { return $this->_servico; } public function setUserId($userId) { $this->_userId = $userId; } public function setServico($servico) { $this->_servico = $servico; } public function getContatoFone() { return $this->_contatoFone; } public function getContatoNome() { return $this->_contatoNome; } public function setContatoFone($contatoFone) { $this->_contatoFone = $contatoFone; } public function setContatoNome($contatoNome) { $this->_contatoNome = $contatoNome; } public function __construct($options = null) { if( is_array($options) ){ $this->setOptions($options); } } public function setOptions(array $options) { $methods = get_class_methods($this); foreach ( $options as $key => $value ) { $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'set' . ucfirst($key); if( in_array($method, $methods) ){ $this->$method($value); } } return $this; } public function _toArray() { $dbtable = new Model_DbTable_CorretorBot(); $info = $dbtable->info(); $methods = get_class_methods($this); $data = array(); foreach ( $info['cols'] as $key ) { $col = $key; $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'get' . ucfirst($key); if( in_array($method, $methods) ){ $data[$col] = $this->$method(); } } return $data; } /** * Insere o corretor passado por parâmetro * @param Model_CorretorBot $corretor */ public function salvar(Model_CorretorBot $corretor) { $dbtable = new Model_DbTable_CorretorBot(); return $dbtable->insert($corretor->_toArray()); } /** * Retorna um fetchRow do item passado por parâmetro * @param String $userId * @return Zend_Db_Table_Row_Abstract | null */ public function exibir($userId, $servico) { if( empty($userId) ){ return null; } $dbtable = new Model_DbTable_CorretorBot(); $result = $dbtable->fetchRow(["user_id = ?" => $userId, "servico LIKE ?" => $servico]); if( !empty($result) ){ $this->setOptions($result->toArray()); return $result; } return null; } }
💾 保存文件
← 返回文件管理器