zhanglinxin 1 year ago
parent
commit
bf0e3c6619
2 changed files with 42 additions and 32 deletions
  1. 40 32
      application/api/controller/Base.php
  2. 2 0
      application/api/controller/Member.php

+ 40 - 32
application/api/controller/Base.php

@@ -243,20 +243,34 @@ class Base extends Controller
     protected function checking($modulename, $controllername, $action_name)
     {
         $params = $this->request->post();
-
-        if (in_array($action_name, ['create', 'edit'])) {
-            $get_module_list = CommonConstant::get_module_list();
-            $rule = [
-                'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
-            ];
-            $message = [
-                'module.in' => '请选择正确的模块类型',
-            ];
-            $validate = new Validate($rule, $message);
-            if (!$validate->check($params)) {
-                $this->error($validate->getError());
+        if ($controllername == 'approveflow') {
+            if ($action_name == 'get_data') {
+                $get_module_list = CommonConstant::get_module_list();
+                $rule = [
+                    'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
+                ];
+                $message = [
+                    'module.in' => '请选择正确的模块类型',
+                ];
+                $validate = new Validate($rule, $message);
+                if (!$validate->check($params)) {
+                    $this->error($validate->getError());
+                }
             }
+        }
+        if ($controllername == 'approveinfo') {
             if ($action_name == 'create') {
+                $get_module_list = CommonConstant::get_module_list();
+                $rule = [
+                    'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
+                ];
+                $message = [
+                    'module.in' => '请选择正确的模块类型',
+                ];
+                $validate = new Validate($rule, $message);
+                if (!$validate->check($params)) {
+                    $this->error($validate->getError());
+                }
                 $id = $this->request->post('id');
                 $module = $this->request->post('module');
                 $validates = CommonConstant::get_module_validate_list();
@@ -266,18 +280,19 @@ class Base extends Controller
                     $this->error($validate->getError());
                 }
             }
-            if ($action_name == 'edit') {
-                $module = $this->request->post('module');
-                $validates = CommonConstant::get_module_validate_list();
-                $validate = $validates[$module];
-                $validate = new $validate;
-                if (!$validate->check($params, [], 'edit')) {
+            if (in_array($action_name, ['get_detail', 'get_info', 'urging', 'cancel'])) {
+                $rule = [
+                    'id|申请参数' => 'require|gt:0',
+                ];
+                $message = [];
+                $validate = new Validate($rule, $message);
+                if (!$validate->check($params)) {
                     $this->error($validate->getError());
                 }
             }
         }
-        if ($controllername == 'approveflow') {
-            if ($action_name == 'get_data') {
+        if ($controllername == 'approve') {
+            if ($action_name == 'edit') {
                 $get_module_list = CommonConstant::get_module_list();
                 $rule = [
                     'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
@@ -289,21 +304,14 @@ class Base extends Controller
                 if (!$validate->check($params)) {
                     $this->error($validate->getError());
                 }
-            }
-        }
-        if ($controllername == 'approveinfo') {
-            if (in_array($action_name, ['get_detail', 'get_info', 'urging', 'cancel'])) {
-                $rule = [
-                    'id|申请参数' => 'require|gt:0',
-                ];
-                $message = [];
-                $validate = new Validate($rule, $message);
-                if (!$validate->check($params)) {
+                $module = $this->request->post('module');
+                $validates = CommonConstant::get_module_validate_list();
+                $validate = $validates[$module];
+                $validate = new $validate;
+                if (!$validate->check($params, [], 'edit')) {
                     $this->error($validate->getError());
                 }
             }
-        }
-        if ($controllername == 'approve') {
             if (in_array($action_name, ['get_detail', 'get_info'])) {
                 $rule = [
                     'approve_id|审批参数' => 'require|gt:0',

+ 2 - 0
application/api/controller/Member.php

@@ -32,12 +32,14 @@ class Member extends Base
      * @Apidoc\Returned("signature", type="string", desc="个人签名")
      * @Apidoc\Returned("signature_status", type="string", desc="签名状态:0=待审核,1=审核通过,2=审核驳回")
      * @Apidoc\Returned("department_list", type="array", desc="部门列表")
+     * @Apidoc\Returned("subject", type="string", desc="主体名称")
      */
     public function user_info()
     {
         $user = $this->user;
         unset($user['status'],$user['is_deleted'],$user['create_at']);
         $user['department_list'] = Department::field('dept_id,name')->where('dept_id', 'in', $user['department'])->select();
+        $user['subject'] = '学校名称';
         $this->success('获取成功', $user);
     }