Browse Source

广告位修改

rkljw 3 days ago
parent
commit
39a68bfeef
2 changed files with 42 additions and 28 deletions
  1. 2 1
      app/JsonRpc/AdService.php
  2. 40 27
      app/Model/AdPlace.php

+ 2 - 1
app/JsonRpc/AdService.php

@@ -256,7 +256,8 @@ class AdService implements AdServiceInterface
             if(isset($data['adPlaceList']) && $data['adPlaceList']){
                 foreach ($data['adPlaceList'] as $key=>$val){
                     $adSizeInfo = AdSize::firstOrCreate(['width'=>$val['width'],'height'=>$val['height']]);
-                    $adPlaceInfo = AdPlace::insertGetId(
+                    $adPlaceInfo = AdPlace::updateOrCreate(
+                        [ 'ad_tag'=>$val['ad_tag'],'website_id'=>$val['website_id']],
                         [
                             'website_id'=>$val['website_id'],
                             'typeid'=>$val['typeid'],

+ 40 - 27
app/Model/AdPlace.php

@@ -1,27 +1,40 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Model;
-
-use Hyperf\DbConnection\Model\Model;
-
-/**
- */
-class AdPlace extends Model
-{
-    /**
-     * The table associated with the model.
-     */
-    protected ?string $table = 'ad_place';
-
-    /**
-     * The attributes that are mass assignable.
-     */
-    protected array $fillable = [];
-
-    /**
-     * The attributes that should be cast to native types.
-     */
-    protected array $casts = [];
-}
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class AdPlace extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'ad_place';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [
+        'website_id',
+        'typeid',
+        'status',
+        'name',
+        'thumb',
+        'introduce',
+        'ad_tag',
+        'code',
+        'price',
+        'ad_size_id',
+        'ad_tag'
+        
+    ];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}