|
@@ -221,34 +221,43 @@ class AdService implements AdServiceInterface
|
|
|
$ad_places = $oldtemplate_data['ad'][$page];
|
|
|
}
|
|
|
// return Result::success($ad_places);
|
|
|
+ if($page == 'top'){
|
|
|
+ $ad_place = [
|
|
|
+ 'width' => $oldtemplate_data['ad'][$page]['width'],
|
|
|
+ 'height' => $oldtemplate_data['ad'][$page]['height'],
|
|
|
+ 'name'=>$template_data['name'], //广告位名称可更改
|
|
|
+ 'price'=>$template_data['price'], //广告位价格可更改
|
|
|
+ 'introduce'=>$template_data['introduce'], //广告位介绍可更改
|
|
|
+ 'website_id'=>$oldtemplate_data['ad'][$page]['website_id'],
|
|
|
+ 'thumb'=>$template_data['thumb'], //广告位默认图可更改
|
|
|
+ 'typeid'=>$oldtemplate_data['ad'][$page]['typeid'],
|
|
|
+ 'ad_tag'=>$oldtemplate_data['ad'][$page]['ad_tag'],
|
|
|
+ 'ad_url'=>$template_data['ad_url'], //广告位默认链接可更改
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ foreach($ad_places as $key=>$val){
|
|
|
+ if($template_data['ad_tag'] == $val['ad_tag']){
|
|
|
+ $ad_place[$key] = [
|
|
|
+ 'width' => $val['width'],
|
|
|
+ 'height' => $val['height'],
|
|
|
+ 'name'=>$template_data['name'], //广告位名称可更改
|
|
|
+ 'price'=>$template_data['price'], //广告位价格可更改
|
|
|
+ 'introduce'=>$template_data['introduce'], //广告位介绍可更改
|
|
|
+ 'website_id'=>$val['website_id'],
|
|
|
+ 'thumb'=>$template_data['thumb'], //广告位默认图可更改
|
|
|
+ 'typeid'=>$val['typeid'],
|
|
|
+ 'ad_tag'=>$val['ad_tag'],
|
|
|
+ 'ad_url'=>$template_data['ad_url'], //广告位默认链接可更改
|
|
|
|
|
|
- foreach($ad_places as $key=>$val){
|
|
|
- if($template_data['ad_tag'] == $val['ad_tag']){
|
|
|
- $ad_place[$key] = [
|
|
|
- 'width' => $val['width'],
|
|
|
- 'height' => $val['height'],
|
|
|
- 'name'=>$template_data['name'], //广告位名称可更改
|
|
|
- 'price'=>$template_data['price'], //广告位价格可更改
|
|
|
- 'introduce'=>$template_data['introduce'], //广告位介绍可更改
|
|
|
- 'website_id'=>$val['website_id'],
|
|
|
- 'thumb'=>$template_data['thumb'], //广告位默认图可更改
|
|
|
- 'typeid'=>$val['typeid'],
|
|
|
- 'ad_tag'=>$val['ad_tag'],
|
|
|
- 'ad_url'=>$template_data['ad_url'], //广告位默认链接可更改
|
|
|
+ ];
|
|
|
+ $template_ad = $ad_place[$key];
|
|
|
+ }else{
|
|
|
+ $ad_place[$key] = $val;
|
|
|
+ }
|
|
|
|
|
|
- ];
|
|
|
- $template_ad = $ad_place[$key];
|
|
|
- }else{
|
|
|
- $ad_place[$key] = $val;
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
- // return Result::success($ad_place);
|
|
|
-
|
|
|
- // 保存的模板中的广告位相关信息
|
|
|
- $oldtemplate_data['ad'][$page] = $ad_place;
|
|
|
-
|
|
|
- if(array_key_exists( $page,$oldtemplate_data['template'])){
|
|
|
+ if(array_key_exists( $page,$oldtemplate_data['template'])){
|
|
|
$ad_places_info = $oldtemplate_data['template'][$page];
|
|
|
}
|
|
|
foreach($ad_places_info as $key=>$val){
|
|
@@ -275,16 +284,23 @@ class AdService implements AdServiceInterface
|
|
|
];
|
|
|
}
|
|
|
}
|
|
|
+ $canvas_data['template'][$page] = $canvas_ad;
|
|
|
+ $oldtemplate_data['template'][$page] = $ad_info; //模板广告位相关信息已修改
|
|
|
+ }
|
|
|
+ // return Result::success($ad_place);
|
|
|
+
|
|
|
+ // 保存的模板中的广告位相关信息
|
|
|
+ $oldtemplate_data['ad'][$page] = $ad_place;
|
|
|
+
|
|
|
+
|
|
|
// Db::rollBack();
|
|
|
// }
|
|
|
- // return Result::success($canvas_ad);
|
|
|
- $oldtemplate_data['template'][$page] = $ad_info; //模板广告位相关信息已修改
|
|
|
- if($page_type[1] == 'top'){
|
|
|
- $canvas_data['topAd'] = $template_ad;
|
|
|
- }else{
|
|
|
- // $canvas_ad = $ad_info;
|
|
|
- $canvas_data['template'][$page] = $canvas_ad;
|
|
|
+
|
|
|
+
|
|
|
+ if($page == 'top'){
|
|
|
+ $canvas_data['topAd'] = $ad_place;
|
|
|
}
|
|
|
+ // return Result::success($canvas_data);
|
|
|
$template_module['canvas_data'] = json_encode($canvas_data,JSON_UNESCAPED_UNICODE);
|
|
|
$template_module['template_data'] = json_encode($oldtemplate_data,JSON_UNESCAPED_UNICODE);
|
|
|
$template_result = WebsiteTemplate::where('website_id',$template_data['website_id'])->update([
|