qifengquan 1 year ago
parent
commit
a7f182564e
1 changed files with 28 additions and 11 deletions
  1. 28 11
      application/api/controller/Authentication.php

+ 28 - 11
application/api/controller/Authentication.php

@@ -16,23 +16,40 @@ class Authentication extends Api
     public function authentication(){
         $mid = $this->check_login();
         $data = input();
-        if(empty($data['c_image'])){
-            $this->error('请上传单位证明');
-        }
+//        if(empty($data['c_image'])){
+//            $this->error('请上传单位证明');
+//        }
+//
+//        if(empty($data['n_image'])){
+//            $this->error('请上传电子会员凭证');
+//        }
+//        if(!$data['c_id']||!$data['n_id']||!$data['constellation']||!$data['hobby']||!$data['appeals']||!$data['hunshi']||!$data['is_zinv']||!$data['graduaction_school']){
+//            $this->error('参数不能为空');
+//        }
 
-        if(empty($data['n_image'])){
-            $this->error('请上传电子会员凭证');
-        }
-        if(!$data['c_id']||!$data['n_id']||!$data['constellation']||!$data['hobby']||!$data['appeals']||!$data['hunshi']||!$data['is_zinv']||!$data['graduaction_school']){
-            $this->error('参数不能为空');
+        $validate = Validate::make([
+            'c_image|单位证明'  => 'require',
+            'n_image|电子会员凭证'  => 'require',
+            'c_id|参数'  => 'require',
+            'n_id|参数'  => 'require',
+            'constellation|参数'  => 'require',
+            'hobby|参数'  => 'require',
+            'appeals|参数'  => 'require',
+            'hunshi|参数'  => 'require',
+            'is_zinv|参数'  => 'require',
+            'graduaction_school|参数'  => 'require',
+        ]);
+        if (!$validate->check($data)) {
+            $this->error($validate->getError());
         }
+
         if(isset($data['type'])) {
             $insert = [
                 'mid' => $mid,
                 'c_id' => $data['c_id'],
                 'n_id' => $data['n_id'],
-                'zhuxi'=>$data['zhuxi'],
-                'zhuxi_phone'=>$data['zhuxi_phone'],
+//                'zhuxi'=>$data['zhuxi'],
+//                'zhuxi_phone'=>$data['zhuxi_phone'],
                 'constellation'=>$data['constellation'],
                 'hobby'=>$data['hobby'],
                 'appeals'=>$data['appeals'],
@@ -47,7 +64,7 @@ class Authentication extends Api
                 'fa_work'=>$data['fa_work'],
                 'ma_work'=>$data['ma_work'],
                 'graduation_school'=>$data['graduaction_school'],
-                'position'=>$data['position'],
+//                'position'=>$data['position'],
                 'income'=>$data['income'],
                 'image'=>$data['image'],
                 'c_show_image' => $data['c_image'],