|
@@ -35,7 +35,7 @@ class CmsContentTemplateRepository {
|
|
|
*/
|
|
|
public function create($request)
|
|
|
{
|
|
|
- $where = ['city_id'=>$request['city_id'],'title'=>trim($request['title'])];
|
|
|
+ $where = ['city_id'=>$request['city_id'],'title'=>trim($request['title']),'apply_type'=>$request['apply_type']];
|
|
|
$template = $this->cmsContentTemplate->where($where)->get();
|
|
|
if (count($template) == 2){
|
|
|
throw new HttpException(500, '每个城市只能存在两个相同的模版');
|
|
@@ -69,17 +69,6 @@ class CmsContentTemplateRepository {
|
|
|
if ($request['city_id'] == 610100 && $request['is_open'] == 0){
|
|
|
throw new HttpException(500, '西安的模板不允许手动关闭');
|
|
|
}
|
|
|
- if ($request['is_open']==0){
|
|
|
- $where = [
|
|
|
- 'apply_type'=>$request['apply_type'],
|
|
|
- 'is_open'=>$request['is_open'],
|
|
|
- 'city_id'=>$request['city_id'],
|
|
|
- ];
|
|
|
- $template = $this->cmsContentTemplate->where($where)->get();
|
|
|
- if (count($template)<1){
|
|
|
- throw new HttpException(500, '同一城市同一模板必须有一个状态开启');
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
$template_id = $this->cmsContentTemplate->find($request['id']);
|
|
|
$template_id->is_open = $request['is_open'];
|