Parcourir la source

修改广告位管理-修改广告的接口

15313670163 il y a 8 heures
Parent
commit
5f212b2dcb
3 fichiers modifiés avec 37 ajouts et 2 suppressions
  1. 8 1
      app/JsonRpc/AdService.php
  2. 2 1
      app/Model/AdPlace.php
  3. 27 0
      app/Model/Website.php

+ 8 - 1
app/JsonRpc/AdService.php

@@ -195,12 +195,13 @@ class AdService implements AdServiceInterface
         $web = AdPlace::where($where)
         ->leftJoin("website","website.id","ad_place.website_id")
         ->select("website.*","ad_place.name",'ad_place.ad_tag')
+
         ->first();
         if(empty($web)){
             return Result::error("广告位不存在");
         }
         // 自助建站广告位-广告位编辑同步模板数据-------fr----start
-
+        //  return Result::success($web);
         $website_column_arr_id = json_decode($web['website_column_arr_id'],true);
         Db::beginTransaction();
         try{
@@ -219,6 +220,8 @@ class AdService implements AdServiceInterface
                 if(array_key_exists( $page,$oldtemplate_data['ad'])){
                     $ad_places = $oldtemplate_data['ad'][$page];
                 }
+                // return Result::success($ad_places);
+
                 foreach($ad_places as $key=>$val){
                     if($template_data['ad_tag'] == $val['ad_tag']){
                         $ad_place[$key] = [
@@ -231,6 +234,8 @@ class AdService implements AdServiceInterface
                             'thumb'=>$template_data['thumb'],   //广告位默认图可更改
                             'typeid'=>$val['typeid'],
                             'ad_tag'=>$val['ad_tag'],
+                            'ad_url'=>$template_data['ad_url'],   //广告位默认链接可更改
+
                         ];
                         $template_ad = $ad_place[$key];
                     }else{
@@ -238,6 +243,8 @@ class AdService implements AdServiceInterface
 
                     }
                 }
+                // return Result::success($ad_place);
+
                 //  保存的模板中的广告位相关信息
                 $oldtemplate_data['ad'][$page] = $ad_place;
 

+ 2 - 1
app/Model/AdPlace.php

@@ -29,7 +29,8 @@ class AdPlace extends Model
         'code',
         'price',
         'ad_size_id',
-        
+        'ad_url',
+
     ];
 
     /**

+ 27 - 0
app/Model/Website.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Website extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}