Plugin Directory

Changeset 3392635


Ignore:
Timestamp:
11/10/2025 03:56:52 AM (5 months ago)
Author:
infility
Message:

V2.14.18 (20251110) Ben: 抓取网页数据公共化

Location:
infility-global/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • infility-global/trunk/infility_global.php

    r3392620 r3392635  
    44Plugin URI: https://www.infility.cn/
    55Description: Infility公共插件
    6 Version: 2.14.17
     6Version: 2.14.18
    77Author: Infility
    88Author URI: https://www.infility.cn/
     
    129129V2.14.16 (20251030) Ben: 导航文章列表bug修复
    130130V2.14.17 (20251110) Ben: 抓取网页数据公共化
     131V2.14.18 (20251110) Ben: 抓取网页数据公共化
    131132*/
    132133
     
    134135    function __construct()
    135136    {
    136         define( 'INFILITY_GLOBAL_VERSION', '2.14.17' );
     137        define( 'INFILITY_GLOBAL_VERSION', '2.14.18' );
    137138        define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠
    138139        define( 'INFILITY_GLOBAL_URL', plugins_url( '/', __FILE__ ) ); // https://the_domain/wp-content/plugins/infility-global/ // 斜杠是自己加的
  • infility-global/trunk/widgets/infility-import-data/include/infility-import-site.php

    r3392620 r3392635  
    702702        $data = json_decode($list_data['data'],true);
    703703
    704         if($data['page_type']=='post'){return 100;}
    705 
    706         $sql = "SELECT count(*) as count FROM $table WHERE list_id=$list_id";
    707         $total_num = $wpdb->get_var($sql);
    708 
    709         $sql = "SELECT count(*) as count FROM $table WHERE list_id=$list_id AND status=1";
    710         $finish_num = $wpdb->get_var($sql);
    711         return ($finish_num/$total_num)*100;
     704        if($data['page_type']=='post'){
     705            $progress = 100;
     706        }else{
     707            $sql = "SELECT count(*) as count FROM $table WHERE list_id=$list_id";
     708            $total_num = $wpdb->get_var($sql);
     709
     710            $sql = "SELECT count(*) as count FROM $table WHERE list_id=$list_id AND status=1";
     711            $finish_num = $wpdb->get_var($sql);
     712
     713            $progress = ($finish_num/$total_num)*100;
     714        }
     715
     716        $wpdb->update($list_table,['progress'=>$progress],['id'=>$list_id]);
     717        return $progress;
    712718    }
    713719
  • infility-global/trunk/widgets/infility-import-data/infility-import-data.php

    r3392620 r3392635  
    157157            $operation='';
    158158            if($v['progress']!=100){
    159                 $operation .= '<a class="run" data-id="'.$v['id'].'" data-type="'.$v['type'].'" href="javascript:;">继续</a>';
     159                $info_data = json_decode($v['data'],true);
     160                $page_type = '';
     161                if(!empty($info_data['page_type'])){
     162                    $page_type = 'data-page-type="'.$info_data['page_type'].'"';
     163                }
     164                $operation .= '<a class="run" data-id="'.$v['id'].'" data-type="'.$v['type'].'" '.$page_type.' href="javascript:;">继续</a>';
    160165            }
    161166
  • infility-global/trunk/widgets/infility-import-data/js/infility_import_data.js

    r3327853 r3392635  
    1010        }
    1111
     12        let _this = $(this);
    1213        let parent = $(this).parents('tr');
    1314        let id = $(this).attr('data-id');
     
    3031
    3132                if(type==='url'){
    32                     let run_data = [];
    33                     if (data.product === true) {
    34                         run_data.push({action: 'search_site_category', id: id});//10%
    35                         run_data.push({action: 'search_site_product', id: id});//20%
    36                         run_data.push({action: 'get_site_products', id: id});//20%
    37                     }
    38 
    39                     if (data.blog === true) {
    40                         run_data.push({action: 'search_site_blogs', id: id});//10%
    41                         run_data.push({action: 'get_site_blogs', id: id});//10%
    42                     }
    43 
    44                     if (data.product === true || data.blog === true) {
    45                         run_data.push({action: 'add_term', id: id});//10%
    46                         run_data.push({action: 'add_post', id: id});//10%
    47                     }
    48 
     33                    let page_type = _this.attr('data-page-type');
     34                    let run_data = [];
     35                    if(page_type==='post'){
     36                        run_data.push({action:'get_post_detail',id:id});//10%
     37                    }else if(page_type==='category'){
     38                        run_data.push({action:'search_category_page',id:id});//10%
     39                        run_data.push({action:'search_category_post',id:id});//10%
     40                        run_data.push({action:'get_post_detail',id:id});//10%
     41                    }
    4942                    runProcess(run_data, button_obj, show_progress);
    5043                }else if(type==='excel'){
     
    181174                let id = data.id;
    182175                if(type==='url'){
    183                     let run_data = [];
    184                     if(data.product===true){
    185                         run_data.push({action:'search_site_category',id:id});//10%
    186                         run_data.push({action:'search_site_product',id:id});//20%
    187                         run_data.push({action:'get_site_products',id:id});//20%
    188                     }
    189 
    190                     if(data.blog===true){
    191                         run_data.push({action:'search_site_blogs',id:id});//10%
    192                         run_data.push({action:'get_site_blogs',id:id});//10%
    193                     }
    194 
    195                     if(data.product===true || data.blog===true){
    196                         run_data.push({action:'add_term',id:id});//10%
    197                         run_data.push({action:'add_post',id:id});//10%
    198                     }
    199 
    200                     if(run_data.length<=0){
    201                         button_obj.attr('is_run','false');
    202                         button_obj.text('完成');
    203                         return false;
     176                    let page_type = form_obj.find("select[name='page_type']").val();
     177
     178                    let run_data = [];
     179                    if(page_type==='post'){
     180                        run_data.push({action:'get_post_detail',id:id});//10%
     181                    }else if(page_type==='category'){
     182                        run_data.push({action:'search_category_page',id:id});//10%
     183                        run_data.push({action:'search_category_post',id:id});//10%
     184                        run_data.push({action:'get_post_detail',id:id});//10%
    204185                    }
    205186
Note: See TracChangeset for help on using the changeset viewer.