/** * _prepare * * @return void */ protected function _prepare() { if (empty(static::$_oattrs)) { static::$_oattrs[getOrderAttrNameByCode(ORDER_ATTR_YXHF)] = ORDER_ATTR_YXHF; } if (empty(static::$_status)) { static::$_status[getOrderStatusNameByCode(ORDER_STATUS_YD)] = ORDER_STATUS_YD; static::$_status[getOrderStatusNameByCode(ORDER_STATUS_BL)] = ORDER_STATUS_BL; static::$_status[getOrderStatusNameByCode(ORDER_STATUS_ZZ)] = ORDER_STATUS_ZZ; static::$_status[getOrderStatusNameByCode(ORDER_STATUS_YJS)] = ORDER_STATUS_YJS; static::$_status[getOrderStatusNameByCode(ORDER_STATUS_YQX)] = ORDER_STATUS_YQX; } if (empty(static::$_rtstat)) { static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_YRZ)] = ORDER_REALTIME_STATUS_YRZ; static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_YTF)] = ORDER_REALTIME_STATUS_YTF; static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_YZWZ)] = ORDER_REALTIME_STATUS_YZWZ; static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_YTWT)] = ORDER_REALTIME_STATUS_YTWT; static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_GQWZ)] = ORDER_REALTIME_STATUS_GQWZ; static::$_rtstat[getOrderRealTimeStatusNameByCode(ORDER_REALTIME_STATUS_FTCT)] = ORDER_REALTIME_STATUS_FTCT; } if (empty(static::$_action)) { static::$_action[ORDER_ACTION_BLDD] = array('name' => getOrderActionNameByCode(ORDER_ACTION_BLDD), 'code' => ORDER_ACTION_BLDD); static::$_action[ORDER_ACTION_QXDD] = array('name' => getOrderActionNameByCode(ORDER_ACTION_QXDD), 'code' => ORDER_ACTION_QXDD); static::$_action[ORDER_ACTION_BLRZ] = array('name' => getOrderActionNameByCode(ORDER_ACTION_BLRZ), 'code' => ORDER_ACTION_BLRZ); static::$_action[ORDER_ACTION_BLTF] = array('name' => getOrderActionNameByCode(ORDER_ACTION_BLTF), 'code' => ORDER_ACTION_BLTF); static::$_action[ORDER_ACTION_BLHF] = array('name' => getOrderActionNameByCode(ORDER_ACTION_BLHF), 'code' => ORDER_ACTION_BLHF); } }
/** * 待办事项提醒 */ 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; }