예제 #1
0
 public function executeFormWidget(dmWebRequest $request)
 {
     $form = new CarForm();
     if ($request->hasParameter($form->getName()) && $form->bindAndValid($request)) {
         $form->save();
         $this->redirectBack();
     }
     $this->forms['Car'] = $form;
 }
예제 #2
0
 /**
  * 车评 
  */
 public function carAction($uid, $action = null)
 {
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         $data['oid'] = $this->getOperatorId();
         if ($data['car_register_date']) {
             $data['car_register_date'] = strtotime($data['car_register_date']);
         }
         $model = new CarForm('assess');
         if ($model->validate($data)) {
             if ($model->assess()) {
                 //更新状态
                 LoanSketch::updateStatus($data['uid'], \App\LoanStatus::getStatusCarAssess());
                 Log::add($data['uid'], $data['oid'], \App\Config\Log::loanOperate('car'));
                 $this->success('操作成功');
             } else {
                 $this->error('操作失败');
             }
         } else {
             $this->error('验证失败');
         }
         exit;
     }
     empty($uid) and $this->pageError('param');
     $infos = $this->detail($uid, ['user', 'loansketch', 'car', 'car_files']);
     $infos['uid'] = $uid;
     $infos['doadvises_url'] = '/loan/doadvises/' . $uid;
     $infos['action'] = $action;
     $infos['can_modify_actions'] = $this->canModifyActions($uid, $infos['loansketch']['status']);
     $this->view->setVars($infos);
     $this->view->pick('loan/info/car');
 }