求助 版主:论坛审计组
的这个火车头采集接口我在火车头采集规则里已经写了采集时间的规
类型:迅睿CMS 更新时间:2019-12-11 13:59:40 火车头 接口 入库


官方的这个火车头采集接口,我在火车头采集规则里已经写了采集时间的规则,接口这里要怎么写才能把采集到的时间入库呀?


<?php


$this->_module_init('news'); // news 是模块目录

if ($_GET['action'] == 'category') {
    // 显示栏目

    foreach ($this->module['category'] as $t) {
        if ($t['child'] == 0 && $t['tid'] == 1) {
            echo '<h1>'.$t['name'].'<=>'.$t['id'].'</h1>'.PHP_EOL;
        }
    }

} else {
    // 入库数据

    $data = $_REQUEST;

    // 发布者id 1
    $data['uid'] = 1;

    // 发布者账号 admin
    $data['author'] = 'admin';

    // 主表字段
    $fields[1] = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR));
    $cache = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_category_data'));
    $cache && $fields[1] = array_merge($fields[1], $cache);

    // 附表字段
    $fields[0] = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_data_0'));
    $cache = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_category_data_0'));
    $cache && $fields[0] = array_merge($fields[0], $cache);

    // 去重复
    $fields[0] = array_unique($fields[0]);
    $fields[1] = array_unique($fields[1]);

    $save = [];

    // 主表附表归类
    foreach ($fields as $ismain => $field) {
        foreach ($field as $name) {
            isset($data[$name]) && $save[$ismain][$name] = $data[$name];
        }
    }
        if (!$data['catid']) {
            exit('栏目为空');
        }

    $save[1]['uid'] = $save[0]['uid'] = $data['uid'];
    $save[1]['catid'] = $save[0]['catid'] = $data['catid'];

    $save[1]['url'] = '';
    $save[1]['status'] = 9; //9表示正常发布,1表示审核里面
    $save[1]['hits'] = 0;
    $save[1]['displayorder'] = 0;
    $save[1]['link_id'] = 0;
    $save[1]['comments'] = 0;
    $save[1]['avgsort'] = 0;
    $save[1]['inputtime'] = $save[1]['updatetime'] = SYS_TIME + rand(0, 7200);
    $save[1]['inputip'] = '127.0.0.1';

    // 验证标题重复
    if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) {
        echo '重复';exit;
    }


    $rt = $this->content_model->save(0, $save);

    if ($rt['code']) {
        exit('成功');
    } else {
        exit('失败');
    }

}

exit;


回帖
  • #1楼    迅睿框架创始人
    2019-11-29 06:42:33
    Chrome 0
    1、采集火车头填写的表单值是什么2、采集具体值是什么
  • Booid.com
    #2楼    Booid.com
    2019-11-29 08:53:47
    Chrome 0
    ********此内容需要回复后才能看到********
  • 繁星
    #3楼    繁星
    2019-12-03 13:12:07
    Chrome 0
    Booid.com 不行呀!!!
    满意答案
  • Booid.com
    #4楼    Booid.com
    2019-12-03 13:33:54
    Chrome 0
    繁星什么不行?不什么不行?哪里不行?不行的数据是什么样的
  • 唉呦喂
    #5楼    唉呦喂
    2019-12-11 13:48:06
    Chrome 0
    不知道那个采集插件如何,值不值100元
  • 繁星
    #6楼    繁星
    2019-12-11 13:59:40
    Chrome 0
    @繁星:自己解决了!!!!!!!!!!