Procházet zdrojové kódy

修改预览条件

duqinya před 6 roky
rodič
revize
21d92b1dd4

+ 2 - 1
app/Repositories/CmsContentTemplateSetRepository.php

@@ -69,8 +69,9 @@ class CmsContentTemplateSetRepository
         foreach ($new_rule2 as $k => $v) {
             if ($v) {
                 $rules = $v['rule'];
+                $show_num = intval($rules['show_num']);
                 $show_type = $this->cmsSubject->select('show_type')->where('id', $rules['link_url'])->first();
-                $product = $this->cmsSubjectProduct->where('subject_id', $rules['link_url'])->orderBy('sort', 'asc')->get();
+                $product = $this->cmsSubjectProduct->where('subject_id', $rules['link_url'])->orderBy('sort', 'asc')->limit($show_num)->get();
                 $pro_array = $product->toArray();
                 $res_id = implode(",", array_column($pro_array, 'product_id'));
                 $new_rule2[$k]['product_id'] = $res_id;