✏️ 正在编辑: Mensagem.php
路径:
/srv/systems_dir/oakberry/application/models/Mensagem.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_Mensagem extends Core_Model { public function getEmpresa() { return $this->findParentRow('Model_DbTable_Empresa'); } public function getCategoria() { return $this->findParentRow('Model_DbTable_Categoria'); } // public function setLinkUrl($linkUrl) // { // $shortLink = \Yuppie_Link::shortenBitly($linkUrl, (new Service_Config())->get()->yuppie->bitly_token); // $this->setAttribute('link_url', $shortLink ?? $linkUrl); // } public function prepareToSend($lead, ?int $empresaId = 0) { if (method_exists($lead, "getPrimeiroNome")) { $this->texto = str_replace("[NOME_CLIENTE]", ucfirst(strtolower($lead->getPrimeiroNome())), $this->texto); } $this->texto = str_replace("[NOME_CLIENTE_COMPLETO]", ucwords(strtolower($lead->nome)), $this->texto); $this->texto = str_replace("[CPF_CLIENTE]", $lead->cpf, $this->texto); $this->texto = str_replace("[ANIVERSARIO_CLIENTE]", $lead->aniversario, $this->texto); if ($this->cupom_id > 0) { $cupom = Model_Container::getCupom()->findById($this->cupom_id); $leadCupom = Model_Container::getLeadCupom()->fetchRow([ 'cupom_id = ?' => $this->cupom_id, 'empresa_id = ?' => $empresaId ?: Yuppie_Auth::getIdentity()->empresa_id, 'lead_id = ?' => $lead->id ]); $textoCupom = "*Cupom disponível:* \n\n_{$leadCupom->cupom}_ \n\n( {$cupom->descricao} )"; $textoCupom .= $leadCupom->data_validade ? "\n_Válido até " . (new Zend_Date($leadCupom->data_validade))->get('dd/MM/yyyy') . "_" : ""; $this->texto = str_replace("[CUPOM]", $textoCupom, $this->texto); } } public function duplicate() { $this->setAttribute('assunto', $this->assunto . " (COPIADO)"); $this->setAttribute('id', null); $this->setAttribute('data_cadastro', null); $this->setAttribute('status_envio', ""); $this->setAttribute('qtd_envios', null); return $this->save(); } public function save() { $oldData = $this->_cleanData; $id = parent::save(); $this->audity(new Yuppie_AudityDbTable(), $id, $oldData, $this->_data, $this->_table->info('name')); return $this->_data['id']; } }
💾 保存文件
← 返回文件管理器