/** * 待办事项提醒 */ public function indexAction() { $ctime = time(); if (!(($task = $this->cache()->load($hash = md5(__CLASS__ . "{$this->_hostel['h_id']}.NOTE.PAGE:"))) && isset($task['time']) && isset($task['life']) && isset($task['data']) && is_array($task['data']) && $task['time'] + $task['life'] > $ctime)) { $task = array('time' => (int) $ctime, 'life' => $this->model('task')->getTodoWaitByHotel($this->_hostel), 'data' => array()); $dtime = $this->model('task')->getTodoDaysByHotel($this->_hostel) * 86400; $btime = $ctime - $dtime; $etime = $ctime + $dtime; $orders = $this->model('order')->getRealTimeStateOrderAryByHid($this->_hostel['h_id'], $btime, $etime, $ctime); if (!empty($orders)) { $uqid = 0; foreach ($orders as $order) { $codes = $this->model('order')->getRealTimeStateCodes($order, $this->_hostel); foreach ($codes as $rtsta) { $uqid++; $item = array('done' => 0, 'href' => '/master/order/detail?oid=' . $order['o_id'], 'info' => $this->view->escape(__('房间%s的%d号订单 %s', $order['o_room'], $order['o_id'], getOrderRealTimeStatusNameByCode($rtsta)))); $task['data']["o{$uqid}"] = $item; } } } $obills = $this->model('bill')->getRealTimeStateBillAryByHid($this->_hostel['h_id'], $btime, $etime, $ctime); if (!empty($obills)) { $uqid = 0; foreach ($obills as $obill) { $codes = $this->model('bill')->getRealTimeStateCodes($obill, $this->_hostel); foreach ($codes as $rtsta) { $uqid++; $item = array('done' => 0, 'href' => '/master/bill/detail?bid=' . $obill['b_id'], 'info' => $this->view->escape(__('%d号账单%s %s', $obill['b_id'], $obill['b_name'], getBillRealTimeStatusNameByCode($rtsta)))); $task['data']["b{$uqid}"] = $item; } } } $this->cache()->save($task, $hash); } if ($this->input('ct') === 'json') { $this->flash(1, array('context' => $task)); } $this->view->task = $task; }
/** * _prepare * * @return void */ protected function _prepare() { if (empty(static::$_action)) { static::$_action[BILL_ACTION_GBZD] = array('name' => getBillActionNameByCode(BILL_ACTION_GBZD), 'code' => BILL_ACTION_GBZD); static::$_action[BILL_ACTION_KFZD] = array('name' => getBillActionNameByCode(BILL_ACTION_KFZD), 'code' => BILL_ACTION_KFZD); static::$_action[BILL_ACTION_QTFY] = array('name' => getBillActionNameByCode(BILL_ACTION_QTFY), 'code' => BILL_ACTION_QTFY); static::$_action[BILL_ACTION_SKTK] = array('name' => getBillActionNameByCode(BILL_ACTION_SKTK), 'code' => BILL_ACTION_SKTK); static::$_action[BILL_ACTION_XGBZ] = array('name' => getBillActionNameByCode(BILL_ACTION_XGBZ), 'code' => BILL_ACTION_XGBZ); static::$_action[BILL_ACTION_JSFS] = array('name' => getBillActionNameByCode(BILL_ACTION_JSFS), 'code' => BILL_ACTION_JSFS); static::$_action[BILL_ACTION_GQSJ] = array('name' => getBillActionNameByCode(BILL_ACTION_GQSJ), 'code' => BILL_ACTION_GQSJ); } if (empty(static::$_battrs)) { // static::$_battrs[getBillAttrNameByCode(BILL_ATTR_GQTX)] = BILL_ATTR_GQTX; } if (empty(static::$_status)) { static::$_status[getBillStatusNameByCode(BILL_STATUS_KF)] = BILL_STATUS_KF; static::$_status[getBillStatusNameByCode(BILL_STATUS_GB)] = BILL_STATUS_GB; } if (empty(static::$_rtstat)) { static::$_rtstat[getBillRealTimeStatusNameByCode(BILL_REALTIME_STATUS_YGQ)] = BILL_REALTIME_STATUS_YGQ; } }