|
@@ -421,16 +421,26 @@ class CmsContentTemplateSetRepository {
|
|
|
|
|
|
public function getTemplate($cityId)
|
|
|
{
|
|
|
- $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) {
|
|
|
+ $group = $this->cmsContentTemplate->select('id','status','title','apply_type')->where(['city_id'=>$cityId,'deleted_at'=>null,'apply_type'=>0])->get();//->orderBy('apply_type','asc')
|
|
|
+ $groups = $group->toArray();
|
|
|
+ if (count($groups)>1){
|
|
|
+ foreach($groups as $key => $val) {
|
|
|
if ($val['status'] == 1) {
|
|
|
- unset($templates[$key]);
|
|
|
+ unset($groups[$key]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- array_multisort(array_column($templates,'apply_type'),SORT_ASC,$templates);
|
|
|
-
|
|
|
+ }
|
|
|
+ $market = $this->cmsContentTemplate->select('id','status','title','apply_type')->where(['city_id'=>$cityId,'deleted_at'=>null,'apply_type'=>1])->get();//->orderBy('apply_type','asc')
|
|
|
+ $markets = $market->toArray();
|
|
|
+ if (count($markets)>1){
|
|
|
+ foreach($markets as $key => $val) {
|
|
|
+ if ($val['status'] == 1) {
|
|
|
+ unset($markets[$key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $templates = array_merge($groups,$markets);
|
|
|
+
|
|
|
return $templates;
|
|
|
}
|
|
|
|