Просмотр исходного кода

fix(user): 添加参数验证防止空类型查询

- 在xfb_list方法中添加type参数必填验证
- 当type参数为空时返回参数错误提示
- 避免因缺少必要参数导致的潜在查询异常
shichen месяцев назад: 3
Родитель
Сommit
645c5465a4
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      app/controller/api/user/User.php

+ 3 - 0
app/controller/api/user/User.php

@@ -628,6 +628,9 @@ class User extends BaseController
628
     public function xfb_list()
628
     public function xfb_list()
629
     {
629
     {
630
         $type = $this->request->param('type');
630
         $type = $this->request->param('type');
631
+        if (!$type) {
632
+            return app('json')->fail('参数错误');
633
+        }
631
         [$page, $limit] = $this->getPage();
634
         [$page, $limit] = $this->getPage();
632
         $uid = $this->request->uid();
635
         $uid = $this->request->uid();
633
         $where['uid'] = $uid;
636
         $where['uid'] = $uid;