浏览代码

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)
     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)
     public function templateSetDelete($request)