Пример #1
0
 /**
  * 修改企业用户信息
  */
 public function companyUpdateAction()
 {
     if (!IS_POST || !isset($_POST['id'])) {
         $this->redirect('index');
     }
     $userData['user_id'] = $_POST['id'];
     if ($this->user_id == $userData['user_id']) {
         $userData['username'] = safe::filterPost('username');
         $userData['email'] = safe::filterPost('email', 'email');
         $userData['head_photo'] = tool::setImgApp(safe::filterPost('imgfile4'));
         $companyData['company_name'] = safe::filterPost('company_name');
         $companyData['area'] = safe::filterPost('area', '/\\d{4,6}/');
         $companyData['address'] = safe::filterPost('address');
         $companyData['category'] = safe::filterPost('category', 'int');
         $companyData['nature'] = safe::filterPost('nature', 'int');
         $companyData['legal_person'] = safe::filterPost('legal_person');
         $companyData['reg_fund'] = safe::filterPost('reg_fund', 'float');
         $companyData['contact'] = safe::filterPost('contact');
         $companyData['contact_duty'] = safe::filterPost('contact_duty', 'int');
         $companyData['contact_phone'] = safe::filterPost('contact_phone', '/^\\d+$/');
         $companyData['check_taker'] = safe::filterPost('check_taker');
         $companyData['check_taker_phone'] = safe::filterPost('check_taker_phone', '/^\\d+$/');
         $companyData['check_taker_add'] = safe::filterPost('check_taker_add');
         $companyData['deposit_bank'] = safe::filterPost('deposit_bank');
         $companyData['bank_acc'] = safe::filterPost('bank_acc', '/^\\d+$/');
         $companyData['tax_no'] = safe::filterPost('tax_no');
         $companyData['qq'] = safe::filterPost('qq', '/^\\d{4,20}$/');
         $companyData['cert_bl'] = tool::setImgApp(safe::filterPost('imgfile1'));
         $companyData['cert_oc'] = tool::setImgApp(safe::filterPost('imgfile2'));
         $companyData['cert_tax'] = tool::setImgApp(safe::filterPost('imgfile3'));
         //  print_r($personData);exit;
         $um = new userModel();
         $res = $um->companyUpdate($userData, $companyData);
         if (isset($res['success']) && ($res['success'] == 1 || $res['success'] == 2)) {
             if ($res['success'] == 1) {
                 //数据发生变化,更改认证状态
                 $certObj = new \nainai\certificate();
                 $certObj->certInit($this->user_id);
             }
             $this->redirect('info');
         } else {
             echo $res['info'];
         }
     }
     return false;
 }