duqinya 5 年之前
父節點
當前提交
5e283b021d
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      app/Repositories/BannerRepository.php

+ 10 - 0
app/Repositories/BannerRepository.php

@@ -54,6 +54,11 @@ class BannerRepository
             if (!is_int($request['link_content_id'])){
                 throw new HttpException(500, '链接内容必须是数字');
             }
+            $strlen = mb_strlen($request['name'], "utf-8");
+            if ($strlen > 20) {
+                throw new HttpException(500, '名称不能超过20字');
+            }
+
             $banner = [
                 'name' => $request['name'],
                 'link_content_id' => $request['link_content_id'],
@@ -107,6 +112,11 @@ class BannerRepository
             if (!is_int($request['link_content_id'])){
                 throw new HttpException(500, '链接内容必须是数字');
             }
+            $strlen = mb_strlen($request['name'], "utf-8");
+            if ($strlen > 20) {
+                throw new HttpException(500, '名称不能超过20字');
+            }
+
             $banner->name = $request['name'];
             $banner->link_content_id = $request['link_content_id'];
             $banner->image = $request['image'];