ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯系官方銷售客服

1835022288

028-61286886

投訴 已解決 采集入庫,允許標題和內容重復 7 0
老鐵666(全能人才) SVIP會員 OEM版權 2020-08-26 15:40:32 私信
迅睿CMS版本:4.3.5

火車頭采集入庫的話,允許標題和內容重復的話,需要屏蔽掉里邊的哪一段代碼?

本部分內容設定了隱藏,需要回復后才能看到
解決方案
  • 還要回復才能看到內容幫你,誰有那么閑啊

  • 回復@曼德拉的鉛筆

    <?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'];
        $imgs = dr_get_content_img($save[0]['content']);
        $save[1]['thumb'] = (string)$imgs[0];
        $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;
  • 可能點錯地方了,居然需要回復

  • 回復看看,你在求助嘛你把代碼別弄成回復可見啊

  • 回復@秋冬 粘貼了,可能點錯地方了。

    <?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'];
        $imgs = dr_get_content_img($save[0]['content']);
        $save[1]['thumb'] = (string)$imgs[0];
        $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;
  • 刪除這句話就可以不驗證標題重復了

        // 驗證標題重復
        //if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) {
           // echo '重復';exit;
        //}
    滿意答案
    短信幣+1
  • // 驗證標題重復
        if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) {
            echo '重復';exit;
        }

    刪除這句應該就允許重復了吧,雖然我不太懂代碼,你這個已經中文標注了,一眼就看出來了

  • @何先生:我也是這么覺得