Sfoglia il codice sorgente

添加链接内容验证

duqinya 5 anni fa
parent
commit
9731feea90
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      app/Repositories/BannerRepository.php

+ 6 - 0
app/Repositories/BannerRepository.php

@@ -51,6 +51,9 @@ class BannerRepository
                 'rule' => json_encode($request['rule']),
             ];
         }else{
+            if (!is_int($request['link_content_id'])){
+                throw new HttpException(500, '链接内容必须是数字');
+            }
             $banner = [
                 'name' => $request['name'],
                 'link_content_id' => $request['link_content_id'],
@@ -101,6 +104,9 @@ class BannerRepository
             $this->bannerIds($request);
 
         }else{
+            if (!is_int($request['link_content_id'])){
+                throw new HttpException(500, '链接内容必须是数字');
+            }
             $banner->name = $request['name'];
             $banner->link_content_id = $request['link_content_id'];
             $banner->image = $request['image'];