• 博主:孽 (云趣科技)
  • QQ:点击这里给我发消息
  • 微信:dylanv
  • 业务:切图,建站,二开,运维
文章目录

记一个PbootCms v2.0.9版本中的API接口搜索BUG

记一个PbootCms v2.0.9版本中的API接口搜索BUG
稿件作者 CMS博客 2020-05-21 01:08 PbootCMS教程 3113

场景复现

在使用PbootCms的过程中,需要用到Ajax搜索,就需要调用API接口中的search。在实际使用过程中出现了BUG,API接口并未返回正确有效的信息。

BUG解析

这个问题出现在ajax的post参数中,传入了num参数,而接口中的$where3变量中并未对num参数进行unset,导致$where3变量中多出了一个num值,导致SQL异常。

修复办法

apps\api\controller\CmsController.php文件的大约330行,加入unset($where3['num']);

// 去除特殊键值
unset($where3['appid']);
unset($where3['timestamp']);
unset($where3['signature']);
unset($where3['keyword']);
unset($where3['field']);
unset($where3['scode']);
unset($where3['page']);
unset($where3['from']);
unset($where3['isappinstalled']);
unset($where3['tdsourcetag']);
unset($where3['x']);
unset($where3['y']);
unset($where3['searchtpl']);
unset($where3['p']);
unset($where3['s']);
unset($where3['num']);

到此BUG修复。

联系客服

请使用QQ扫码
请使用微信扫码
回复时间:工作日下午4点30以后;周六周日不限。
  • 分享:

文章评论(审核通过可见)

说点什么
共有0条评论