|
@@ -8,8 +8,6 @@ use App\Models\CmsContentTemplate;
|
|
use App\Models\CmsContentTemplateSet;
|
|
use App\Models\CmsContentTemplateSet;
|
|
use App\Models\CmsSubjectProduct;
|
|
use App\Models\CmsSubjectProduct;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
|
-use Illuminate\Database\QueryException;
|
|
|
|
|
|
|
|
class CmsContentTemplateSetRepository {
|
|
class CmsContentTemplateSetRepository {
|
|
public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
|
|
public function __construct(CmsContentTemplateSet $cmsContentTemplateSet,CmsContentTemplate $cmsContentTemplate,CmsSubjectProduct $cmsSubjectProduct,CmsSubject $cmsSubject) {
|
|
@@ -141,21 +139,28 @@ class CmsContentTemplateSetRepository {
|
|
*/
|
|
*/
|
|
public function preview($request)
|
|
public function preview($request)
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ $temalates = $this->cmsContentTemplate->select('title')->where(['id'=>$request['tpl_id']])->first();
|
|
|
|
+ if (!$temalates){
|
|
|
|
+ throw new HttpException(500, '没有找到对应模板');
|
|
|
|
+ }
|
|
|
|
+
|
|
//团购首页
|
|
//团购首页
|
|
$group_array = [];
|
|
$group_array = [];
|
|
if ($request['type'] == 0){
|
|
if ($request['type'] == 0){
|
|
$group_array['apply_type'] ="group";
|
|
$group_array['apply_type'] ="group";
|
|
- $group_array['title'] ="今日团购";
|
|
|
|
|
|
+ $group_array['title'] = $temalates->title;
|
|
$group_array['content'] =[];
|
|
$group_array['content'] =[];
|
|
}else{//菜市场首页
|
|
}else{//菜市场首页
|
|
$group_array['apply_type'] ="market";
|
|
$group_array['apply_type'] ="market";
|
|
- $group_array['title'] ="菜市场";
|
|
|
|
|
|
+ $group_array['title'] = $temalates->title;
|
|
$group_array['content'] =[];
|
|
$group_array['content'] =[];
|
|
}
|
|
}
|
|
|
|
|
|
$group_array['content'][0]['area_type'] ="banner";
|
|
$group_array['content'][0]['area_type'] ="banner";
|
|
$banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>0])->get();
|
|
$banner_rule = $this->cmsContentTemplateSet->select('id','rule')->where(['tpl_id'=>$request['tpl_id'],'area_type'=>0])->get();
|
|
$new_rule = [];
|
|
$new_rule = [];
|
|
|
|
+
|
|
foreach ($banner_rule->toArray() as $k=>$v){
|
|
foreach ($banner_rule->toArray() as $k=>$v){
|
|
$new_rule[] = $v;
|
|
$new_rule[] = $v;
|
|
}
|
|
}
|