/** * 添加还款记录 */ public function addrepayAction() { $data = $this->request->getPost(); empty($data['uid']) and $this->error('参数错误'); if (!Loan::isValidNo($data['uid'], $data['no'])) { $this->error('参数错误'); } $data['oid'] = $this->getOperatorId(); !empty($data['date']) and $data['date'] = strtotime($data['date']); $data['addtime'] = time(); $data['status'] == 0 and $data['date'] = 0; $model = new RepayForm('add'); if ($result = $model->validate($data)) { if ($model->add()) { if ($data['status'] == 1) { Loan::updateRepay($data['uid'], $data['amount'], $data['no'], $data['date']); } $this->success('操作成功'); } else { $this->error('操作失败'); } } else { $this->error('验证失败'); } exit; }