public function checkout() { $id = I('id', 0, 'intval'); $money_student = I('money_student', 0, 'float'); $money_company = I('money_company', 0, 'float'); $money_service = I('money_service', 0, 'float'); $type = I('type'); $jobModel = new \Job\Model\PayModel(); if ($type == 'company') { $ret = $jobModel->checkout($id, $money_student, $money_company, $money_service); $ret or $this->error($jobModel->getError()); // 结算成功后,立即执行自动还款 $join = M('job_join')->find($id) or $this->error('找不到此参与信息!'); $orderModel = new \Loan\Model\OrderModel(); $ret = $orderModel->autoRepay($join['uid'], $money_student); $ret ? $this->success() : $this->error('结算成功,但自动分期还款失败:' . $jobModel->getError()); } elseif ($type == 'student') { $ret = $jobModel->checkoutStudent($id, $money_student, $money_company, $money_service); $ret ? $this->success() : $this->error($jobModel->getError()); } else { $this->error('未知请求类型!'); } }