From 8030eb59fccc390ac183e30d9c83b11e001d8f8f Mon Sep 17 00:00:00 2001 From: skycaiji <10957468+skycaiji@user.noreply.gitee.com> Date: Wed, 27 Sep 2023 22:35:43 +0800 Subject: [PATCH] 2.6 --- public/static/css/admin.css | 26 +- public/static/js/admin.js | 43 +- public/static/js/admin/collector.js | 78 +- public/static/js/admin/cpattern_test.js | 14 +- public/static/js/admin/index.js | 7 +- public/static/js/admin/release.js | 2 +- public/static/js/admin/setting.js | 14 +- public/static/js/admin/task.js | 19 +- public/static/js/langs/zh-cn.js | 2 +- skycaiji | 11 +- vendor/skycaiji/app/admin/behavior/Init.php | 4 + vendor/skycaiji/app/admin/command/Collect.php | 34 +- .../app/admin/controller/Backstage.php | 82 +- .../admin/controller/CollectController.php | 1 - .../app/admin/controller/Collector.php | 56 +- .../app/admin/controller/Cpattern.php | 40 +- .../app/admin/controller/CpatternTest.php | 59 +- .../skycaiji/app/admin/controller/Index.php | 38 +- .../skycaiji/app/admin/controller/Release.php | 10 +- .../skycaiji/app/admin/controller/Setting.php | 140 +++- vendor/skycaiji/app/admin/controller/Task.php | 34 +- .../skycaiji/app/admin/event/CollectBase.php | 25 + vendor/skycaiji/app/admin/event/Cpattern.php | 91 ++- .../skycaiji/app/admin/event/CpatternBase.php | 68 +- .../skycaiji/app/admin/event/CpatternColl.php | 770 +++++++++++++----- .../app/admin/event/CpatternEvent.php | 23 +- vendor/skycaiji/app/admin/event/Rapi.php | 2 +- vendor/skycaiji/app/admin/event/Rcms.php | 4 +- vendor/skycaiji/app/admin/event/Rdb.php | 5 +- vendor/skycaiji/app/admin/event/Rdiy.php | 2 +- .../skycaiji/app/admin/event/ReleaseBase.php | 58 +- vendor/skycaiji/app/admin/event/Rfile.php | 2 +- vendor/skycaiji/app/admin/event/Rtoapi.php | 3 +- vendor/skycaiji/app/admin/lang/zh-cn.php | 10 +- vendor/skycaiji/app/admin/model/Collector.php | 41 +- vendor/skycaiji/app/admin/model/Config.php | 185 ++++- .../skycaiji/app/admin/model/ReleaseApp.php | 2 +- vendor/skycaiji/app/admin/model/Task.php | 31 +- vendor/skycaiji/app/admin/model/User.php | 7 +- .../app/admin/view/backstage/index.html | 7 +- .../admin/view/collector/echo_url_msg.html | 28 + .../app/admin/view/collector/set.html | 2 +- .../app/admin/view/common/header_public.html | 2 +- .../skycaiji/app/admin/view/common/main.html | 5 +- .../app/admin/view/cpattern/content_sign.html | 44 +- .../app/admin/view/cpattern/field.html | 14 +- .../admin/view/cpattern/process_module.html | 18 +- .../skycaiji/app/admin/view/cpattern/set.html | 4 +- .../app/admin/view/cpattern/set_page.html | 160 +--- .../admin/view/cpattern/set_page_rule.html | 9 +- .../app/admin/view/cpattern/set_page_url.html | 202 +++++ .../admin/view/cpattern/set_pagination.html | 25 +- .../app/admin/view/cpattern/set_tpl.html | 14 +- .../admin/view/cpattern/test_source_urls.html | 6 +- .../skycaiji/app/admin/view/release/set.html | 22 +- .../app/admin/view/setting/caiji.html | 51 +- .../app/admin/view/setting/download_file.html | 47 +- .../view/setting/download_file_func.html | 49 ++ .../app/admin/view/setting/download_img.html | 47 +- .../admin/view/setting/download_img_func.html | 49 ++ .../app/admin/view/task/save_form.html | 91 +-- vendor/skycaiji/app/admin/view/user/add.html | 2 +- vendor/skycaiji/app/admin/view/user/edit.html | 2 +- vendor/skycaiji/app/command.php | 2 +- vendor/skycaiji/app/common.php | 2 +- .../app/common/command/SkycaijiCli.php | 116 +++ vendor/skycaiji/app/common/model/Config.php | 2 +- .../skycaiji/app/extend/util/ChromeSocket.php | 69 +- vendor/skycaiji/app/extend/util/Funcs.php | 27 +- vendor/skycaiji/app/extend/util/Param.php | 25 + .../skycaiji/app/extend/util/SwooleSocket.php | 408 ++++++++++ vendor/skycaiji/app/extend/util/Tools.php | 112 ++- vendor/skycaiji/app/extend/util/UnmaxPost.php | 90 ++ vendor/skycaiji/app/install/data/check_db | 2 +- vendor/skycaiji/app/install/data/check_file | 2 +- .../skycaiji/app/public/think_exception.tpl | 2 +- vendor/skycaiji/tp/base.php | 2 +- 77 files changed, 2797 insertions(+), 1007 deletions(-) create mode 100644 vendor/skycaiji/app/admin/view/collector/echo_url_msg.html create mode 100644 vendor/skycaiji/app/admin/view/cpattern/set_page_url.html create mode 100644 vendor/skycaiji/app/admin/view/setting/download_file_func.html create mode 100644 vendor/skycaiji/app/admin/view/setting/download_img_func.html create mode 100644 vendor/skycaiji/app/common/command/SkycaijiCli.php create mode 100644 vendor/skycaiji/app/extend/util/SwooleSocket.php create mode 100644 vendor/skycaiji/app/extend/util/UnmaxPost.php diff --git a/public/static/css/admin.css b/public/static/css/admin.css index df53a6c..25fc658 100644 --- a/public/static/css/admin.css +++ b/public/static/css/admin.css @@ -6,9 +6,33 @@ .info-box-content .info-box-number{font-weight:normal;line-height:25px;} .info-box-content .info-box-number .tips{margin-left:5px;font-size:14px;display:inline;} .help-block{color:#aaa;} +/*取消动画*/ +.content-wrapper, + .main-footer, + .main-header .navbar, + .main-header .logo, + .main-sidebar, + .sidebar-menu li>a>.fa-angle-left, + .sidebar-menu li>a>.pull-right-container>.fa-angle-left, + .control-sidebar-bg, + .control-sidebar, + .small-box .icon, + .direct-chat-messages, + .direct-chat-contacts, + .fc-color-picker>li .fa, + #add-new-event { + -webkit-transition:none!important; + -moz-transition:none!important; + -o-transition:none!important; + transition:none!important; +} /*全局*/ +.modal-body .form-group:last-child{margin-bottom:0;} +.modal-body .form-group .help-block:last-child{margin-bottom:0;} + .panel .form-group:last-child{margin-bottom:0;} .panel .form-group .help-block:last-child{margin-bottom:0;} +.panel .panel:last-child{margin-bottom:5px;} .label-custom-opened{font-weight:normal;background-color:#dedede;color:#555;} @@ -72,7 +96,7 @@ div.in-line-mg{display:inline;margin-right:5px;} .echo-msg-clear{width:100%;overflow:hidden;clear:both;} .echo-msg-lt{float:left;} -.echo-msg-lurl{float:left;margin-right:3px;height:16px;max-width:70%;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;word-break:break-all;} +.echo-msg-lurl{float:left;margin-right:3px;height:17px;max-width:70%;overflow:hidden;text-overflow:ellipsis;word-wrap:break-word;word-break:break-all;} /*皮肤*/ .skin-blue-light .treeview-skins,.skin-black-light .treeview-skins,.skin-red-light .treeview-skins,.skin-yellow-light .treeview-skins,.skin-purple-light .treeview-skins,.skin-green-light .treeview-skins{ diff --git a/public/static/js/admin.js b/public/static/js/admin.js index ba42247..fccc17f 100644 --- a/public/static/js/admin.js +++ b/public/static/js/admin.js @@ -7,15 +7,16 @@ | 使用协议 https://www.skycaiji.com/licenses |-------------------------------------------------------------------------- */ -'use strict';function admincpInit(){var bodyWidth=$(document.body).width();var admincp_skin=getCookie('admincp_skin');if(admincp_skin){$('body').removeClass('skin-blue').addClass(admincp_skin)} -if(bodyWidth>767){var admincp_sd_mini=getCookie('admincp_sd_mini');if(admincp_sd_mini==1){$('body').addClass('sidebar-collapse').addClass('sidebar-mini')}} -$(document).ready(function(){$('#treeview_skins').bind('click',function(){if($('#sidebar_skins').html().length<=0){initSkins()}});if(bodyWidth>767){var admincp_sd_mini=getCookie('admincp_sd_mini');if(admincp_sd_mini==1){$('#chk_sidebar_mini').prop('checked','checked')} -$('#chk_sidebar_mini').bind('click',function(){var setMini=0;if($(this).is(':checked')){$('body').addClass('sidebar-collapse').addClass('sidebar-mini');setMini=1}else{$('body').removeClass('sidebar-collapse').removeClass('sidebar-mini')} -setCookie('admincp_sd_mini',setMini,30)});$('.sidebar-toggle[data-toggle="push-menu"]').bind('click',function(){$('body').addClass('sidebar-mini')})}else{$('#chk_sidebar_mini').parents('li').eq(0).hide()} -if($('#menu_backstage_task').length>0){$('#menu_backstage_task').bind('click',function(){windowModal('采集任务',ulink('admin/backstage/backstageTask'),{lg:1})});winBackstageTask.count()}})} -function insertAtCaret(myField,myValue){myField=$(myField);var curObj=myField[0];if(document.selection){myField.focus();var sel=document.selection.createRange();sel.text=myValue;sel.select()}else if(curObj.selectionStart||curObj.selectionStart=='0'){var startPos=curObj.selectionStart;var endPos=curObj.selectionEnd;var restoreTop=curObj.scrollTop;var value=myField.val();value=value.substring(0,startPos)+myValue+value.substring(endPos,value.length);myField.val(value);myField.focus();curObj.selectionStart=startPos+myValue.length;curObj.selectionEnd=startPos+myValue.length}else{myField.val(myField.val()+myValue);myField.focus()}} -function initSkins(){var $skinsList=$('';curObj.children('.cont_urls_list').html(list).hide();curObj.children('.cont_urls_num').html('获取到'+urls.length+'条网址 [展开]')}}else{curObj.children('.cont_urls_list').html(''+data.msg+'').show()}}});$_o.url_ajax_requests.push(url_ajax_request)}}} function CpTestUrl(collId,testType,pageSource){this.coll_id=collId;this.test=testType?testType:'get_fields';this.test_async=!0;this.page_source=pageSource?pageSource:'';this.box_id='#win_test_url';this.test_ajax_requests=new Array()} CpTestUrl.prototype={constructor:CpTestUrl,ajax:function(params){var ajax_request=ajaxOpen(params);this.test_ajax_requests.push(ajax_request)},abort_test:function(){if(this.test_ajax_requests&&this.test_ajax_requests.length>0){for(var i in this.test_ajax_requests){this.test_ajax_requests[i].abort()} this.test_ajax_requests=new Array()}},load_input_url:function(func){var $_o=this;var urlParams=$($_o.box_id+' [name="url_params"]').val();var inputedUrls={};$('#win_input_urls').find('[name]').each(function(){inputedUrls[$(this).attr('name')]=$(this).val()});var pageSource=$($_o.box_id+' [name="page_source"]').val();var url=ulink('cpattern_test/input_url?test=_test_&coll_id=_collid_&page_source=_source_',{'_test_':$_o.test,'_collid_':$_o.coll_id,'_source_':pageSource});if($($_o.box_id+' button.dropdown-toggle').attr('data-test')=='get_signs'){if($('#win_test_signs').find('[name="signs_cur_all"]').is(':checked')){url+='&signs_cur_all=1'}} $_o.ajax({type:'post',url:url,dataType:'html',async:$_o.test_async,data:{url_params:urlParams,inputed_urls:inputedUrls},success:function(html){if(html){$('#win_input_urls').html(html).show()}else{$('#win_input_urls').html('').hide()} -var pageOpendObj=$('#win_input_urls').find('#input_url_page_opened');if(pageOpendObj.length>0){$($_o.box_id+' .test-page-opened').html(pageOpendObj.html()).show()}else{$($_o.box_id+' .test-page-opened').hide()} +var pageOpenedObj=$('#win_input_urls').find('#input_url_page_opened');if(pageOpenedObj.length>0){$($_o.box_id+' .test-page-opened').html(pageOpenedObj.html()).show()}else{$($_o.box_id+' .test-page-opened').hide()} execVarFuncs(func)}})},init:function(){var $_o=this;$($_o.box_id+' .dropdown-menu a[data-test]').bind('click',function(){$_o.abort_test();var btnObj=$(this).parents('.dropdown-menu').eq(0).siblings('button.dropdown-toggle').eq(0);var testName=$(this).attr('data-test');btnObj.attr('data-test',testName);btnObj.find('.test-tips').text($(this).attr('data-title'));if(testName=='get_html'||testName=='get_browser'||testName=='get_signs'||testName=='get_pagination'){$($_o.box_id+' [name="test_url"]').attr('placeholder','输入网址');$($_o.box_id+' .test-page-sources').show()}else{$($_o.box_id+' [name="test_url"]').attr('placeholder','输入内容页网址');$($_o.box_id+' .test-page-sources').hide()} $($_o.box_id+' .field-vals').html('');$_o.test=testName;if(testName=='get_signs'){$('#win_test_signs').show()}else{$('#win_test_signs').hide()} if(testName=='get_pagination'){$('#win_test_pagination').show()}else{$('#win_test_pagination').hide()} $_o.load_input_url()});$($_o.box_id+' [name="page_source"]').bind('change',function(){$_o.abort_test();$_o.load_input_url()});$($_o.box_id).off('click','[data-test-code]').on('click','[data-test-code]',function(){var objId='#'+$(this).attr('data-test-code');visualizeData('
'+htmlspecialchars($(objId).val())+'
')});$($_o.box_id).off('click','[data-test-visualize]').on('click','[data-test-visualize]',function(){var objId='#'+$(this).attr('data-test-visualize');visualizeData($(objId).val())});$($_o.box_id+' button.test-sub').bind('click',function(){$_o.abort_test();var testOp=$($_o.box_id+' button.dropdown-toggle').attr('data-test');testOp=testOp?testOp:'get_fields';$_o.test_async=testOp=='get_browser'?false:!0;$_o.load_input_url(function(){var test_url=$($_o.box_id+' input[name="test_url"]').val();var page_source=$($_o.box_id+' [name="page_source"]').val();if(!test_url){toastr.error('请输入网址')}else{$($_o.box_id+' .field-vals').html('
');var url=ulink('cpattern_test/_op_?coll_id=_collid_&page_source=_source_&test_url=_url_',{'_op_':testOp,'_source_':page_source,'_collid_':$_o.coll_id,'_url_':test_url});$('#win_input_urls').find('[name]').each(function(){url+='&'+$(this).attr('name')+'='+encodeURIComponent($(this).val())});if(testOp=='get_html'){$_o.ajax({type:'get',url:url,dataType:'html',success:function(data){if(dataIsJson(data)){var json=eval('('+data+')');if(json.msg){$($_o.box_id+' .field-vals').html(json.msg)}else{var html='
';$($_o.box_id+' .field-vals').html(html);var jsonTreeFunc=function(){window.tool_json_tree.treeId='#win_json_tree';window.tool_json_tree.load(data)};if(window.tool_json_tree){jsonTreeFunc()}else{$.getScript(window.site_config.pub+'/static/js/admin/tool_json_tree.js',jsonTreeFunc)}}}else{var eleId=generateUUID();data=data.replace(/\/g,'>');var html=' 预览/分析网页';$($_o.box_id+' .field-vals').html(html);$($_o.box_id).find('[data-test-browser]').bind('click',function(){var pageSource=$($_o.box_id+' [name="page_source"]').val();var testUrl=$($_o.box_id+' input[name="test_url"]').val();var inputedUrls={};$('#win_input_urls').find('[name]').each(function(){inputedUrls[$(this).attr('name')]=$(this).val()});var browserUrl=cpBrowserUrl($_o.coll_id,pageSource,testUrl,inputedUrls);window.open(browserUrl,'_blank')})}}})}else{if(testOp=='get_signs'){if($('#win_test_signs').find('[name="signs_cur_all"]').is(':checked')){url+='&signs_cur_all=1'}}else if(testOp=='get_pagination'){url+='&pagination_type='+$('#win_test_pagination').find('[name="pagination_type"]:checked').val()} -$_o.ajax({type:'get',url:url,dataType:'json',async:$_o.test_async,success:function(data){if(data.code==1){var html='';if(testOp=='get_pagination'){var pnType=data.data.pagination_type;var pnUrls=data.data.urls;if(!pnType){html='