|
@@ -253,23 +253,27 @@ class AdService implements AdServiceInterface
|
|
{
|
|
{
|
|
Db::beginTransaction();
|
|
Db::beginTransaction();
|
|
try {
|
|
try {
|
|
- $adSizeInfo = AdSize::firstOrCreate(['width'=>$data['width'],'height'=>$data['height']]);
|
|
|
|
- $adPlaceInfo = AdPlace::insertGetId(
|
|
|
|
- [
|
|
|
|
- 'website_id'=>$data['website_id'],
|
|
|
|
- 'typeid'=>$data['typeid'],
|
|
|
|
- 'status'=>2,
|
|
|
|
- 'name'=>$data['name']??'',
|
|
|
|
- 'thumb'=>$data['thumb']??'',
|
|
|
|
- 'introduce'=>$data['introduce']??'',
|
|
|
|
- 'code'=>$data['code']??'',
|
|
|
|
- 'price'=>0,
|
|
|
|
- 'ad_size_id'=>$adSizeInfo->id,
|
|
|
|
- 'ad_tag'=>$data['ad_tag']??'',
|
|
|
|
- ]
|
|
|
|
- );
|
|
|
|
|
|
+ if(isset($data['adPlaceList']) && $data['adPlaceList']){
|
|
|
|
+ foreach ($data['adPlaceList'] as $key=>$val){
|
|
|
|
+ $adSizeInfo = AdSize::firstOrCreate(['width'=>$val['width'],'height'=>$val['height']]);
|
|
|
|
+ $adPlaceInfo = AdPlace::insertGetId(
|
|
|
|
+ [
|
|
|
|
+ 'website_id'=>$val['website_id'],
|
|
|
|
+ 'typeid'=>$val['typeid'],
|
|
|
|
+ 'status'=>2,
|
|
|
|
+ 'name'=>$val['name']??'',
|
|
|
|
+ 'thumb'=>$val['thumb']??'',
|
|
|
|
+ 'introduce'=>$val['introduce']??'',
|
|
|
|
+ 'code'=>$val['code']??'',
|
|
|
|
+ 'price'=>0,
|
|
|
|
+ 'ad_size_id'=>$adSizeInfo->id,
|
|
|
|
+ 'ad_tag'=>$val['ad_tag']??'',
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
Db::commit();
|
|
Db::commit();
|
|
- return Result::success(['id'=>$adPlaceInfo]);
|
|
|
|
|
|
+ return Result::success([]);
|
|
}catch (\Exception $e){
|
|
}catch (\Exception $e){
|
|
Db::rollBack();
|
|
Db::rollBack();
|
|
return Result::error("创建广告位失败".$e->getMessage(),0);
|
|
return Result::error("创建广告位失败".$e->getMessage(),0);
|