Esempio n. 1
0
 public function order()
 {
     if (I('post.month', 0, 'intval') > 0) {
         $userModel = new \Common\Model\UserModel();
         $userModel->verifyCode(I('post.mobile'), I('post.verify_code')) or $this->error($userModel->getError());
     }
     $goods = $this->_goods();
     $this->assign('goods', $goods);
     $first_money = I('first_money', 0, 'floatval');
     $month = I('month', 0, 'intval');
     $quantity = I('quantity', 1, 'intval');
     $remark = I('remark');
     $payee_account_type = I('payee_account_type', 0, 'intval');
     $payee_account = I('account');
     $orderModel = new \Loan\Model\OrderModel();
     $order_id = $orderModel->addGoods($this->_user['uid'], $goods['id'], $quantity, $first_money, $month, $goods['property_remark'], $remark, $payee_account_type, $payee_account);
     $order_id or $this->error($orderModel->getError());
     if (IS_AJAX) {
         $this->ajaxReturn(array('status' => 1, 'order_id' => $order_id));
     } else {
         if ($month) {
             $this->assign('order_id', $order_id);
             $this->success('下单成功,请等待工作人员审核。', '/user/order', 3);
         } else {
             $this->redirect('/pay/alipay/' . $order_id);
         }
     }
 }