|
@@ -173,17 +173,21 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
Db::rollBack();
|
|
|
return Result::error("网站名称简写重复,请填写", 0);
|
|
|
}
|
|
|
- $ad_place = AdPlace::where('website_id', $data['id'])->select('ad_tag','id')->get();
|
|
|
+ $ad_place = AdPlace::where('website_id', $data['id'])->select('ad_tag','id')->get()->toArray();
|
|
|
if (!empty($ad_place)) {
|
|
|
foreach($ad_place as $key => $val){
|
|
|
$ad_keys = explode('_', $val['ad_tag']);
|
|
|
$ad_keys[0] = $data['ad_key'];
|
|
|
- $ad_tags[$key] = implode('_', $ad_keys);
|
|
|
- $up_adtags = AdPlace::where('id', $val['id'])->update(['ad_tag' => $ad_tags[$key]]);
|
|
|
- if(empty($up_adtags)){
|
|
|
- Db::rollBack();
|
|
|
- return Result::error("更新广告位置网站标识失败!", 0);
|
|
|
- }
|
|
|
+ $ad_place[$key]['ad_tag'] = implode('_', $ad_keys);
|
|
|
+
|
|
|
+ // $up_adtags = AdPlace::where('id', $val['id'])->update(['ad_tag' => $ad_tags[$key]]);
|
|
|
+
|
|
|
+ }
|
|
|
+ $up_adtags = AdPlace::upsert($ad_place, ['id'], ['ad_tag']);
|
|
|
+
|
|
|
+ if(empty($up_adtags)){
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error('广告位标识同步失败', 0);
|
|
|
}
|
|
|
}
|
|
|
$template = WebsiteTemplate::where('website_id', $data['id'])->first();
|