✏️ 正在编辑: PedidoController.php
路径:
/srv/systems_dir/oakberry/application/controllers/PedidoController.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class PedidoController extends Yuppie_Controller_Crud { protected $title = 'Pedidos'; protected $titleIcon = 'glyphicon-reg glyphicon-reg-group'; public function init() { $this->formFiltro = 'Form_Filtro_Pedidos'; $this->formSave = 'Form_Pedido'; parent::init(); } public function lancarAction() { $request = $this->getRequest(); $leadId = (int)$request->getParam('cliente_id', 0); $valor = $request->getParam('valor', 1); $pontuar = $request->getParam('pontuar', 1); if (empty($leadId)) { $this->_helper->json(['status' => 0, "alert" => "Cliente não informado!"]); } try { $pedido = (new Model_Pedido())->lancarPedido($leadId, $valor, $pontuar); $score = strtoupper($pedido['score']); if ($pedido['pedido']) { $this->_helper->json(['status' => 1, "alert" => "Pedido lançado com sucesso! Inseridos {$pedido['pontos']} pontos.\n Score Atual ( {$score} )"]); } else { $this->_helper->json(['status' => 0, "alert" => "O pedido não foi lançado"]); } } catch (Core_Exception $e) { $this->_helper->json(['status' => 0, "alert" => $e->getMessage()]); } catch (Exception $e) { Yuppie_Log::write($e->getMessage() . $e->getTraceAsString(), $this); $this->_helper->json(['status' => 0, "alert" => "Falha na execução"]); } } public function resgatarCartaoAction() { $request = $this->getRequest(); $leadId = (int)$request->getParam('id', 0); $pontos = (int)$request->getParam('qtd', 1); if (empty($leadId)) { $this->_helper->json(['status' => 0, "alert" => "Cliente não informado!"]); } try { $resgate = (new Model_Resgate())->lancarResgate($leadId, $pontos); if ($resgate) { $this->_helper->json(['status' => 1, "alert" => "Resgate lançado com sucesso!"]); } else { $this->_helper->json(['status' => 0, "alert" => "O resgate não foi aceito"]); } } catch (Core_Exception $e) { $this->_helper->json(['status' => 0, "alert" => $e->getMessage()]); } catch (Exception $e) { Yuppie_Log::write($e->getMessage() . $e->getTraceAsString(), $this); $this->_helper->json(['status' => 0, "alert" => "Falha na execução"]); } } public function pedidosNaoVinculadosAction() { $form = new Form_Filtro_PedidosNaoVinculados(); $orders = $form->search(); $leads = Core_Combos::getLeadsVincular(); $this->view->orders = $orders; $this->view->form = $form; $this->view->leads = $leads; } public function vincularLeadAction() { $post = $this->getRequest()->getPost(); try { $qtd = (new Model_DeliveryOrder())->vincularCliente($post['order_id'], $post['lead_id']); $this->_helper->json(['success' => true, "msg" => "Foram vinculados {$qtd} pedidos com sucesso!"]); } catch (Throwable $tr) { Yuppie_Log::write($tr->getMessage() . $tr->getTraceAsString(), $this); $this->_helper->json(['error' => true, "msg" => "Falha na execução"]); } } }
💾 保存文件
← 返回文件管理器