发布v2.6.8版本

This commit is contained in:
雨中磐石
2025-03-31 20:54:32 +08:00
parent 0701e2a8b4
commit d41bd27082
122 changed files with 9827 additions and 9132 deletions

View File

@@ -67,7 +67,7 @@ class beifenClassAction extends Action
if(getconfig('systype')=='demo')exit('演示请勿操作');
$rows = array();
$folder = $this->post('folder');
$folder = str_replace('../','', $folder);
$folder = str_replace(array('..','/'),'', $folder);
$path = ''.UPDIR.'/data/'.$folder.'';
$carr = c('file')->getfilerows($path);
foreach($carr as $k=>$rs){
@@ -242,4 +242,94 @@ class beifenClassAction extends Action
return 'ok';
}
public function fenbiaoAjax()
{
$allfields = $this->db->getallfields('[Q]flow_set');
if(!in_array('logstr', $allfields)){
$bool = $this->db->query("alter table `[Q]flow_set` add `logstr` varchar(500) DEFAULT NULL COMMENT '操作记录分表';", false);
if(!$bool)return '无法操作:'.$this->db->error().'';
}
$obj = m('mode');
$rows = $obj->getall('1=1');
$atable = array();
$count = m('flow_log')->rows('1=1');
if($count < 10000)return '操作记录少于1W条不需要分表';
$alltabls = $this->db->getalltable();
$barr = $this->createbiao(1, $alltabls);
if(!$barr['success'])return $barr['msg'];
$biao = $barr['data'];
if(1==1)foreach($rows as $k=>$rs){
$tab = $rs['table'];
if(!isset($atable[$tab])){
$max = m($tab)->getmou('max(id) as ids', 'id>0');
if(!$max)$max = 0;
$max++;
$atable[$tab] = $max;
}
$max = $atable[$tab];
$logstr = $rs['logstr'];
if(isempt($logstr)){
$logarr = array();
}else{
$logarr = json_decode($logstr, true);
}
if(!isset($logarr[$max]))$logarr[$max] = $biao;
$logstr = json_encode($logarr);
$obj->update(array(
'logstr' => $logstr
), $rs['id']);
}
//更新
$sql = "update `[Q]file` set `mtype`='flow_log".$biao."' where `mtype`='flow_log'";
$bool = $this->db->query($sql, false);
return 'ok';
}
public function createbiao($xu, $alltabls)
{
$biao = 'a'.$xu.'';
$lognab = 'flow_log'.$biao.'';
if(in_array(''.PREFIX.''.$lognab.'',$alltabls))return $this->createbiao($xu+1, $alltabls);
$sql = 'ALTER TABLE `[Q]flow_log` RENAME TO `[Q]'.$lognab.'`;';
$bool = $this->db->query($sql, false);
if(!$bool)return returnerror('无法操作:'.$this->db->error().'');
$sql = "CREATE TABLE `[Q]flow_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`table` varchar(50) DEFAULT NULL,
`mid` int(11) DEFAULT NULL,
`status` tinyint(4) DEFAULT '0' COMMENT '1通过',
`statusname` varchar(20) DEFAULT NULL COMMENT '状态名称',
`name` varchar(50) DEFAULT NULL COMMENT '进程名称',
`courseid` int(11) DEFAULT NULL,
`optdt` datetime DEFAULT NULL COMMENT '操作时间',
`explain` varchar(500) DEFAULT NULL COMMENT '说明',
`ip` varchar(100) DEFAULT NULL,
`web` varchar(100) DEFAULT NULL COMMENT '浏览器',
`checkname` varchar(50) DEFAULT NULL COMMENT '审核人',
`checkid` int(11) DEFAULT '0' COMMENT '审核人id',
`modeid` smallint(6) DEFAULT NULL COMMENT '@模块Id',
`color` varchar(10) DEFAULT NULL,
`valid` tinyint(1) DEFAULT '1',
`step` smallint(6) DEFAULT '0' COMMENT '步骤号',
`qmimg` text COMMENT '签名的图片base64',
`iszb` tinyint(1) DEFAULT '0' COMMENT '是否转办记录',
PRIMARY KEY (`id`),
KEY `table` (`table`,`mid`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='单据操作记录';
";
$bool = $this->db->query($sql, false);
if(!$bool)return returnerror('无法创建表:'.$this->db->error().'');
return returnsuccess($biao);
}
}

View File

@@ -61,6 +61,24 @@ $(document).ready(function(){
o1.disabled=false;
}
});
},
fenbiao:function(o){
js.confirm('却要现在就分表了吗?',function(jg){
if(jg=='yes'){
c.fenbiaos(o);
}
});
},
fenbiaos:function(o){
js.loading('处理中...');
js.ajax(js.getajaxurl('fenbiao','{mode}','{dir}'),{}, function(s){
js.unloading();
if(s=='ok'){
js.msgok('处理完成');
}else{
js.msg('msg', s);
}
});
}
}
js.initbtn(c);
@@ -86,4 +104,8 @@ $(document).ready(function(){
<div><button click="deluser" class="btn btn-danger" type="button">初始化部门和用户</button></div>
<div class="tishi">初始化部门和用户,将会删除你创建的用户和部门,为了防止误删只能使用一次,请备份好数据谨慎使用!</div>
<div class="blank20"></div>
<div><button click="fenbiao" class="btn btn-default" type="button">flow_log单据操作记录分表</button></div>
<div class="tishi">单据操作记录表单据越多数据越大优化做好分表建议超过5W条记录在分表当前总记录<?=m('flow_log')->rows('1=1')?>条</div>
</div>