protected function insertRecord($form, $io_type) { $form['io_type'] = $io_type; $accountRecordsearch = new AccountRecord(); //search中自定义的加载表单方法,相对于框架定义的load方法更灵活一些 $accountRecordsearch->loadForm($form); //使用save方法存储,成功后跳转 if ($accountRecordsearch->save()) { return $this->render('success'); } else { return $this->render('error', ['errors' => $accountRecordsearch->errors]); } }
public function refreshstatus($id) { $accountRecord = new AccountRecord(); $record_id = $this->find()->where(['id' => $id])->one()['record_id']; $money = $accountRecord->find()->where(['id' => $record_id])->one()['money']; if ($money <= $this->findRepayMoney($id)) { echo $money . '<br/>'; echo $this->findRepayMoney($id); $this['status'] = 3; $this->save(); } }
protected function insertRecord($form, $io_type) { $form['io_type'] = $io_type; $accountRecordsearch = new AccountRecord(); $accountRecordsearch->loadForm($form); if ($accountRecordsearch->save()) { return $accountRecordsearch['id']; } else { return false; } }
protected function insertFeeRecord($form, $io_type) { $form['io_type'] = $io_type; $accountRecordsearch = new AccountRecord(); $accountRecordsearch->loadForm($form); $accountRecordsearch['money'] = isset($form['stage_number']) ? $form['stage_number'] * $form['fee_per_stage'] : 0; $creditAccoutnsearch = new CreditAccount(); $accountRecordsearch['in_account_id'] = $creditAccoutnsearch->findFinanceId($accountRecordsearch['out_account_id']); if ($accountRecordsearch['money'] > 0) { if ($accountRecordsearch->save()) { return $accountRecordsearch['id']; } else { return false; } } else { return 0; } }