소스 검색

title去重

duqinya 6 년 전
부모
커밋
85d67e6d52
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      app/Repositories/CmsContentTemplateSetRepository.php

+ 10 - 1
app/Repositories/CmsContentTemplateSetRepository.php

@@ -421,8 +421,17 @@ class CmsContentTemplateSetRepository {
 
     public function getTemplate($cityId)
     {
-        return $this->cmsContentTemplate->select('id','title','apply_type')->where(['city_id'=>$cityId,'deleted_at'=>null])->orderBy('apply_type','asc')->get();
+        $template = $this->cmsContentTemplate->select('id','status','title','apply_type')->where(['city_id'=>$cityId,'deleted_at'=>null])->orderBy('apply_type','asc')->get();
+        $templates = $template->toArray();
+            foreach($templates as $key => $val) {
+                if ($val['status'] == 1) {
+                    unset($templates[$key]);
+                }
+            }
+
+        array_multisort(array_column($templates,'apply_type'),SORT_ASC,$templates);
 
+        return $templates;
     }
 
     public function templateSetDelete($request)