66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
||
namespace Order\mount;
|
||
|
||
use Helpers\View as view;
|
||
use Helpers\dbh;
|
||
|
||
//事件中存在的操作
|
||
class PdfOperate implements \Order\listener\PdfEvents
|
||
{
|
||
private $db;
|
||
private $config;
|
||
|
||
//!!!!!!important!!!!!
|
||
//不同项目使用时是否要修改此项??
|
||
public $tbl_metadata = "heihemetadata";
|
||
public $tbl_dataorder = "dataorder";
|
||
public $tbl_offlineapp = "offlineapp";
|
||
|
||
function __construct($db = NULL)
|
||
{
|
||
if(empty($db))
|
||
{
|
||
$this->db = \Zend_Registry::get('db');
|
||
}else{
|
||
$this->db = $db;
|
||
}
|
||
|
||
$this->config = \Zend_Registry::get('config');
|
||
}
|
||
|
||
//提交申请
|
||
public function updateUserInfo(\Zend_EventManager_Event $e)
|
||
{
|
||
//根据pdflink字段,以判断是否已经提交
|
||
//在数据库中创建rules,在更新offlineapp表时同时更新users表中对应的信息
|
||
$formData = $e->getParam('formData');
|
||
$uid = $e->getParam('uid');
|
||
|
||
try{
|
||
|
||
$sql="SELECT id FROM ".$this->tbl_offlineapp."
|
||
WHERE userid=? AND (pdflink IS null OR pdflink='') AND (ts_approved IS null)";
|
||
$row = $this->db->fetchRow($sql,array($uid));
|
||
|
||
$dbh = new dbh($this->db);
|
||
$formData['username'] = $formData['realname'];
|
||
unset($formData['realname']);
|
||
unset($formData['save']);
|
||
|
||
if ($row) {
|
||
$s = $dbh->update($this->tbl_offlineapp,$formData," id={$row['id']} ");
|
||
return $s;
|
||
} else {
|
||
$s = $dbh->insert($this->tbl_offlineapp,$formData);
|
||
return $s;
|
||
}
|
||
|
||
}catch(Exception $e)
|
||
{
|
||
return $e->getMessage();
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
} |