|
@@ -417,8 +417,19 @@ 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])->distinct('title')->orderBy('apply_type','asc')->get();
|
|
|
|
|
|
+ $template = $this->cmsContentTemplate->select('id','title','apply_type')->where(['city_id'=>$cityId,'deleted_at'=>null])->orderBy('apply_type','asc')->get();
|
|
|
|
|
|
|
|
+ $templates = $template->toArray();
|
|
|
|
+ $tmp_arr = array();
|
|
|
|
+ foreach($templates as $key => $val) {
|
|
|
|
+ if(in_array($val['title'],$tmp_arr)) { //搜索$val['title']是否在$tmp_arr数组中存在,若存在返回true
|
|
|
|
+ unset($templates[$key]);
|
|
|
|
+ } else {
|
|
|
|
+ $tmp_arr[] = $val['title'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sort($templates);
|
|
|
|
+ return $templates;
|
|
}
|
|
}
|
|
|
|
|
|
public function templateSetDelete($request)
|
|
public function templateSetDelete($request)
|