westdc-zf1/application/module/Fund/Handler/FundHandler.php

107 lines
1.7 KiB
PHP

<?php
namespace Fund\Handler;
use \Helpers\View as view;
use \Helpers\dbh;
use \Helpers\Table;
use \Files\Files;
use \Fund\Reference;
//事件中存在的操作
class FundHandler implements \Fund\Event\FundEvent
{
private $db; //传入PDO对象误
private $config; //全局配置
public $table;
public $tbl_maillog = ""; //邮件日志表
function __construct($db = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$this->table = new Table();
}
public function checkFundParam(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
if(!is_array($data))
{
return "参数错误";
}
if(empty($data["title"]))
{
return "请输入标题";
}
return true;
}
public function processFundData(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
return $data;
}
public function insertToFundTable(\Zend_EventManager_Event $e)
{
return true;
}
public function checkMdfundParam(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
if(!is_array($data))
{
return "参数错误";
}
if(empty($data["fid"]))
{
return "请填写项目ID";
}
if(empty($data['uuid']))
{
return "请填写UUID";
}
if(!view::isUuid($data['uuid']))
{
return "UUID格式不正确";
}
return true;
}
public function processMdfundData(\Zend_EventManager_Event $e)
{
$data = $e->getParam('data');
if(empty($data['place']))
{
$data['place'] = 0;
}
if(!is_numeric($data['place']))
{
$data['place'] = 0;
}
return $data;
}
}