太阳成游戏网站

联系官方销售客服

QQ1835022299

028-61286886

太阳成游戏网站框架 版主:太阳成游戏网站框架研发组
如何修改内容采集范例,有标题存在更新内容
类型:太阳成游戏网站CMS 更新时间:2022-09-08 16:27:53 火车头内容采集

如何修改官方的 火车头内容采集范例 把里面的代码有标题存在就更新内容。


/doc/1084.html

回帖
  • 太阳成游戏网站框架技术-胡老师
    #1楼    太阳成游戏网站框架技术-胡老师
    2022-09-08 09:23:46
    Chrome 1
    $this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->update(0, ['updatetime'=>SYS_TIME]);
    遇到不会写代码,就在帖子里面加几块钱的悬赏(设置悬赏),系统会将赏金贴推送到微信和QQ群,可以得到更多人的帮助
  • 269406793
    #2楼    269406793
    2022-09-08 11:57:35
    Chrome 0
    太阳成游戏网站框架技术-胡老师 老师你好。$this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->update(0, ['updatetime'=>SYS_TIME]); // 验证标题重复 if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) { echo '重复';exit; }不行啊,不去掉重复的发布不了,去掉重复的就2个标题相同的内容了。
  • NGCM
    #3楼    NGCM
    2022-09-08 13:31:23
    Chrome 1
     // 验证标题重复
        if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) {
          $this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->update(0, ['updatetime'=>SYS_TIME]);
      echo '重复';exit;
        }


  • 269406793
    #4楼    269406793
    2022-09-08 14:28:42
    Chrome 0
    NGCM 发布的更新时间变了,但是内容还是之前的。
    image

    image
  • 269406793
    #5楼    269406793
    2022-09-08 14:31:10
    Chrome 0
    _module_init('article'); // news 是模块目录
    
    if ($_GET['action'] == 'category') {
        // 显示栏目
        if (!$this->module['category']) {
            echo '模块【'.$this->module['dirname'].'】没有创建栏目';
        }
        foreach ($this->module['category'] as $t) {
            if ($t['child'] == 0 && $t['tid'] == 1) {
                echo '

    '.$t['name'].'<=>'.$t['id'].'

    '.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')); // 去重复 $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]['inputtime'] = $save[1]['updatetime'] = SYS_TIME + rand(0, 7200); $save[1]['inputip'] = '127.0.0.1'; //$save[1]['keywords'] = dr_get_keywords( $save[1]['title']); // 按插件提取关键词 //$save[1]['description'] = dr_get_description( $save[0]['content'], 100); // 在内容里面提取100个子作为描述 // 验证标题重复 if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) { echo '重复';exit; } $rt = $this->content_model->save_content(0, $save); if ($rt['code']) { /* // 用于发布成功后生成静态文件代码 //dr_html_auth($_SERVER['SERVER_ADDR']); //dr_catcher_data(SITE_URL.'index.php?s='.MOD_DIR.'&c=html&m=showfile&id='.$rt['id']); $atcode = 'chtml_'.SITE_ID.'_'.MOD_DIR.'_'.$rt['code']; \Phpcmf\Service::L('cache')->set_auth_data($atcode, $rt['code'], SITE_ID); dr_catcher_data(SITE_URL.'index.php?s='.MOD_DIR.'&c=html&m=showfile&id='.$rt['code'].'&atcode='.$atcode); $save[1]['id'] = $save[0]['id'] = $rt['code']; \Phpcmf\Service::L('router')->show_url(\Phpcmf\Service::C()->module, $save[1]); */ exit('成功'); } else { exit('失败'); } } exit;
  • 小波工作室
    #6楼    小波工作室
    2022-09-08 14:32:39
    Chrome 1
     // 验证标题重复
        if ($rs = $this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->getRow()) {
          $this->content_model->table(SITE_ID.'_'.MOD_DIR.'_tableid_'.$rs['tableid'])->update($rs['id'], ['content'=>$save[0]['content']]);
      echo '更新成功';exit;
        }
  • 269406793
    #7楼    269406793
    2022-09-08 14:37:35
    Chrome 0
    小波工作室
    image
    小波不行啊,发布的时间都不更新
  • 小波工作室
    #8楼    小波工作室
    2022-09-08 16:22:20
    Chrome 0
     // 验证标题重复
        if ($rs = $this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->getRow()) {
        $this->content_model->table(SITE_ID.'_'.MOD_DIR)->update($rs['id'], ['updatetime'=>SYS_TIME]);
          $this->content_model->table(SITE_ID.'_'.MOD_DIR.'_tableid_'.$rs['tableid'])->update($rs['id'], ['content'=>$save[0]['content']]);
      echo '更新成功';exit;
        }
    记得把开发者模式打开
  • 269406793
    #9楼    269406793
    2022-09-08 16:24:58
    Chrome 0
    小波工作室 Table 'www_lycxz_com.dr_1_article_tableid_0' doesn't exist
    模板标签解析文件:/www/wwwroot/www.lycxz.com/dayrui/System/Database/MySQLi/Connection.php(292)
    错误页面访问地址:https://www.lycxz.com/api/Caiji.php?action=post
    https://www.lycxz.com/api/Caiji.php?action=post
  • 小波工作室
    #10楼    小波工作室
    2022-09-08 16:26:20
    Chrome 0
    // 验证标题重复
        if ($rs = $this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->getRow()) {
        $this->content_model->table(SITE_ID.'_'.MOD_DIR)->update($rs['id'], ['updatetime'=>SYS_TIME]);
          $this->content_model->table(SITE_ID.'_'.MOD_DIR.'_data_'.$rs['tableid'])->update($rs['id'], ['content'=>$save[0]['content']]);
      echo '更新成功';exit;
        }
    完毕,领赏
    满意答案
  • 269406793
    #11楼    269406793
    2022-09-08 16:27:53
    Chrome 0
    @小波工作室:厉害,厉害,可以