/** * GPS安装 */ public function gpsAction() { if ($this->isAjax()) { $data = $this->request->getPost(); $uid = $data['uid']; !$uid and $this->error('参数错误'); $data['gps'] = 1; $model = new LoanForm('gps'); if ($result = $model->validate($data)) { if ($model->sign()) { Log::add($uid, $this->getOperatorId(), \App\Config\Log::loanOperate('gps')); $this->success('操作成功'); } else { $this->error('操作失败'); } } else { $this->error('验证失败'); } exit; } $uid = $this->urlParam(); empty($uid) and $this->pageError('param'); $loan = Loan::findByUid($uid); $user = User::findFirst($uid)->toArray(); $this->view->setVars(['loan' => $loan, 'user' => $user]); $this->view->pick('afterrc/detail'); }
/** * 合同签署 */ public function signAction() { if ($this->isAjax()) { $data = $this->request->getPost(); $uid = $data['uid']; !$uid and $this->error('参数错误'); $data['begintime'] = strtotime(date('Y-m-d 23:59:59', time())); //还款开始时间,签署合同当天23:59:59秒计时 //$data['status'] = \App\LoanStatus::getStatusRepay(); $data['return_num'] = 0; $data['return_amount'] = 0; $data['last_repay_time'] = $data['begintime']; $data['next_repay_time'] = strtotime('+1 month', $data['begintime']); $data['endtime'] = 0; $model = new LoanForm('contractSign'); if ($result = $model->validate($data)) { if ($model->sign()) { Log::add($data['uid'], $this->getOperatorId(), \App\Config\Log::loanOperate('sign')); $this->success('操作成功'); } else { $this->error('操作失败'); } } else { $this->error('验证失败'); } exit; } $uid = $this->urlParam(); empty($uid) and $this->pageError('param'); $loan = Loan::findByUid($uid); $user = User::findFirst($uid)->toArray(); $this->view->setVars(['loan' => $loan, 'user' => $user]); $this->view->pick('afterrc/detail'); }