pbootcms上系统日志添加爬虫头分类功能

因为pbootcms模板框架种默认的系统日记记录有爬虫信息,但是爬虫头又没分类查询,为了方便查询添加了一个爬虫头分类选择下拉框。
1.在apps/admin/view/default/system/syslog.html中添加爬虫头分类选择下拉框功能:

<form action="{url./admin/Syslog/index}" method="get" class="layui-form">

      <div class="layui-form-item nospace">

        <div class="layui-input-inline">

            {$pathinfo}

                      <select name="field" lay-verify="required">

                        <option value="0">全部</option>

                        <option value="Baidu" {if(get('field')=='Baidu')}selected="selected" {/if}>百度</option>

                        <option value="360sou" {if(get('field')=='360sou')}selected="selected" {/if}>360</option>

                        <option value="Yisou" {if(get('field')=='Yisou')}selected="selected" {/if}>易搜</option>

                        <option value="Byte" {if(get('field')=='Byte')}selected="selected" {/if}>Byte</option>

                        <option value="Bing" {if(get('field')=='Bing')}selected="selected" {/if}>微软必应</option>

                        <option value="Sougou" {if(get('field')=='Sougou')}selected="selected" {/if}>搜狗</option>

                        <option value="Google" {if(get('field')=='Google')}selected="selected" {/if}>谷歌</option>

                        <option value="other-bot" {if(get('field')=='other-bot')}selected="selected" {/if}>其他</option>

                      </select>

                     </div>

                     <div class="layui-input-inline">

                      <button class="layui-btn" lay-submit>搜索</button>

                     </div>

                </div>

</form>

2.修改apps/admin/model/system/SyslogModel.php文件中的getList添加爬虫头like查询:

public function getList($where)

{

    if($where == "0"){

        return parent::table('ay_syslog')->order('id DESC')->page()->select();

    }else{

        return parent::table('ay_syslog')->like('event',$where)->order('id DESC')->page()->select();

    }

}

3.apps/admin/controller/system/SyslogController.php中的index添加接受前端搜索表单提交过来的数据:

public function index()

    {

        if (isset($_GET['field'])) {

        $type_str = $_GET['field'];

        $this->assign('syslogs',$this->model->getList($type_str));

        $this->display('system/syslog.html');

      

        }

    }

改后样式:
在这里插入图片描述

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值