diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e7d2cec --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +使用协议:https://www.skycaiji.com/licenses \ No newline at end of file diff --git a/readme.txt b/README.md similarity index 57% rename from readme.txt rename to README.md index e8108f6..7f826e3 100644 --- a/readme.txt +++ b/README.md @@ -1,4 +1,6 @@ 将本压缩包上传至您的服务器,如果根目录有站点建议放在子目录里,解压后打开浏览器输入您的服务器域名或ip地址(存放在子目录则加上子目录的名称)进入安装界面。 -使用手册:https://www.skycaiji.com/manual -安装协议:https://www.skycaiji.com/licenses \ No newline at end of file + +入门手册:[https://www.skycaiji.com/manual](https://www.skycaiji.com/manual) + +使用协议:[https://www.skycaiji.com/licenses](https://www.skycaiji.com/licenses) \ No newline at end of file diff --git a/public/static/css/admin.css b/public/static/css/admin.css index 5ab0e46..2885a1f 100644 --- a/public/static/css/admin.css +++ b/public/static/css/admin.css @@ -64,7 +64,7 @@ div.in-line-mg{display:inline;margin-right:5px;} .table-responsive .table:last-child{margin-bottom:0;} .table-responsive .table input.form-control{min-width:150px;} .table-responsive .table textarea.form-control{min-width:150px;} -.table-responsive .table select.form-control{min-width:70px;} +.table-responsive .table select.form-control{min-width:90px;} .icon-info-tips{font-size:12px;cursor:pointer;color:#bbb;} .icon-info-tips:hover{color:#3c8dbc;} @@ -435,6 +435,7 @@ table.table thead .sorting_desc:after { } /**/ #cms_bind em{color:red;} +#toapi_app_params em{color:red;} /*my store*/ .nav-tabs-color li.active{border-top-color:#3c8dbc!important;} @@ -623,4 +624,6 @@ footer.footer-end{display:none;} .c-p-url-web-form td:first-child,.c-p-url-web-header td:first-child{width:auto;} .p-m-api-table td:first-child,.p-m-api-header-table td:first-child{width:auto;} .toapi-param-table td:first-child,.toapi-header-table td:first-child{width:auto;} + + .list-footer .form-control{width:100%!important;} } \ No newline at end of file diff --git a/public/static/js/admin.js b/public/static/js/admin.js index 936fa94..f105e63 100644 --- a/public/static/js/admin.js +++ b/public/static/js/admin.js @@ -41,7 +41,7 @@ html+=''}}} funcObj.append(html);if(params.cache){window[winCacheName]=html}}}},error:function(xhr,status,error){funcObj.removeAttr('data-is-loaded');toastr.error('函数插件载入失败:'+status+' '+error)},complete:function(xhr,status){setFuncVal()}})}}} function tipsPluginFunc(module){var tips='';if(module=='process'){tips='

如需扩展系统函数,请在根目录/data/config.php中添加配置:

'+"

'EXTEND_PROCESS_FUNC'=>array('PHP函数名'=>'描述')

"+'

如需扩展插件函数,可创建函数插件

'}else if(module=='processIf'){tips='

选择函数,取反可获取函数结果的相反值

'+'

默认将当前字段作为参数传入,如需传入多个参数,一行一个值,可输入任何内容或调用字段

'+'

请按函数传参,否则运行出错!

'+'

如需扩展系统函数,请在根目录/data/config.php中添加配置:

'+"

'EXTEND_PROCESS_IF'=>array('PHP函数名'=>'描述')

"+'

如需扩展插件函数,可创建函数插件

'}else if(module=='downloadImg'||module=='contentSign'){window.open(ulink('develop/func?module='+module));return!1} confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} -function tipsCurlPost(){var tips='

表单数据:模拟form表单输入的数据

表单上传:模拟form表单输入并上传的数据

'+'

JSON数组:以json格式发送数据,可在“发送数据”的值中直接输入json字符串,根节点名称使用###表示,子节点名称使用.分隔,例如:a.b.c

';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} +function tipsCurlPost(){var tips='

表单数据:模拟form表单输入的数据

表单上传:模拟form表单输入并上传的数据

'+'

JSON数组:以json格式发送数据,可在“发送数据”的“值”中直接输入json字符串。在“名称”中填入json数组键名,根节点名称使用###表示,子节点名称使用.分隔,例如:a.b.c

';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})} function collectorWindow(title,uri,uriVals,options){options=options?options:{};options.backdrop_static=1;title=isNull(title)?'':title;title+='
';window.win_collector_window_params={title:title,uri:uri,uriVals:uriVals,options:options};windowModal(title,ulink('admin/collector/echo_msg?op=run'),{lg:options.lg})} var collectorEchoMsg={config:{},processes:{},close_non_stop:!1,end_set_timeout:null,run:function(config){collectorEchoMsg.config=isObject(config)?config:{};collectorEchoMsg.processes={};collectorEchoMsg.close_non_stop=!1;var winParams=window.win_collector_window_params;winParams=isObject(winParams)?winParams:{};var uri=winParams.uri?winParams.uri:'';var uriVals=isObject(winParams.uriVals)?winParams.uriVals:{};var options=isObject(winParams.options)?winParams.options:{};var winProcessBox=$('#myModal #win_cem_process_box').clone();if(uri){var title=winParams.title+'日志读取间隔';var closeFuncs=new Array();if(!isNull(options.close_func)){if(isObject(options.close_func)){closeFuncs=options.close_func}else{closeFuncs.push(options.close_func)}} closeFuncs.push(function(){if(!collectorEchoMsg.close_non_stop){collectorEchoMsg.stop_all()}});options.close_func=closeFuncs;windowIframe(title,'',options);$('#myModal #myModalIframe').hide();$('#myModal #win_cem_interval_btn').bind('click',function(){collectorEchoMsg.set_interval($('#win_cem_interval').val())});var runUrl=ulink(uri,uriVals);ajaxOpen({type:'get',url:runUrl,dataType:'json',async:!0,success:function(data){if(data.code==1){var processes=data.data?data.data:{};var collectorKey=processes.collector_key?processes.collector_key:'';var processKeys=isObject(processes.process_keys)?processes.process_keys:[];var processNum=processKeys.length;if(!collectorKey||processNum<=0){return} diff --git a/public/static/js/admin/collected.js b/public/static/js/admin/collected.js index 2b839ac..e1d5a63 100644 --- a/public/static/js/admin/collected.js +++ b/public/static/js/admin/collected.js @@ -8,7 +8,7 @@ |-------------------------------------------------------------------------- */ 'use strict';function CollectedClass(){} -CollectedClass.prototype={constructor:CollectedClass,init_list:function(){$('#list_table .delete').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"GET",url:obj.attr('url'),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);if(data.code==1){obj.parents('tr').eq(0).remove()}}})})});$('#deleteall').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"POST",url:ulink('collected/op?op=deleteall'),dataType:"json",data:$('#form_list').serialize(),success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);window.setTimeout("window.location.reload();",2500)}})})});$('#btn_clear_error').bind('click',function(){windowModal('清理失败的数据',ulink('collected/clearError'))})},chart_init:function(){$('#chart_date [data-chart-op]').bind('click',function(){if(!$('#chart_date').attr('data-chart-tpl')){$('#chart_date').attr('data-chart-tpl',$('#chart_date .chart-box').prop('outerHTML'))} +CollectedClass.prototype={constructor:CollectedClass,init_list:function(){$('#list_table .delete').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"GET",url:obj.attr('url'),dataType:"json",success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);if(data.code==1){obj.parents('tr').eq(0).remove()}}})})});$('#deleteall').bind('click',function(){var obj=$(this);confirmRight(window.tpl_lang.confirm_delete,function(){ajaxOpen({type:"POST",url:ulink('collected/op?op=deleteall'),dataType:"json",data:$('#form_list').serialize(),success:function(data){data.code==1?toastr.success(data.msg):toastr.error(data.msg);window.setTimeout("window.location.reload();",2500)}})})});$('#btn_clear_error').bind('click',function(){windowModal('清理失败的数据',ulink('collected/clearError'))});$.datetimepicker.setLocale('zh');$('#form_search input[name="begin"],#form_search input[name="end"]').datetimepicker()},chart_init:function(){$('#chart_date [data-chart-op]').bind('click',function(){if(!$('#chart_date').attr('data-chart-tpl')){$('#chart_date').attr('data-chart-tpl',$('#chart_date .chart-box').prop('outerHTML'))} $('#chart_date .nav-tabs>li').removeClass('active');$(this).parents('li').eq(0).addClass('active');$('#chart_date .chart-loading').show();$('#chart_date .chart-canvas').remove();var chartOp=$(this).attr('data-chart-op');ajaxOpen({type:"GET",url:ulink('collected/chartOp?op='+chartOp),dataType:"json",success:function(data){var chartData={labels:[],datasets:[{label:"发布成功",data:[],backgroundColor:'rgba(54, 162, 235, 0.2)',borderColor:'rgba(54, 162, 235, 1)',borderWidth:1,},{label:"发布失败",data:[],backgroundColor:'rgba(255, 99, 132, 0.2)',borderColor:'rgba(255, 99, 132, 1)',borderWidth:1,}]};if(data.code==1&&data.data){var nameData=data.data.name;var successData=data.data.success;var failedData=data.data.failed;if(nameData){for(var i in nameData){chartData.labels.push(nameData[i]);chartData.datasets[0].data.push(successData[i]?successData[i]:0);chartData.datasets[1].data.push(failedData[i]?failedData[i]:0)}}} $('#chart_date .chart-box').html($('#chart_date').attr('data-chart-tpl'));$('#chart_date .chart-loading').hide();var chart=$("#chart_date .chart-canvas").get(0).getContext("2d");chart=new Chart(chart,{type:'line',data:chartData,options:{maintainAspectRatio:!1,tooltips:{mode:'index',intersect:!1,}}});chart.canvas.parentNode.style.height='300px'}})});$('#chart_date [data-chart-op="today"]').trigger('click');ajaxOpen({type:"GET",url:ulink('collected/chartOp?op=release'),dataType:"json",success:function(data){var chartData={labels:[],datasets:[{label:"发布成功",data:[],backgroundColor:'rgba(54, 162, 235, 0.2)',borderColor:'rgba(54, 162, 235, 1)',pointBackgroundColor:'rgba(54, 162, 235, 0.2)',pointBorderColor:'rgba(54, 162, 235, 1)',borderWidth:1,},{label:"发布失败",data:[],backgroundColor:'rgba(255, 99, 132, 0.2)',borderColor:'rgba(255, 99, 132, 1)',pointBackgroundColor:'rgba(255, 99, 132, 0.2)',pointBorderColor:'rgba(255, 99, 132, 1)',borderWidth:1,}]};if(data.code==1&&data.data){var nameData=data.data.name;var successData=data.data.success;var failedData=data.data.failed;if(nameData){for(var i in nameData){chartData.labels.push(nameData[i]);chartData.datasets[0].data.push(successData[i]?successData[i]:0);chartData.datasets[1].data.push(failedData[i]?failedData[i]:0)}} $('#chart_release .chart-loading').hide();$('#chart_release .chart-canvas').show();var chart=$("#chart_release .chart-canvas").get(0).getContext("2d");chart=new Chart(chart,{type:'radar',data:chartData,options:{maintainAspectRatio:!1,tooltips:{mode:'index',intersect:!1,}}});chart.canvas.parentNode.style.height='300px'}}});ajaxOpen({type:"GET",url:ulink('collected/chartOp?op=task'),dataType:"json",success:function(data){var chartData={labels:[],datasets:[{label:"采集数量",data:[],backgroundColor:'rgba(54, 162, 235, 0.2)',}]};if(data.code==1&&data.data){var nameData=data.data.name;var totalData=data.data.total;if(nameData){for(var i in nameData){if(nameData[i]&&totalData[i]){chartData.labels.push(nameData[i]);chartData.datasets[0].data.push(totalData[i])}}} diff --git a/public/static/js/admin/collector.js b/public/static/js/admin/collector.js index e961816..6b593d4 100644 --- a/public/static/js/admin/collector.js +++ b/public/static/js/admin/collector.js @@ -187,7 +187,7 @@ $($_o.processBox+' .process-add').bind('click',function(){var module=$($_o.proce $($_o.processForm).on('click','.p-m-html-tags a[data-val]',function(){var tag=$(this).attr('data-val');var moduleHtml=$(this).parents('.p-m-html-tags').eq(0).attr('module-html');var tagsObj=$(this).parents('section').eq(0).find('input[data-process="html:'+moduleHtml+'"]');var tags=tagsObj.val()+','+tag;tags=tags.replace(/(^,+)|(,+$)/,'');tagsObj.val(tags)});$($_o.processForm).on('change','[data-process="insert:insert_loc"]',function(){var helpEle=$(this).siblings('.help-block');if($(this).val()=='rand'){helpEle.show()}else{helpEle.hide()}});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_from"]',ipt:'[data-process="translate:translate_from_custom"]'});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="translate:translate_to"]',ipt:'[data-process="translate:translate_to_custom"]'});$_o.txt_insert_field($_o.processForm,'.p-m-func-field',function(sltObj){return $(sltObj).parents('section').eq(0).find('[data-process="func:func_param"]')});$($_o.processForm).on('click','.p-m-if-add',function(){var ifTable=$(this).parents('section').eq(0).find('.p-m-if-table');ifTable.append(''+ifTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-if-del',function(){var tr=$(this).parents('tr').eq(0);confirmRight('确定删除?',function(){tr.remove()})});$($_o.processForm).on('change','[data-process="if:if_cond:"]',function(){var ifCond=$(this).val();var ifTr=$(this).parents('tr').eq(0);var ifTd=ifTr.find('.p-m-if-val').eq(0);var ifVal=ifTd.find('[data-process="if:if_val:"]').eq(0);var ifValInfo={name:ifVal.attr('name'),val:ifVal.val(),process:ifVal.attr('data-process')};var ifValType='def';if(ifCond=='func'){ifValType='func'}else if(ifCond.indexOf('time_')>-1){ifValType='time'} ifTd.find('.p-m-if-val-def,.p-m-if-val-time,.p-m-if-val-func').hide();ifTd.find('[data-process="if:if_val:"]').removeAttr('name').removeAttr('data-process');var ifValBox=ifTd.find('.p-m-if-val-'+ifValType);var ifValEle=ifValBox.find('.p-m-if-val-ele');ifValEle.attr('name',ifValInfo.name).attr('data-process',ifValInfo.process).val(ifValInfo.val);ifValBox.show();if(ifValType=='func'){$_o.load_if_func(ifTd,null)}});$($_o.processForm).on('change','.p-m-if-val-time-date select',function(){$(this).parents('tr').eq(0).find('[data-process="if:if_val:"]').val($(this).val())});$($_o.processForm).on('click','.p-m-if-val-func-info',function(){tipsPluginFunc('processIf')});$_o.txt_insert_field($_o.processForm,'.p-m-if-val-func-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="if:if_val:"]')});$($_o.processForm).on('click','.p-m-if-info',function(){var tips='

执行顺序:从上至下判断,逻辑符“并且”的优先级高于“或者”

'+'

例如(字母表示条件):

'+'

a && b || c && d && e || f || g && h && i && j 等同于

'+'

(a && b) || (c && d && e) || f || (g && h && i && j)

'+'

括号中的条件都为真时才是真否则为假,整条语句中任意一个括号的结果为真最终结果为真,都为假最终结果为假

';confirmRight({msg:tips,yes:'确定',width:500,textAlign:'left'})});$($_o.processForm).on('click','.p-m-api-add',function(){var apiTable=$(this).parents('section').eq(0).find('.p-m-api-table table');apiTable.find('tbody').append(''+apiTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-api-del',function(){var tr=$(this).parents('tr').eq(0);tr.remove()});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="api:api_charset"]',ipt:'[data-process="api:api_charset_custom"]'});inputSelectCustom(null,null,{box:$_o.processForm,slt:'[data-process="api:api_encode"]',ipt:'[data-process="api:api_encode_custom"]'});$($_o.processForm).on('change','[data-process="api:api_params:val:"],[data-process="api:api_headers:val:"]',function(){var isHeader=!1;if($(this).attr('data-process')=='api:api_headers:val:'){isHeader=!0} var val=$(this).val();var tdObj=$(this).parents('td').eq(0);var iptObj=tdObj.find('[data-process="api:'+(isHeader?'api_headers':'api_params')+':addon:"]');var sltObj=tdObj.find('.p-m-api-'+(isHeader?'header':'val')+'-field');iptObj.hide();sltObj.hide();if(val=='time'||val=='custom'){if(val=='time'){iptObj.attr('placeholder','默认格式:Y-m-d H:i:s')}else if(val=='custom'){iptObj.attr('placeholder','输入任何内容');sltObj.css('display','table-cell')} -iptObj.show()}});$_o.txt_insert_field($_o.processForm,'.p-m-api-val-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_params:addon:"]')});$_o.txt_insert_field($_o.processForm,'.p-m-api-header-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_headers:addon:"]')});$($_o.processForm).on('click','.p-m-api-header-add',function(){var apiHdTable=$(this).parents('section').eq(0).find('.p-m-api-header-table table');apiHdTable.find('tbody').append(''+apiHdTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-api-header-del',function(){var tr=$(this).parents('tr').eq(0);tr.remove()});$($_o.processForm).on('change','[data-process="api:api_type"]',function(){var obj=$(this).parents('section').eq(0).find('.p-m-api-content-type');if($(this).val()=='post'){obj.show()}else{obj.hide()}});$($_o.processForm).on('change','[data-process="api:api_json_arr"]',function(){var ipt=$(this).parent().find('[data-process="api:api_json_implode"]');if($(this).val()=='implode'){ipt.show()}else{ipt.hide()}});$($_o.processForm).on('click','.sign-wildcard',function(){var toObj=$(this).parent().siblings('[data-process="replace:replace_from"]');cpWildcard(toObj)});$($_o.processForm).on('click','.c-p-process-title',function(){var panelTitle=$(this).parents('.panel').eq(0).find('.panel-title-title');if(panelTitle.find('input').is(':visible')){panelTitle.find('*').show();panelTitle.find('input').hide()}else{panelTitle.find('*').hide();panelTitle.find('input').show()}});(function(processForm,processBox){$(processForm).on('click','.c-p-process-clone',function(){var panelObj=$(this).parents('.panel[data-name^="process"]').eq(0);var formEle=document.createElement('form');$(formEle).append(panelObj.clone());$(panelObj).find('[name^="process"]').each(function(index){var processEle=$(formEle).find('[name^="process"]').eq(index);if($(this).is('input:radio')||$(this).is('input:checkbox')){processEle.prop('checked',$(this).is(':checked'))}else{processEle.val($(this).val())}});confirmRight({msg:'拷贝或复制数据处理',yes:'复制',no:'拷贝',close:!0},function(){ajaxOpen({type:'POST',dataType:'json',url:ulink('cpattern/clone_process'),data:$(formEle).serialize(),success:function(data){if(data.code==1){$_o.processForm=processForm;$_o.processBox=processBox;$_o.add(data.data);toastr.success(data.msg)}}})},function(){ajaxOpen({type:'POST',dataType:'json',url:ulink('cpattern/clone_process?op=copy'),data:$(formEle).serialize(),success:function(data){if(data.code==1){toastr.success(data.msg)}}})})})})($_o.processForm,$_o.processBox);$($_o.processForm).on('click','.c-p-process-del',function(){$_o.del(this)});eleExchange($_o.processForm+' .c-p-process-accordion','.panel-title-ops .icon-drag-move','.panel');if(processData){for(var i in processData){if(processData[i]){$_o.add(processData[i])}}} +iptObj.show()}});$_o.txt_insert_field($_o.processForm,'.p-m-api-val-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_params:addon:"]')});$_o.txt_insert_field($_o.processForm,'.p-m-api-header-field select',function(sltObj){return $(sltObj).parents('td').eq(0).find('[data-process="api:api_headers:addon:"]')});$($_o.processForm).on('click','.p-m-api-header-add',function(){var apiHdTable=$(this).parents('section').eq(0).find('.p-m-api-header-table table');apiHdTable.find('tbody').append(''+apiHdTable.attr('data-tpl')+'')});$($_o.processForm).on('click','.p-m-api-header-del',function(){var tr=$(this).parents('tr').eq(0);tr.remove()});$($_o.processForm).on('change','[data-process="api:api_type"]',function(){var obj=$(this).parents('section').eq(0).find('.p-m-api-content-type');if($(this).val()=='post'){obj.show()}else{obj.hide()}});$($_o.processForm).on('change','[data-process="api:api_json_arr"]',function(){var ipt=$(this).parent().find('.p-m-api-json-implode');if($(this).val()=='implode'){ipt.show()}else{ipt.hide()}});$($_o.processForm).on('click','.sign-wildcard',function(){var toObj=$(this).parent().siblings('[data-process="replace:replace_from"]');cpWildcard(toObj)});$($_o.processForm).on('click','.c-p-process-title',function(){var panelTitle=$(this).parents('.panel').eq(0).find('.panel-title-title');if(panelTitle.find('input').is(':visible')){panelTitle.find('*').show();panelTitle.find('input').hide()}else{panelTitle.find('*').hide();panelTitle.find('input').show()}});(function(processForm,processBox){$(processForm).on('click','.c-p-process-clone',function(){var panelObj=$(this).parents('.panel[data-name^="process"]').eq(0);var formEle=document.createElement('form');$(formEle).append(panelObj.clone());$(panelObj).find('[name^="process"]').each(function(index){var processEle=$(formEle).find('[name^="process"]').eq(index);if($(this).is('input:radio')||$(this).is('input:checkbox')){processEle.prop('checked',$(this).is(':checked'))}else{processEle.val($(this).val())}});confirmRight({msg:'拷贝或复制数据处理',yes:'复制',no:'拷贝',close:!0},function(){ajaxOpen({type:'POST',dataType:'json',url:ulink('cpattern/clone_process'),data:$(formEle).serialize(),success:function(data){if(data.code==1){$_o.processForm=processForm;$_o.processBox=processBox;$_o.add(data.data);toastr.success(data.msg)}}})},function(){ajaxOpen({type:'POST',dataType:'json',url:ulink('cpattern/clone_process?op=copy'),data:$(formEle).serialize(),success:function(data){if(data.code==1){toastr.success(data.msg)}}})})})})($_o.processForm,$_o.processBox);$($_o.processForm).on('click','.c-p-process-del',function(){$_o.del(this)});eleExchange($_o.processForm+' .c-p-process-accordion','.panel-title-ops .icon-drag-move','.panel');if(processData){for(var i in processData){if(processData[i]){$_o.add(processData[i])}}} $($_o.processForm).prop('inited',1)},add_sub:function(){var $_o=this;ajaxOpen({type:'POST',dataType:'json',url:$($_o.processForm).attr('action'),data:$($_o.processForm).serialize(),success:function(data){if(data.code==1){$('#myModal').modal('hide');if(data.data&&data.data.objid){$($_o.$_cp.formid+' #'+data.data.objid).find('input[name="config[field_process][]"]').val(data.data.process_json?url_base64encode(data.data.process_json):'');var ptitle='';var processData=data.data.process;if(processData){ptitle=[];for(var i in processData){ptitle.push(window.tpl_lang['process_module_'+processData[i].module]+(processData[i].title?(':'+processData[i].title):''))} ptitle=ptitle.join(' / ')} if(processData&&ptitle){$($_o.$_cp.formid+' #'+data.data.objid).find('.field-process').addClass('exist-process').attr('title',ptitle)}else{$($_o.$_cp.formid+' #'+data.data.objid).find('.field-process').removeClass('exist-process').attr('title','')}}}else{toastr.error(data.msg)}},error:function(data){toastr.error(data)}});return!1},del:function(obj){var $_o=this;confirmRight('是否删除?',function(){$(obj).parents('.panel').eq(0).remove()})},load_if_func:function(box,setVal){var $_o=this;loadPluginFunc({module:'processIf',boxObj:box,funcObj:'[data-process="if:if_addon:func:"]',paramObj:'[data-process="if:if_val:"]',funcVal:setVal,cache:!0})},add:function(params){var $_o=this;params=params?params:{};if(!params.module){toastr.error('请选择处理方式');return!1} diff --git a/public/static/js/admin/index.js b/public/static/js/admin/index.js index 059ba01..8bcffbf 100644 --- a/public/static/js/admin/index.js +++ b/public/static/js/admin/index.js @@ -16,6 +16,7 @@ if(data.is_new_admin_index){$('#refresh_admin_index').trigger('click')}}else{$(' if(data.phpCliVersion){$('#php_cli_version').show().find('span').html(data.phpCliVersion)} if(data.pageRenderInvalid){list.push('页面渲染')} if(list.length>0){list=list.join(' , ');$('#invalid_list').find('[data-box]').html(list);$('#invalid_list').fadeIn()} +if(data.repairTables){$('#repair_tables').find('[data-box]').html(data.repairTables);$('#repair_tables').fadeIn();$('#repair_tables button').bind('click',function(){windowModal('正在修复表...',ulink('backstage/repairTables'),{ajax:{type:'post',data:{'tables':data.repairTables}}})})} if(data.tongji){for(var i in data.tongji){$('#data_'+i).text(data.tongji[i])}}}}})});function UpgradeZipClass(size,blocks){this.size=size?toInt(size):0;this.blocks=blocks?toInt(blocks):0;this.nextBlockNo=0;this.existBlocks=0} UpgradeZipClass.prototype={constructor:UpgradeZipClass,down_zip:function(blockNo){var $_o=this;blockNo=toInt(blockNo);$_o.nextBlockNo=0;var url=ulink('upgrade/downZip?block_no='+blockNo);ajaxOpen({type:'get',dataType:'json',url:url,success:function(data){if(data.code==1){var dataData=data.data;$_o.nextBlockNo=toInt(dataData.next_block_no);$_o.existBlocks=toInt(dataData.exist_blocks);var existSize=toInt(dataData.exist_size);existSize=existSize/(1024*1024);existSize=Math.floor(existSize*100)/100;$('#op_upgrade').find('.size').text(existSize+'MB')}else{$('#upgrade_error').show();if(data.msg){$('#upgrade_error').append(data.msg+"\r\n")}else{$('#upgrade_error').append('下载失败:压缩包文件块'+(blockNo+1)+"\r\n")}}},error:function(){$('#upgrade_error').show();$('#upgrade_error').append('下载失败:压缩包文件块'+(blockNo+1)+"\r\n")},complete:function(){if($_o.existBlocks>=$_o.blocks){$_o.down_complete()}else{if($_o.nextBlockNo>0){$_o.down_zip($_o.nextBlockNo)}else{$('#op_upgrade').removeAttr('upgrading').html('请刷新界面重新下载失败的文件!')}}}})},down_complete:function(){$('#op_upgrade').html('正在更新文件...');ajaxOpen({type:'get',dataType:'json',url:ulink('upgrade/downZipComplete?'+urlUsertoken()),success:function(data){if(data.code==1){$('#op_upgrade').html('更新成功')}else{$('#op_upgrade').html('更新失败')}}})}} function UpgradeClass(fileList){this.fileList=fileList;this.fileNum=fileList?fileList.length:0;this.downNum=0} diff --git a/public/static/js/admin/release.js b/public/static/js/admin/release.js index 9e91a68..e4ae77c 100644 --- a/public/static/js/admin/release.js +++ b/public/static/js/admin/release.js @@ -9,14 +9,14 @@ */ 'use strict';function ReleaseClass(formid,releid){this.formid='#'+formid;this.releid=releid} ReleaseClass.prototype={constructor:ReleaseClass,init:function(){var $_o=this;$($_o.formid).bind('submit',function(){var module=$($_o.formid+' select[name="module"]').val();if(module=='diy'&&$_o.has_diy_editor()){var diyCode=editorCodeIfr('#diy_editor_ifr',{'get_value':1});if(diyCode){$($_o.formid+' [name="diy[code]"]').val(diyCode)}} -var settings=getFormAjaxSettings($(this));ajaxOpen(settings);return!1});$($_o.formid+' select[name="module"]').bind('change',function(){var module=$(this).val();$($_o.formid+' .rele-module').hide();$($_o.formid+' .rele-module[module="'+module+'"]').show()});$('#btn_import_release').bind('click',function(){windowModal('导入配置会覆盖当前任务的发布设置,且不可恢复',ulink('release/import'))});$('#rele_module_cms .btn-cms-detect').bind('click',function(){$_o.cms_detect()});$('#rele_module_cms .btn-cms-bind').bind('click',function(){$_o.cms_bind()});$('#rele_module_cms').on('change','select[name="cms[app]"]',function(){var cmsApp=$(this).val();$_o.cms_bind({cms:{app:cmsApp}})});$('#cms_list').on('click','li a',function(){var path=$(this).attr('path');if(path){$($_o.formid+' [name="cms[path]"]').val(path);$('#cms_tab a[href="#cms_tab_bind"]').tab('show');$_o.cms_bind()}});$('#rele_module_cms').on('change','select[name^="cms_app[param]"]',function(){var cusName=$(this).attr('name').replace('cms_app[param]','cms_app[custom]');if($(this).val()=='custom:'){$('input[name="'+cusName+'"]').show()}else{$('input[name="'+cusName+'"]').hide()}});$('#db_tab_config .dm-db-charset li span').bind('click',function(){var charset=$(this).attr('data-val');charset=charset?charset:'';$('#db_tab_config [name="db[charset]"]').val(charset)});$('#db_tab_config .btn-db-names').bind('click',function(){$_o.db_connect('db_names')});$('#db_tab_config .btn-db-connect').bind('click',function(){$_o.db_connect()});$('#rele_module_file').on('click','.btn-file-rand-path',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="file[path]"]').val(randStr)});$('#rele_module_api').on('click','.btn-api-rand-url',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="api[url]"]').val(randStr)});$('#diy_tab').on('click','[data-type]',function(){var type=$(this).attr('data-type');$($_o.formid+' [name="diy[type]"]').val(type);if(type=='code'&&$_o.has_diy_editor()){var diyCode=$($_o.formid+' [name="diy[code]"]').val();diyCode=diyCode?diyCode:'';editorCodeIfr('#diy_editor_ifr',{'set_value':diyCode})}});$('#rele_module_toapi').on('change','[name="toapi[type]"]',function(){if($(this).val()=='post'){$('#rele_module_toapi .toapi-content-type').show()}else{$('#rele_module_toapi .toapi-content-type').hide()}});$('#rele_module_toapi').on('click','.toapi-add-param',function(){$_o.toapi_add_param(null,null)});$('#rele_module_toapi').on('click','.toapi-del-param',function(){$(this).parents('tr').eq(0).remove()});inputSelectCustom('#rele_module_toapi [name="toapi[charset]"]','toapi[charset_custom]');inputSelectCustom('#rele_module_toapi [name="toapi[encode]"]','toapi[encode_custom]');inputSelectCustom(null,null,{box:'#rele_module_toapi',slt:'[name="toapi[param_val][]"]',ipt:'[name="toapi[param_addon][]"]'});$('#rele_module_toapi').on('click','.toapi-add-header',function(){$_o.toapi_add_header(null,null)});$('#rele_module_toapi').on('click','.toapi-del-header',function(){$(this).parents('tr').eq(0).remove()});inputSelectCustom(null,null,{box:'#rele_module_toapi',slt:'[name="toapi[header_val][]"]',ipt:'[name="toapi[header_addon][]"]'});$('#btn_rele_test').bind('click',function(){collectorWindow('测试','admin/release/test?id='+$_o.releid,null,{lg:1})})},load:function(data){var $_o=this;if(data.module){$($_o.formid+' select[name="module"]').val(data.module).trigger('change')} +var settings=getFormAjaxSettings($(this));ajaxOpen(settings);return!1});$($_o.formid+' select[name="module"]').bind('change',function(){var module=$(this).val();$($_o.formid+' .rele-module').hide();$($_o.formid+' .rele-module[module="'+module+'"]').show()});$('#btn_import_release').bind('click',function(){windowModal('导入配置会覆盖当前任务的发布设置,且不可恢复',ulink('release/import'))});$('#rele_module_cms .btn-cms-detect').bind('click',function(){$_o.cms_detect()});$('#rele_module_cms .btn-cms-bind').bind('click',function(){$_o.cms_bind()});$('#rele_module_cms').on('change','select[name="cms[app]"]',function(){var cmsApp=$(this).val();$_o.cms_bind({cms:{app:cmsApp}})});$('#cms_list').on('click','li a',function(){var path=$(this).attr('path');if(path){$($_o.formid+' [name="cms[path]"]').val(path);$('#cms_tab a[href="#cms_tab_bind"]').tab('show');$_o.cms_bind()}});$('#rele_module_cms').on('change','select[name^="cms_app[param]"]',function(){var cusName=$(this).attr('name').replace('cms_app[param]','cms_app[custom]');if($(this).val()=='custom:'){$('input[name="'+cusName+'"]').show()}else{$('input[name="'+cusName+'"]').hide()}});$('#db_tab_config .dm-db-charset li span').bind('click',function(){var charset=$(this).attr('data-val');charset=charset?charset:'';$('#db_tab_config [name="db[charset]"]').val(charset)});$('#db_tab_config .btn-db-names').bind('click',function(){$_o.db_connect('db_names')});$('#db_tab_config .btn-db-connect').bind('click',function(){$_o.db_connect()});$('#rele_module_file').on('click','.btn-file-rand-path',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="file[path]"]').val(randStr)});$('#rele_module_api').on('click','.btn-api-rand-url',function(){var randStr=$_o.rand_str(10);$($_o.formid+' [name="api[url]"]').val(randStr)});$('#diy_tab').on('click','[data-type]',function(){var type=$(this).attr('data-type');$($_o.formid+' [name="diy[type]"]').val(type);if(type=='code'&&$_o.has_diy_editor()){var diyCode=$($_o.formid+' [name="diy[code]"]').val();diyCode=diyCode?diyCode:'';editorCodeIfr('#diy_editor_ifr',{'set_value':diyCode})}});$('#toapi_tab').on('click','[data-module]',function(){var module=$(this).attr('data-module');$($_o.formid+' [name="toapi[module]"]').val(module)});$('#rele_module_toapi').on('change','[name="toapi[type]"]',function(){if($(this).val()=='post'){$('#rele_module_toapi .toapi-content-type').show()}else{$('#rele_module_toapi .toapi-content-type').hide()}});$('#rele_module_toapi').on('click','.toapi-add-param',function(){$_o.toapi_add_param(null,null)});$('#rele_module_toapi').on('click','.toapi-del-param',function(){$(this).parents('tr').eq(0).remove()});$('#rele_module_toapi').on('click','.toapi-txt-field a[data-val]',function(){insertAtCaret($(this).parents('.toapi-txt-field').eq(0).find('input:text').eq(0),$(this).attr('data-val'))});inputSelectCustom('#rele_module_toapi [name="toapi[charset]"]','toapi[charset_custom]');inputSelectCustom('#rele_module_toapi [name="toapi[encode]"]','toapi[encode_custom]');$('#rele_module_toapi').on('click','.toapi-add-header',function(){$_o.toapi_add_header(null,null)});$('#rele_module_toapi').on('click','.toapi-del-header',function(){$(this).parents('tr').eq(0).remove()});$('#toapi_app_url_field').bind('change',function(){var val=$(this).val();$(this).val('');insertAtCaret($('#rele_module_toapi [name="toapi[app_url]"]'),val)});$('#btn_toapi_app').bind('click',function(){$('#toapi_app_params').html('
');ajaxOpen({type:'post',url:ulink("release/toapiApp"),data:{'task_id':$($_o.formid+' [name="task_id"]').val(),'app_url':$('#rele_module_toapi [name="toapi[app_url]"]').val()},success:function(data){$('#toapi_app_params').html('');if(dataIsJson(data)){ajaxDataMsg(data)}else{$('#toapi_app_params').html(data)}},error:function(){$('#toapi_app_params').html('')}})});$('#toapi_tab a[href="#toapi_tab_app"]').bind('click',function(){ajaxOpen({type:'get',url:ulink("release/toapiApp?task_id=_id_",{'_id_':$($_o.formid+' [name="task_id"]').val()}),success:function(data){if(dataIsJson(data)){ajaxDataMsg(data)}else{$('#toapi_app_params').html(data)}}})});$('#btn_rele_test').bind('click',function(){collectorWindow('测试','admin/release/test?id='+$_o.releid,null,{lg:1})})},load:function(data){var $_o=this;if(data.module){$($_o.formid+' select[name="module"]').val(data.module).trigger('change')} if(data.config){if('cms'==data.module){$_o.cms_bind(data.config);$(document).ready(function(){$('#cms_tab a[href="#cms_tab_bind"]').tab('show')})}else if('db'==data.module){$_o.db_bind(data.config)}else if('file'==data.module){if(data.config.file){$($_o.formid+' [name="file[path]"]').val(data.config.file.path);$($_o.formid+' [name="file[type]"]').each(function(){if($(this).val()==data.config.file.type){$(this).prop('checked',!0)}});$($_o.formid+' [name="file[txt_implode]"]').val(data.config.file.txt_implode);if(data.config.file.hide_fields){for(var fi in data.config.file.hide_fields){$($_o.formid+' [name="file[hide_fields][]"][value="'+data.config.file.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('api'==data.module){if(data.config.api){$($_o.formid+' [name="api[url]"]').val(data.config.api.url);$($_o.formid+' [name="api[cache_time]"]').val(data.config.api.cache_time);if(data.config.api.hide_fields){for(var fi in data.config.api.hide_fields){$($_o.formid+' [name="api[hide_fields][]"][value="'+data.config.api.hide_fields[fi]+'"]').prop('checked',!0)}}}}else if('diy'==data.module){if(data.config.diy){$(document).ready(function(){$('#diy_tab a[href="#diy_tab_'+data.config.diy.type+'"]').tab('show').trigger('click');for(var i in data.config.diy){$($_o.formid+' [name="diy['+i+']"]').val(data.config.diy[i])} if(data.config.diy.app){var appName=data.config.diy.app;if(appName.length>1){appName=appName.substr(0,1).toUpperCase()+appName.substr(1).toLowerCase()}else{appName=appName.toUpperCase()} $($_o.formid+' [name="diy[app]"]').parent().find('.diy-app-name').text(appName+'.php');$($_o.formid+' [name="diy[app]"]').parent().find('.diy-app-editor').show().find('.btn_diy_editor').attr('href',ulink('develop/editor?type=release&module=diy&app=_app_',{'_app_':appName}))} -if($_o.has_diy_editor()&&data.config.diy.code){editorCodeIfr('#diy_editor_ifr',{'set_value':data.config.diy.code})}})}}else if('toapi'==data.module){var config=data.config.toapi;if(config){$($_o.formid+' [name="toapi[url]"]').val(config.url);$($_o.formid+' [name="toapi[type]"]').val(config.type).trigger('change');$($_o.formid+' [name="toapi[content_type]"]').val(config.content_type);$($_o.formid+' [name="toapi[charset_custom]"]').val(config.charset_custom);$($_o.formid+' [name="toapi[charset]"]').val(config.charset).trigger('change');$($_o.formid+' [name="toapi[encode_custom]"]').val(config.encode_custom);$($_o.formid+' [name="toapi[encode]"]').val(config.encode).trigger('change');if(config.response){for(var i in config.response){$($_o.formid+' [name="toapi[response]['+i+']"]').val(config.response[i])}} -if(config.param_name){config.param_val=config.param_val?config.param_val:{};config.param_addon=config.param_addon?config.param_addon:{};for(var i in config.param_name){var pname=config.param_name[i]?config.param_name[i]:'';var pval=config.param_val[i]?config.param_val[i]:'';var paddon=config.param_addon[i]?config.param_addon[i]:'';$_o.toapi_add_param({name:pname,val:pval,addon:paddon},i)}} -if(config.header_name){config.header_val=config.header_val?config.header_val:{};config.header_addon=config.header_addon?config.header_addon:{};for(var i in config.header_name){var hname=config.header_name[i]?config.header_name[i]:'';var hval=config.header_val[i]?config.header_val[i]:'';var haddon=config.header_addon[i]?config.header_addon[i]:'';$_o.toapi_add_header({name:hname,val:hval,addon:haddon},i)}} -$($_o.formid+' [name="toapi[interval]"]').val(toInt(config.interval));$($_o.formid+' [name="toapi[wait]"]').val(toInt(config.wait));$($_o.formid+' [name="toapi[retry]"]').val(toInt(config.retry))}}}},cms_detect:function(){var $_o=this;$('#cms_list').html('').addClass('loading');ajaxOpen({type:'get',url:ulink("release/cmsDetect"),dataType:'json',success:function(data){$('#cms_list').removeClass('loading');if(data.code==1){var html='

点击选择CMS

';for(var x in data.data){var list=data.data[x];html+='