王君 3 سال پیش
والد
کامیت
9d41b0141c

+ 6 - 1
application/index/controller/Party.php

@@ -54,7 +54,12 @@ class Party extends Base
         $list = $result['data'];
         $l_c = new companylogic();
         foreach ($list as $key => $value) {
-            $uselist[] = $l_c->getinfowitchinventbyid($value['company_id']);
+            $where = ['id'=>$value['company_id'],'activestate'=>1];
+            $result = $l_c->getinfowitchinventbyid($where);
+            if(!$result['status']){
+                return backjson(0, $result['msg']);
+            }
+            $uselist[] = $result['data'];
         }
         return backjson(200, $uselist);
     }

+ 9 - 7
application/index/logic/baselogic.php

@@ -12,12 +12,6 @@ use think\Facade\Log;
 
 class baselogic
 {
-
-    private function getignoreurl()
-    {
-        $list = [];
-        return $list;
-    }
     /**
      * 根据配置验证param
      * wj
@@ -76,7 +70,7 @@ class baselogic
                     //正则
                     if (isset($value['regex'])) {
                         $regex = $value['regex'];
-                        if (preg_match($regex, $paramvalue)) {
+                        if (!preg_match($regex, $paramvalue)) {
                             throw new \Exception($title . '正则格式错误');
                         }
                     }
@@ -90,4 +84,12 @@ class baselogic
         }
         return backarr(1, 'success');
     }
+    /**
+     * 设置请求参数验证规则
+     *
+     * @return void
+     */
+    protected function setrules(){
+        return [];
+    }
 }

+ 11 - 3
application/index/logic/companylogic.php

@@ -26,11 +26,15 @@ class companylogic extends baselogic
                 ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
             ],
             'getinfobyid' => [
-                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'string'],
+                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
             ],
             'updatebyid' => [
-                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'string'],
+                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
             ],
+            'getinfowitchinventbyid'=>[
+                ['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
+                ['name' => 'activestate', 'title' => 'activestate', 'regex' => '/[0|1|2]{1}/'],
+            ]
         ];
         return $list;
     }
@@ -98,7 +102,11 @@ class companylogic extends baselogic
             return backarr(0, "无数据");
         }
         $m_i = new inventmodel();
-        $ilist = $m_i->getlist(['company_id' => $info['id'], "*", 1, 0]);
+        $where  = ['company_id' => $info['id']];
+        if(isset($arr['activestate'])){
+            $where['active_state'] = $arr['activestate'];
+        }
+        $ilist = $m_i->getlist($where, "*", 1, 0);
         $info['invent_list'] = $ilist;
         return backarr(1, "获取成功", $info);
     }

+ 3 - 3
application/index/logic/inventlogic.php

@@ -28,9 +28,9 @@ class inventlogic extends baselogic
             ],
             'getlistbywhere' => [
                 ['name' => 'companyid', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'],
-                ['name' => 'passstate', 'title' => 'passstate', 'type' => 'numeric', 'regex' => '[0|1|2]'],
-                ['name' => 'activestate', 'title' => 'activestate', 'type' => 'numeric', 'regex' => '[0|1]'],
-                ['name' => 'title', 'title' => 'title', 'type' => 'string', 'regex' => '*{5,}'],
+                ['name' => 'passstate', 'title' => 'passstate', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
+                ['name' => 'activestate', 'title' => 'activestate', 'type' => 'numeric', 'regex' => '/[0|1]{1}/'],
+                ['name' => 'title', 'title' => 'title', 'type' => 'string', 'regex' => '/*{5,}/'],
             ],
             'updatebyid' => [
                 ['name' => 'id', 'title' => 'companyid', 'require' => true, 'type' => 'numeric'],

+ 4 - 3
application/index/logic/partylogic.php

@@ -114,7 +114,7 @@ class partylogic extends baselogic
         if (empty($id)) {
             return backarr(0, "报名失败");
         }
-        return backarr(0, "报名成功", ['id' => $id]);
+        return backarr(1, "报名成功", ['id' => $id]);
     }
     /**
      * 获取列表
@@ -136,11 +136,12 @@ class partylogic extends baselogic
         $where = ['party_id' => $partyid];
         $page = isset($arr['page']) && !empty($arr['page']) ? $arr['page'] : 1;
         $size = isset($arr['size']) && !empty($arr['size']) ? $arr['size'] : 10;
-        $count = $m_i->getList($where, 'count');
+        $m_pr = new partyrecordmodel();
+        $count = $m_pr->getList($where, 'count');
         if ($count <= 0) {
             return backarr(0, "无数据");
         }
-        $list = $m_i->getList($where, '*', $page, $size);
+        $list = $m_pr->getList($where, '*', $page, $size);
         return backarr(1, "查询成功", $list);
     }
 }