Browse Source

兑换商城检测banner存在

durong 5 years ago
parent
commit
46946c3ff8
1 changed files with 11 additions and 0 deletions
  1. 11 0
      app/Repositories/CmsContentTemplateSetRepository.php

+ 11 - 0
app/Repositories/CmsContentTemplateSetRepository.php

@@ -361,6 +361,17 @@ class CmsContentTemplateSetRepository
 
         //同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
         $template = $this->cmsContentTemplate->select('id', 'city_name', 'city_id', 'title', 'apply_type', 'is_open', 'status')->where('id', $request['tpl_id'])->first();
+
+        //兑换商城检测banner是否设置
+        if ($template->apply_type == 2) {
+            $testing_banner = $this->cmsContentTemplateSet->select('rule')->where(['tpl_id' => $request['tpl_id'], 'area_type' => 0])->first();
+            $testing_banner = $testing_banner->toArray();
+            $rule = json_decode($testing_banner['rule'], true);
+            if (empty($testing_banner) || count($rule) == 0) {
+                throw new HttpException(500, '请先上传banner后再发布');
+            }
+        }
+
         $where = [
             'city_id' => $template->city_id,
             'title' => $template->title,