westdc-zf1/application/module/Order/Manager/Offlineapp.php

84 lines
1.8 KiB
PHP

<?php
namespace Order\Manager;
use Helpers\View as view;
use Helpers\dbh;
class Offlineapp
{
private $db;
private $config;
protected $events = NULL;
public $pdfData;
function __construct()
{
$this->db = \Zend_Registry::get('db');
$this->config = \Zend_Registry::get('config');
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
/*************
status:
1 开始进入离线申请申请程序中
2 填写并提交离线申请表
3 邮寄离线申请表
4 收到离线申请表
5 处理离线申请表
10:离线申请完成?
-1: 取消了在线下载进程
**************/
//接收
public function receive($id)
{
if(empty($id) || !is_numeric($id))
{
return "参数错误";
}
$data = array(
);
$sql="update dataorder set status=4,ts_received=now() where id=?";
$rs = $this->db->query($sql,array($id));
$row = $rs->fetch();
}
public function offLineAppMakeQuery($opt)
{
$def = array(
'field' => ' o.id as orderid,o.status,o.applicationform,off.*,u.realname,u.username ',
'table' => ' dataorder o ',
'join' => ' LEFT JOIN offlineapp off ON off.id=o.offlineappid
LEFT JOIN users u ON u.id = off.userid',
'order' => ' o.id ASC '
);
return array_merge($def,$opt);
}
public function fetchNotReceived()
{
$opt = $this->offLineAppMakeQuery(array(
'where' => ' o.offlineappid != -1 AND o.status=1'
));
$dbh = new dbh();
return $dbh->select($opt);
}
}