Example #1
0
 public function indexAction()
 {
     if ($this->getCurrentUser()) {
         $order = FoodOrderModel::getInstance()->getLastPaidOrder($this->getCurrentUser());
         $this->dataFlow->toFlow(array('lastOrderId' => $order['_id']));
     }
     $this->response();
 }
Example #2
0
 /**
  * 确认订单
  *
  * @return bool
  */
 public function confirmOrderAction()
 {
     $FoodOrderModel = FoodOrderModel::getInstance();
     $GroupOrderModel = GroupOrderModel::getInstance();
     if ($FoodOrderModel->hasNotPayOrder()) {
         $groupOrderNo = $GroupOrderModel->createGroupOrder();
         $FoodOrderModel->pay($groupOrderNo);
         $this->responseAjax(Constant::CODE_SUCCESS, '', array('groupOrderNo' => $groupOrderNo));
     } else {
         $this->responseAjax(Constant::CODE_FAIL, '没有待支付的订单');
     }
     return false;
 }
Example #3
0
 /**
  * 删除
  * 
  * @return bool
  */
 public function deleteNotPayOrderAction()
 {
     $FoodModel = FoodOrderModel::getInstance();
     $notPayOrder = $FoodModel->getLastNotPayOrder($this->getCurrentUser());
     if ($notPayOrder) {
         $FoodModel->delete(array('_id' => $notPayOrder['_id']));
         $this->responseAjax(Constant::CODE_SUCCESS, '');
     } else {
         $this->responseAjax(Constant::CODE_FAIL, '未找到需要删除的订单');
     }
     return false;
 }