Explorar o código

Merge branch 'develop'

wzq %!s(int64=5) %!d(string=hai) anos
pai
achega
060750ab23

+ 2 - 1
app/Repositories/CategoryRepository.php

@@ -25,6 +25,7 @@ class CategoryRepository {
             $where [] = ['is_suggest', 1];
             $data = [];
         }else{
+            $where [] = ['is_open', 1];
             $data = [
                 [
                     'id' => -2,
@@ -38,7 +39,7 @@ class CategoryRepository {
                 ]
             ];
         }
-        $categories =  $this->category->select('id', 'name', 'img')->where($where)->limit(50)->get()->toArray();
+        $categories =  $this->category->select('id', 'name', 'img')->where($where)->orderBy('sort', 'asc')->limit(50)->get()->toArray();
         return array_merge($data, $categories);
     }
     //获取多个话题

+ 9 - 4
app/Repositories/PostRepositories.php

@@ -558,18 +558,23 @@ class PostRepositories
 
         $where = [];
         $topic = $this->topic;
+        if(isset($request['name'])){
+            $where[] = ['topic.name', 'like', "%{$request['name']}%"];
+        }
+
         if(isset($request['category_id']) && $request['category_id']){
             if($request['category_id'] == -2){
                 $where[] = ['topic.is_hot', 1];
             }else{
-                $topic = $topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*');
+                $topic = $topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*','category_topic.id as cid');
                 $where[] = ['category_topic.category_id', $request['category_id']];
+                return $topic
+                    ->where($where)
+                    ->orderBy('cid','asc')
+                    ->paginate($perPage);
             }
         }
 
-        if(isset($request['name'])){
-            $where[] = ['topic.name', 'like', "%{$request['name']}%"];
-        }
         return $topic
             ->where($where)
             ->orderBy('id','desc')

+ 7 - 8
app/Service/DetectionService.php

@@ -90,15 +90,14 @@ class DetectionService
             Log::debug('detection-result:'.json_encode($sceneResult));
             //根据scene和suggetion做相关的处理
             $suggestion = $sceneResult->suggestion;
-            $rate = $sceneResult->rate;
-//            if($suggestion!='pass' && $rate>80){
-//                $flag = false;
-//            }
-            if ($suggestion == 'block') {
-                $flag = false;
-            } elseif ($suggestion == 'review' && $rate > 90) {
-                $flag = false;
+            $label = $sceneResult->label;
+            //如果为色情,辱骂,摄政,违禁 标签,并且建议为block 则不通过
+            if(in_array($label,['porn','abuse','politics','contraband','others'])){
+                if ($suggestion == 'block') {
+                    $flag = false;
+                }
             }
+
         }
     }