From 5cec56526ee2206f73afef583e6d1784b650ebb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E4=B8=AD=E7=A3=90=E7=9F=B3?= Date: Fri, 18 Jul 2025 14:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83v2.7.0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- config/version.php | 4 +- include/chajian/downChajian.php | 1 - include/chajian/htmlChajian.php | 18 +++-- include/chajian/rockeditChajian.php | 4 +- js/dingwei.js | 3 +- js/js.js | 1 + js/reim_xina.js | 19 +++-- js/reim_xina_kefu.js | 2 +- mode/plugin/jquery-rockoffice.js | 40 ++++++++-- web/res/js/strformat.js | 5 +- webmain/flow/input/inputAction.php | 2 +- webmain/flow/input/mode_knowtraimAction.php | 3 +- webmain/flow/page/rock_page_knowtraimuser.php | 3 + webmain/main/flow/flowAction.php | 8 ++ webmain/main/flow/rock_flow_view.php | 2 + webmain/main/fwork/rock_fwork_bill.php | 45 ++++++------ webmain/model/companyModel.php | 13 ++++ webmain/model/flow/flow.php | 4 +- webmain/model/flow/gongModel.php | 2 +- webmain/model/flow/userModel.php | 2 +- webmain/model/flowbillModel.php | 6 ++ webmain/model/modeModel.php | 2 + webmain/public/publicAction.php | 5 ++ webmain/public/tpl_public_fileedit.html | 5 +- webmain/public/tpl_public_fileedit_old.html | 46 ++++++++++++ webmain/system/cog/rock_cog_set.php | 4 +- webmain/task/api/uploadAction.php | 37 +++++++++- webmain/task/api/uploawAction.php | 9 ++- webmain/task/openapi/openmodhetongAction.php | 73 ------------------- webmain/task/openapi/openxiangAction.php | 65 ----------------- 31 files changed, 235 insertions(+), 204 deletions(-) create mode 100644 webmain/public/tpl_public_fileedit_old.html diff --git a/README.md b/README.md index 0d285fc..3720535 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ 官网网站:http://www.rockoa.com/ 源码仅供学习二次开发使用,禁止二次发布,禁止用于商业用途出售等(违者必究) 版权:Copyright @2016-2025 信呼开发团队 -版本整理时间:2025-05-27 23:59:59 -版本号:V2.6.9 +版本整理时间:2025-07-18 23:59:59 +版本号:V2.7.0 -### V2.6.9更新说明 +### V2.7.0更新说明 1、完善系统安全性。 2、更多升级日志详见:http://www.rockoa.com/view_core.html diff --git a/config/version.php b/config/version.php index aa94038..796b754 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ ,\,'); $s = str_replace($lvlaraa, '', $s); - $s = str_replace(array('(',')'), array('锛','锛'), $s); if($s!=$s2)$str = $s; return $str; } diff --git a/include/chajian/htmlChajian.php b/include/chajian/htmlChajian.php index 3219caf..fed001b 100644 --- a/include/chajian/htmlChajian.php +++ b/include/chajian/htmlChajian.php @@ -126,27 +126,27 @@ class htmlChajian extends Chajian{ { if($lx=='')$lx='xls'; $borst = '.5pt'; - $sty = 'style="white-space:nowrap;border:'.$borst.' solid #000000;font-size:12px;"'; + $sty = 'style="white-space:nowrap;border:'.$borst.' solid #000000;font-size:12px;{0}"'; $s = ''.$title.''; $s .= ''; $hlen = 1; - $s1=''; + $s1=''; foreach($headArr as $na){ $hlen++; - $s1.=''; + $s1.=''; } $s1.=''; - $s.=''; + $s.=''; $s.=$s1; foreach($rows as $k=>$rs){ $atr = ''; if(isset($rs['trbgcolor']))$atr=' bgcolor="'.$rs['trbgcolor'].'"'; $s.=''; - $s.=''; + $s.=''; foreach($headArr as $kf=>$na){ $val = ''; if(isset($rs[$kf]))$val=$rs[$kf]; - $s.=''; + $s.=''; } $s.=''; } @@ -166,14 +166,20 @@ class htmlChajian extends Chajian{ $bo = $this->rock->createtxt(iconv('utf-8','gb2312',$url), $s); return $url; } + //瓒呰繃11浣嶇殑鏁板瓧灏变細鍙樺瀷澶勭悊 private function execelval($str) { + return $str; if($str!=''){ if(is_numeric($str) && strlen($str)>11)$str=''.$str.' '; } return $str; } + private function getstyle($sty, $vs='') + { + return str_replace('{0}',$vs,$sty); + } diff --git a/include/chajian/rockeditChajian.php b/include/chajian/rockeditChajian.php index f7aee8e..599415a 100644 --- a/include/chajian/rockeditChajian.php +++ b/include/chajian/rockeditChajian.php @@ -134,9 +134,9 @@ class rockeditChajian extends Chajian{ /** * 鑾峰彇鎺ㄩ侀厤缃 */ - public function getwsinfo() + public function getwsinfo($cans) { - $barr = $this->getdata('file','wsinfo'); + $barr = $this->getdata('file','wsinfo', $cans); if(!$barr['success'])return ''; return $barr['data']; } diff --git a/js/dingwei.js b/js/dingwei.js index c07d6d4..60627b2 100644 --- a/js/dingwei.js +++ b/js/dingwei.js @@ -405,6 +405,7 @@ appbacklocation=function(res){ js.dw.dwsuccess({ latitude:latitude, longitude:longitude, - accuracy:accuracy + accuracy:accuracy, + address:res.address }); } \ No newline at end of file diff --git a/js/js.js b/js/js.js index f1e3061..b90fab0 100644 --- a/js/js.js +++ b/js/js.js @@ -199,6 +199,7 @@ js.open=function(url,w,h,wina,can,wjcan){ if(!w)w=750;if(!h)h=500; var l=(screen.width-w)*0.5,t=(screen.height-h)*0.5-50,rnd = parseInt(Math.random()*50); if(rnd%2==0){l=l+rnd;t=t-rnd;}else{l=l-rnd;t=t+rnd;} + w = parseInt(w);h = parseInt(h);l = parseInt(l);t = parseInt(t); if(!can)can={}; var s='resizable=yes,scrollbars=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no'; var a1={'left':''+l+'px','top':''+t+'px','width':''+w+'px','height':''+h+'px'}; diff --git a/js/reim_xina.js b/js/reim_xina.js index 63963ec..7d75a4d 100644 --- a/js/reim_xina.js +++ b/js/reim_xina.js @@ -5,7 +5,7 @@ * homepage:www.rockoa.com */ -var agentarr={},userarr={},grouparr={},cnum='',windowfocus=true,jietubool=false; +var agentarr={},userarr={},grouparr={},cnum='',windowfocus=true,jietubool=false,fileinfoa={}; var reim={ chatobj:{}, @@ -1487,6 +1487,7 @@ function chatcreate(cans){ this.showobj.perfectScrollbar(); if(this.sendinfo.uptypes)this.uptypes = this.sendinfo.uptypes; if(this.sendinfo.uploadurl)this.upurl = this.sendinfo.uploadurl+'&laiyuan=web'; + if(this.sendinfo.uploadinfo)fileinfoa[this.type] = this.sendinfo.uploadinfo; this.showtitle(); } this.loadci++; @@ -1528,6 +1529,7 @@ function chatcreate(cans){ nfr1 = js.getoption('filesrc_'+frs.fileid+''); if(nfr1)frs.thumbpath = nfr1; } + if(frs)frs.type = this.type; nr = this.contshozt(frs); if(nr=='')nr= jm.base64decode(d.cont); rnd = 'mess_'+sid+''; @@ -1935,8 +1937,8 @@ function chatcreate(cans){ return; } var tm= this.upfilearr,conss=''; - if(this.type=='gout')a.fileid = a.filenum; - f = a; + if(this.type=='gout' || this.type=='zixun')a.fileid = a.filenum; + f = a;a.type = this.type; strformat.upsuccess(a); if(js.isimg(f.fileext)){ conss = '[鍥剧墖 '+f.filesizecn+']'; @@ -2188,6 +2190,7 @@ function chatcreate(cans){ } if(d1.filename){ if(d1.filenum)d1.fileid = d1.filenum; + d1.type = this.type; s1=strformat.contshozt(d1); } s+='
'; @@ -2360,9 +2363,9 @@ strformat.openurl=function(dz){ } } -strformat.clickfile=function(fid,lx){ +strformat.clickfile=function(fid,lx, type){ if(isNaN(fid)){ - reim.outgroup.fileopt(fid,lx); + reim.outgroup.fileopt(fid,lx,type); }else{ js.fileopt(fid,lx); } @@ -2497,9 +2500,11 @@ reim.outgroup={ } } }, - fileopt:function(id1,lx){ + fileopt:function(id1,lx, type){ js.loading('鍔犺浇涓...'); - reim.ajax(this.geturl('fileinfo'),{lx:lx,id:id1},function(ret){ + var surl = this.geturl('fileinfo'); + if(fileinfoa[type])surl = fileinfoa[type]; + reim.ajax(surl,{lx:lx,id:id1},function(ret){ var da = ret.data,url = da.url; js.unloading(); if(da.lx==1){ diff --git a/js/reim_xina_kefu.js b/js/reim_xina_kefu.js index ec9ada4..74c5b8f 100644 --- a/js/reim_xina_kefu.js +++ b/js/reim_xina_kefu.js @@ -102,7 +102,7 @@ reim.kefu = { } }, onmessage:function(d){ - console.log(d); + //console.log(d); var lx=d.type; if(lx=='chehui'){ $('#qipaocont_mess_'+d.messid+'').html(js.getmsg(jm.base64decode(d.mess),'green')); diff --git a/mode/plugin/jquery-rockoffice.js b/mode/plugin/jquery-rockoffice.js index edc6edb..995ff1b 100644 --- a/mode/plugin/jquery-rockoffice.js +++ b/mode/plugin/jquery-rockoffice.js @@ -1,11 +1,13 @@ /** -* 鍦ㄧ嚎缂栬緫鑾峰彇鍐呭鐨 +* 鍦ㄧ嚎缂栬緫鑾峰彇鍐呭鐨20250606 */ js.plugin_rockoffice = function(conf){ if(conf){ + this.plugin_rockofficefileid= 0; this.plugin_rockoffice_conf = conf; this.plugin_rockofficeopen(); + if(conf.erand)js.plugin_rockofficestartv(); } } @@ -26,7 +28,7 @@ js.plugin_rockofficeopen = function(){ }; ws.onerror = function(e){ js.plugin_rockofficebool = false; - //setTimeout('js.plugin_rockofficeopen()',3000); + js.plugin_rockofficetime = setTimeout('js.plugin_rockofficeopen()',5000); }; ws.onmessage = function(evt){ js.plugin_rockofficebool = true; @@ -41,9 +43,35 @@ js.plugin_rockofficemessage = function(d){ if(d.waitmsg)js.msg('wait',jm.base64decode(d.waitmsg)); if(d.msg)js.msg('success',jm.base64decode(d.msg)); if(d.xxtype=='glast'){ - $.get('api.php?m=upload&a=editfileb&fileid='+d.fileid+'', function(s){ - js.plugin_rockoffice_conf = ''; - if(s)js.msg('success',s); - }); + js.plugin_rockofficegetfile(d.fileid); } +} + +js.plugin_rockofficegetfile = function(fid){ + if(this.plugin_rockofficefileid == fid)return; + this.plugin_rockofficefileid = fid; + $.get('api.php?m=upload&a=editfileb&fileid='+fid+'', function(s){ + js.plugin_rockoffice_conf = ''; + if(s)js.msg('success',s); + }); +} + +js.plugin_rockofficestart = function(){ + var d = this.plugin_rockoffice_conf; + if(!d)return; + if(this.plugin_rockofficefileid == d.fileid)return; + $.get('api.php?m=upload&a=editfilec&fileid='+d.fileid+'&erand='+d.erand+'', function(s){ + if(s=='start'){ + js.msg('wait','鑾峰彇缂栬緫鏂囦欢涓...'); + js.plugin_rockofficegetfile(d.fileid); + } + if(s=='wait'){ + js.plugin_rockofficestartv(); + } + }); +} + +js.plugin_rockofficestartv = function(){ + clearTimeout(js.plugin_rockofficestarts); + js.plugin_rockofficestarts = setTimeout('js.plugin_rockofficestart()',10*1000); } \ No newline at end of file diff --git a/web/res/js/strformat.js b/web/res/js/strformat.js index 3123520..63116d6 100644 --- a/web/res/js/strformat.js +++ b/web/res/js/strformat.js @@ -193,7 +193,7 @@ var strformat = { } if(snr){ nr+= '
'; - nr+= '
[鍙戦佹埅鍥綸'; + nr+= '
[鍙戦佹埅鍥綸'; } nr+= '
0%
'; nr+= ''; @@ -256,6 +256,7 @@ var strformat = { var s='',slx,sttr; if(!d)return s; if(!d.fileid)d.fileid=d.id; + var type = d.type;if(!type)type='';//浼氳瘽绫诲瀷 if(js.isimg(d.fileext)){ sttr=''; if(d.thumbpath){ @@ -275,7 +276,7 @@ var strformat = { }else{ slx = d.fileext;if(!lj)lj=''; if(js.fileall.indexOf(','+slx+',')<0)slx='wz'; - s='
搴忓彿
getstyle($sty).'>搴忓彿'.$na.'getstyle($sty).'>'.$na.'
'.$title.'
getstyle($sty).' colspan="'.$hlen.'">'.$title.'
'.($k+1).'getstyle($sty).'>'.($k+1).''.$this->execelval($val).'getstyle($sty,'mso-number-format:\@').'>'.$val.'
'+d.fileext.toUpperCase()+'
'+d.filename+'
('+d.filesizecn+')  涓嬭浇  棰勮
'; + s='
'+d.fileext.toUpperCase()+'
'+d.filename+'
('+d.filesizecn+')  涓嬭浇  棰勮
'; } return s; }, diff --git a/webmain/flow/input/inputAction.php b/webmain/flow/input/inputAction.php index 0ae788f..22efbaf 100644 --- a/webmain/flow/input/inputAction.php +++ b/webmain/flow/input/inputAction.php @@ -96,7 +96,7 @@ class inputAction extends Action } if($oldrs)$this->rs = $oldrs; $uaarr = $farrs = array(); - $lvls = array('text','textarea','ditumap'); + $lvls = array('textnot','textarea','ditumap'); foreach($fieldsarr as $k=>$rs){ $fid = $rs['fields']; $fi1 = substr($fid, 0, 5); diff --git a/webmain/flow/input/mode_knowtraimAction.php b/webmain/flow/input/mode_knowtraimAction.php index 38665dd..060188d 100644 --- a/webmain/flow/input/mode_knowtraimAction.php +++ b/webmain/flow/input/mode_knowtraimAction.php @@ -110,7 +110,8 @@ class mode_knowtraimClassAction extends inputAction{ $mdos = m('flow:knowtraim'); foreach($rows as $k=>$rs){ $zt = $mdos->getstatestr($rs['state']); - $rows[$k]['startdt'] = ''.substr($rs['startdt'],5,11).'鑷'.substr($rs['enddt'],5,11).'('.$zt.')'; + //$rows[$k]['startdt'] = ''.substr($rs['startdt'],5,11).'鑷'.substr($rs['enddt'],5,11).'('.$zt.')'; + $rows[$k]['startdt'] = ''.$rs['startdt'].'鑷'.$rs['enddt'].'('.$zt.')'; if($rs['fenshu']=='0' && $rs['isks']==0)$rows[$k]['fenshu']=''; if(!isempt($rs['ksedt']))$rows[$k]['ksedt'] = ''.substr($rs['kssdt'],5,11).'鑷'.substr($rs['ksedt'],5,11).''; $strs = ($rs['isks']=='1') ? '宸茶冭瘯' : '鏈冭瘯'; diff --git a/webmain/flow/page/rock_page_knowtraimuser.php b/webmain/flow/page/rock_page_knowtraimuser.php index 777bbbe..5a3769b 100644 --- a/webmain/flow/page/rock_page_knowtraimuser.php +++ b/webmain/flow/page/rock_page_knowtraimuser.php @@ -70,6 +70,9 @@ $(document).ready(function(){ search:function(){ var s=get('key_{rand}').value; a.setparams({key:s},true); + }, + view:function(){ + } }; js.initbtn(c); diff --git a/webmain/main/flow/flowAction.php b/webmain/main/flow/flowAction.php index d2045a8..1b3c62c 100644 --- a/webmain/main/flow/flowAction.php +++ b/webmain/main/flow/flowAction.php @@ -798,6 +798,7 @@ class mode_'.$modenum.'ClassAction extends inputAction{ if($rows){ $flow = m('flow')->initflow($this->moders['num']); $mbil = m('flowbill'); + $mcom = m('company'); foreach($rows as $k=>$rs){ $zt = ''; if(isset($rs['status']))$zt = $rs['status']; @@ -829,6 +830,13 @@ class mode_'.$modenum.'ClassAction extends inputAction{ } $narr['status'] = $flow->getstatus($rs,'',$otehsr,1); $narr['chushu'] = $flow->flogmodel->rows("`table`='".$flow->mtable."' and `mid`='".$rs['id']."'"); + $comid = arrvalue($rs,'comid'); + $narr['comid'] = $comid; + if($comid){ + $cmrs = $mcom->getXinxi($rs['comid']); + if($cmrs)$narr['comid'] = $cmrs['id'].'.'.$cmrs['name']; + } + $arr[] = $narr; } diff --git a/webmain/main/flow/rock_flow_view.php b/webmain/main/flow/rock_flow_view.php index a6f99cb..97d49da 100644 --- a/webmain/main/flow/rock_flow_view.php +++ b/webmain/main/flow/rock_flow_view.php @@ -19,6 +19,8 @@ $(document).ready(function(){ text:'ID',dataIndex:'id',sortable:true },{ text:'鐘舵',dataIndex:'status',sortable:true + },{ + text:'鎵灞炲崟浣',dataIndex:'comid',sortable:true },{ text:'澶勭悊璁板綍',dataIndex:'chushu',renderer:function(v,d,i){ var s=' '; diff --git a/webmain/main/fwork/rock_fwork_bill.php b/webmain/main/fwork/rock_fwork_bill.php index 755d12d..8a53464 100644 --- a/webmain/main/fwork/rock_fwork_bill.php +++ b/webmain/main/fwork/rock_fwork_bill.php @@ -6,31 +6,34 @@ $(document).ready(function(){ if(!zt)zt=''; if(!mid)mid='0'; var bools=false; + + var columns = [{ + text:'妯″潡',dataIndex:'modename' + },{ + text:'閮ㄩ棬',dataIndex:'deptname' + },{ + text:'鐢宠浜',dataIndex:'name' + },{ + text:'鍗曞彿',dataIndex:'sericnum' + },{ + text:'鐢宠鏃ユ湡',dataIndex:'applydt',sortable:true + },{ + text:'鎽樿',dataIndex:'summary',align:'left',renderer:function(v){ + return '
'+v+'
'; + } + },{ + text:'鎿嶄綔浜',dataIndex:'optname',sortable:true + }]; + + if(companymode)columns.push({text:'鎵灞炲崟浣嶁',dataIndex:'comidname'}); + columns.push({text:'鐘舵',dataIndex:'status',sortable:true}); + columns.push({text:'',dataIndex:'caozuo',callback:'opegs{rand}'}); + var a = $('#view_{rand}').bootstable({ tablename:'flow_bill',params:{'atype':atype,'zt':zt,'modeid':mid},fanye:true, url:publicstore('{mode}','{dir}'),checked:atype=='daib', storeafteraction:'flowbillafter',storebeforeaction:'flowbillbefore', - columns:[{ - text:'妯″潡',dataIndex:'modename' - },{ - text:'閮ㄩ棬',dataIndex:'deptname' - },{ - text:'鐢宠浜',dataIndex:'name' - },{ - text:'鍗曞彿',dataIndex:'sericnum' - },{ - text:'鐢宠鏃ユ湡',dataIndex:'applydt',sortable:true - },{ - text:'鎽樿',dataIndex:'summary',align:'left',renderer:function(v){ - return '
'+v+'
'; - } - },{ - text:'鎿嶄綔浜',dataIndex:'optname',sortable:true - },{ - text:'鐘舵',dataIndex:'status',sortable:true - },{ - text:'',dataIndex:'caozuo',callback:'opegs{rand}' - }], + columns:columns, celldblclick:function(){ c.view(); }, diff --git a/webmain/model/companyModel.php b/webmain/model/companyModel.php index 94227c9..bc73308 100644 --- a/webmain/model/companyModel.php +++ b/webmain/model/companyModel.php @@ -75,4 +75,17 @@ class companyClassModel extends Model { m('userract')->update("`company`='$name'","`companyid`='$id'");//鍛樺伐鍚堝悓 } + + /** + * 鎵灞炲崟浣嶅悕绉 + */ + public function comidname($comid) + { + if($comid && is_numeric($comid)){ + $mors = $this->getXinxi($comid); + return arrvalue($mors, 'name'); + }else{ + return $comid; + } + } } \ No newline at end of file diff --git a/webmain/model/flow/flow.php b/webmain/model/flow/flow.php index 13babb7..3dc2e61 100644 --- a/webmain/model/flow/flow.php +++ b/webmain/model/flow/flow.php @@ -5,11 +5,11 @@ * 缃戝潃锛歨ttp://www.rockoa.com/ * 绯荤粺鏂囦欢 */ - class flowModel extends Model { public $modenum; public $editcont= ''; public $id = 0; public $moders; public $modeid; public $modename; public $sericnum; public $billrs = array(); public $rs = array(); public $urs = array(); public $drs = array(); public $fieldsarr = array(); public $fieldsarra = array(); public $mwhere; public $mtable; public $uname; public $uid = 0; public $optid = 0; public $isflow = 0; public $ismobile= 0; public $minwidth= 100; public $inputwidth= 0; public $atype = ''; public $daochubo= false; public $companyid= 1; protected function flowinit(){} protected function flowchangedata(){} protected function flowchangetodo(){} protected function flowdeletebill($sm){} protected function flowzuofeibill($sm){} protected function flowsubmit($na, $sm){} protected function flowaddlog($arr){} protected function flowdatalog($arr){} protected function flowcheckbefore(){} protected function flowcheckafter($zt, $sm){} protected function flowcheckfinsh($zt){} protected function flowgetfields($lx){} protected function flowgetoptmenu($opt){} protected function flowcheckname($num){} protected function flowcoursejudge($num){} protected function flowoptmenu($ors, $crs){} protected function flowisreadqx(){return false;} protected function flowisdeleteqx(){return false;} protected function flowprintrows($r){return $r;} protected function flowsubdata($r, $lx=0){return $r;} protected function flownexttodo($type){return false;} protected function flowbillwhere($lx, $uid){return '';} protected $flowweixinarr = array(); protected $flowviewufieds = 'uid'; protected $flowcompanyidfieds = 'comid'; protected $flowfieldstype = 0; public function flowrsreplace($rs){return $rs;} public function flowrsreplace_we($row, $rs){return $row;} public function flowwesearchdata($lx){return array();} protected function flowrsreplaceedit($rs){return $rs;} protected $flowstatusarr = array(1); protected $subsubdatastyle = ''; protected $wherejoin = array(); public $defaultorder = ''; public $floweditother = false; public $xiangbordercolor = ''; public $flowlogtable = 'flow_log'; public $viewmodel,$chaomodel,$billmodel,$todomodel,$todosmodel,$flogmodel,$checksmodel,$cnamemodel,$wheremodel,$adminmodel,$remindmodel,$option,$rssust,$flowarr,$nowcourse,$nextcourse,$flowisend,$pipeiCoursearrc,$pipeiCoursearrs,$pipeiCoursearr,$_tempauoe,$checkiszhuanyi,$checkistui,$lastlogid,$tfieldarr,$inputobj; public function echomsg($msg) { if(!isajax())exit($msg); showreturn('', $msg, 201); exit(); } public function flowfieldarr($farr, $lx){return $farr;} public function flowinputtpl($cont, $lx){return $cont;} public function flowviewtpl($cont, $lx){return $cont;} public function floweditoffice($frs, $ofrs){} public function initdata($num, $id=null) { $this->initbase($num); $this->viewmodel = m('view'); $this->chaomodel = m('flow_chao'); $this->billmodel = m('flow_bill'); $this->todomodel = m('flow_todo'); $this->todosmodel = m('flowtodo'); $this->flogmodel = m('flow_log'); $this->checksmodel = m('flow_checks'); $this->cnamemodel = m('flowcname'); $this->wheremodel = m('where'); $this->adminmodel = m('admin'); $this->remindmodel = m('remind'); $this->option = m('option'); $this->companyid = $this->adminmodel->getcompanyid(); $this->tfieldsarra(); $this->mwhere = "`table`='$this->mtable' and `mid`=-1"; if(!$this->defaultorder){ $sortdir = arrvalue($this->moders, 'sortdir'); if(!isempt($sortdir))$this->defaultorder = str_replace(' ',',', $sortdir); } $this->flowinit(); if($id==null)return $this; $this->loaddata($id, true); return $this; } public function initbase($num) { if(is_array($num)){ $this->moders= $num; }else{ $this->moders = m('flow_set')->getone(is_numeric($num) ? $num : "`num`='$num'"); if(!$this->moders)$this->echomsg('妯″潡['.$num.']涓嶅瓨鍦紝璇峰埌[娴佺▼妯″潡鍒楄〃]涓嬫坊鍔'); } $this->daochubo = ($this->rock->post('execldown')=='true') ? true :false; $table = $this->moders['table']; $this->modeid = $this->moders['id']; $this->modenum = $this->moders['num']; $this->moders['name'] = $this->lang($this->moders['name']); $this->modename = $this->moders['name']; $this->isflow = (int)$this->moders['isflow']; $this->settable($table); $this->mtable = $table; return $this; } private function tfieldsarra() { $this->tfieldarr = array(); $rows = m('flow_element')->getrows("`mid`='$this->modeid' and `iszb`=0",'`name`,`fields`,`isbt`,`iszs`,`fieldstype`,`savewhere`,`data`,`isdr`,`iszb`,`issou`,`islu`,`islb`,`isonly`,`attr`','`sort`'); $this->fieldsarr = array(); if($rows)foreach($rows as $k=>$rs){ if($rs['islu']==1)$this->fieldsarr[] = $rs; if(in_array($rs['fieldstype'], array('select','rockcombo','uploadimg')))$this->tfieldarr[] = $rs; } $this->fieldsarra = $rows; } public function inputtitle() { return $this->moders['name']; } public function flowsearchfields() { $arr = array(); if($this->isflow>0){ $arr[] = array('name'=>''.lang('鐢宠浜').'...','fields'=>'uid'); $arr[] = array('name'=>''.lang('鎻愪氦浜').'...','fields'=>'optid'); } return $arr; } public function setLogtable($id) { $logstr = arrvalue($this->moders,'logstr'); $logsv = ''; if(!isempt($logstr)){ $logarr = json_decode($logstr, true); $mins = 1; ksort($logarr); foreach($logarr as $max=>$fval){ $maxs = (int)$max; if($id < $maxs && $id >= $mins)$logsv = $fval; $mins = $maxs; } } $this->flowlogtable = 'flow_log'.$logsv.''; $this->flogmodel->settable($this->flowlogtable); } public function loaddata($id, $ispd=true) { $this->id = (int)$id; $this->mwhere = "`table`='$this->mtable' and `mid`='$id'"; $swhere = "`id`='$id'"; $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $swhere .= ' and '.$wherestr; } $this->rs = $this->getone($swhere); $this->uname = ''; if(!$this->rs)$this->echomsg('鏁版嵁璁板綍涓嶅瓨鍦ㄤ簡'); $this->setLogtable($this->id); $this->rs['base_name'] = ''; $this->rs['base_deptname'] = ''; if(isset($this->rs['uid']))$this->uid = $this->rs['uid']; if(isset($this->rs['comid']))$this->companyid = $this->rs['comid']; if(!isset($this->rs['applydt']))$this->rs['applydt'] = ''; if(!isset($this->rs['status']))$this->rs['status'] = 1; $uisfield = property_exists($this, 'uidfields') ? $this->uidfields : 'optid'; if($this->uid==0 && isset($this->rs[$uisfield]))$this->uid = $this->rs[$uisfield]; $this->optid = isset($this->rs['optid']) ? $this->rs['optid'] : $this->uid; $this->urs = $this->adminmodel->getone($this->uid,'id,name,user,deptid,deptids,deptname,deptallname,face,ranking,superid,superpath,superman,deptpath'); if($this->isempt($this->rs['applydt'])&&isset($this->rs['optdt']))$this->rs['applydt']=substr($this->rs['optdt'],0,10); if($this->urs){ $this->drs = $this->db->getone('[Q]dept',"`id`='".$this->urs['deptid']."'"); $this->uname = $this->urs['name']; $this->rs['base_name'] = $this->uname; if($this->drs){ $this->rs['base_deptname'] = $this->drs['name']; } } $this->sericnum = ''; $this->billrs = $this->billmodel->getone($this->mwhere); if($this->billrs){ $this->sericnum = $this->billrs['sericnum']; if(isempt(arrvalue($this->billrs,'uname'))){ $this->savebill(); } if($this->billrs['status']!=$this->rs['status'])$this->billmodel->update('`status`='.$this->rs['status'].'', $this->billrs['id']); if($this->billrs['isturn']!=$this->rs['isturn'])$this->billmodel->update('`isturn`='.$this->rs['isturn'].'', $this->billrs['id']); if(isempt($this->rs['base_name']))$this->rs['base_name'] = $this->billrs['uname']; if(isempt($this->rs['base_deptname']))$this->rs['base_deptname'] = $this->billrs['udeptname']; }else{ if($this->isflow>0)$this->savebill(); } if($this->isflow>0){ if($this->rs['status']==1 && $this->rs['isturn']=='0'){ $this->update(array('isturn' => 1), $this->id); $this->rs['isturn'] = 1; if($this->billrs)$this->billmodel->update('`isturn`=1', $this->billrs['id']); } } $this->getlogrows = array(); if($ispd)$this->isreadqx(); $this->rssust = $this->rs; $this->flowchangedata(); $this->rs['base_systitle'] = TITLE; $this->rs['base_modename'] = $this->modename; $this->rs['base_sericnum'] = $this->sericnum; $this->rs['base_summary'] = $this->getsummary(); } public function getdaiban() { $s = $this->rock->dbinstr('nowcheckid', $this->adminid); $to = $this->billmodel->rows('`modeid`='.$this->modeid.' and `isdel`=0 and `status` not in(1,2) and '.$s.''); return $to; } public function isreadqx($glx=0) { $bo = false; if($this->adminid==1)$bo=true; if($this->uid==$this->adminid && $this->adminid>0)$bo=true; if(!$bo && $this->isflow>0){ if($this->billrs){ $allcheckid = $this->billrs['allcheckid']; if(contain(','.$allcheckid.',',','.$this->adminid.','))$bo = true; } } if(!$bo){ if($this->urs && contain($this->urs['superpath'],'['.$this->adminid.']'))$bo = true; } if(!$bo){ $tos = $this->todosmodel->rows("".$this->mwhere." and `uid`='$this->adminid'"); if($tos>0)$bo=true; } if(!$bo){ $tos = $this->chaomodel->rows($this->mwhere.' and '.$this->rock->dbinstr('csnameid', $this->adminid).''); if($tos>0)$bo=true; } if(!$bo){ $tos = $this->db->rows('[Q]todo', "`uid`='$this->adminid' and ".$this->mwhere.""); if($tos>0)$bo=true; } if(!$bo)$bo = $this->flowisreadqx(); if(!$bo){ $bo = $this->isreadqxs(); } if(!$bo){ $tos = $this->isjiankongqx(); if($tos>0)$bo=true; } if($glx==1)return $bo; if(!$bo)$this->echomsg('鏃犳潈闄愭煡鐪嬫ā鍧梉'.$this->modenum.'.'.$this->modename.']'.$this->uname.'鐨勬暟鎹紝璇疯仈绯荤鐞嗗憳鍒癧娴佺▼妯″潡鈫掓祦绋嬫ā鍧楁潈闄怾涓嬭缃'); } public function isreadqxs() { $bo = false; $where = $this->viewmodel->viewwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=true; return $bo; } public function iseditqx() { $bo = 0; if($bo==0 && $this->isflow>0){ if($this->billrs && ($this->uid == $this->adminid || $this->optid==$this->adminid)){ if($this->billrs['nstatus']==0 || $this->billrs['nstatus']==2){ $bo = 1; } } if($this->rs['status']==1)$bo=0; } if($bo==0){ $where = $this->viewmodel->editwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } return $bo; } public function isdeleteqx() { $bo = 0; if($bo==0 && $this->isflow>0){ if($this->billrs && ($this->uid == $this->adminid || $this->optid==$this->adminid)){ if($this->billrs['nstatus']==0 || $this->billrs['nstatus']==2){ $bo = 1; } } if($this->rs['status']==1)$bo=0; } if($bo==0){ $where = $this->viewmodel->deletewhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } $isd = $this->flowisdeleteqx(); if(is_numeric($isd) && $isd <= 1)$bo = $isd; return $bo; } public function isjiankongqx() { $bo = 0; if($bo==0){ $where = $this->viewmodel->jiankongwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } return $bo; } public function getfields($lx=0) { $fields = array(); if(!$this->fieldsarra)$this->tfieldsarra(); $farr = $this->fieldsarra; foreach($farr as $k=>$rs)if($rs['iszs']=='1')$fields[$rs['fields']] = $rs['name']; $fters = $this->flowgetfields($lx); if(is_array($fters))$fields = array_merge($fields, $fters); return $fields; } public function getinputurl($num='',$mid=0,$can=array()) { if($num=='')$num = $this->modenum; $xa = 'lu'; if($this->ismobile==1)$xa = 'lum'; $url = 'index.php?a='.$xa.'&m=input&d=flow&num='.$num.'&mid='.$mid.''; if(is_array($can)){ foreach($can as $k=>$v)$url.='&'.$k.'='.$v.''; }else{ $url .= '&'.$can.''; } return $url; } public function replacepbr(&$arr, $k) { $val = arrvalue($arr, $k); if(!c('html')->ishtml($val))$arr[$k] = str_replace("\n",'
', $val); return $arr; } public function getdatalog($lx=0, $isdy=0) { m('log')->addread($this->mtable, $this->id); $this->todosmodel->biaoyidu($this->adminid, $this->modenum, $this->id); $fobj = m('file'); $this->ismobile = $lx; $arr['modename'] = $this->modename; $arr['title'] = $this->modename; $arr['modeid'] = $this->modeid; $arr['modenum'] = $this->modenum; $arr['mid'] = $this->id; $arr['status'] = arrvalue($this->rs,'status'); $arr['logarr'] = $this->getlog(1); $arr['isplview'] = arrvalue($this->moders,'ispl','0'); $arr['isys'] = arrvalue($this->moders,'isys','0'); $contview = ''; $lsds = ($isdy==2) ? $isdy: $lx; $path = ''.P.'/flow/page/view_'.$this->modenum.'_'.$lsds.'.html'; if(COMPANYNUM){ $path1 = ''.P.'/flow/page/view_'.$this->modenum.'_'.COMPANYNUM.'_'.$lsds.'.html'; if(file_exists($path1))$path = $path1; } $fstr = $fobj->getstr($this->mtable, $this->id, 3); $issubtabs = 0; if($fstr != ''){ $this->rs['file_content'] = $fstr; } $subdata = $this->getsuballdata(1); $this->rs['subdatarows'] = $subdata; $data = $this->rsreplace($this->rs, ($isdy==2) ? 3 : 1); $dataa = $this->viewjinfields(array($data)); $data = $dataa[0]; if($subdata){ $zbzd = m('flow_element')->getrows("`mid`='$this->modeid' and `iszb`>0 and `iszs`=1 and `fieldstype` in('uploadimg','uploadfile','textarea','select','rockcombo')",'`name`,`fields`,`fieldstype`,`iszb`,`data`','`iszb`,`sort`'); foreach($subdata as $zb=>$da){ $sub = $da['fields']; $data[$sub] = $this->getsubdata($zb,$da['data'],arrvalue($data,'subdatays'.$zb.'',$lx)); $data[''.$sub.'_style'] = 'padding:0'; } } $farrobj = $chufarr= array(); if(method_exists($this, 'flowxiangfields'))$chufarr = $this->flowxiangfields($chufarr); $farrobj['base_sericnum'] = array('name'=>arrvalue($chufarr,'base_sericnum','鍗曞彿')); $farrobj['base_name'] = array('name'=>arrvalue($chufarr,'base_name','鐢宠浜')); $farrobj['base_deptname'] = array('name'=>arrvalue($chufarr,'base_deptname','鐢宠浜洪儴闂')); $farrobj['base_status'] = array('name'=>arrvalue($chufarr,'base_status','娴佺▼鐘舵')); $farrobj['file_content'] = array('name'=>arrvalue($chufarr,'file_content','鐩稿叧鏂囦欢')); foreach($this->fieldsarra as $k=>$rs){ $fid = $rs['fields']; $fty = $rs['fieldstype']; if($fty=='uploadfile'){ $fval = arrvalue($data, $fid); if(isempt($fval))$fval='0'; $data[$fid] = ''; if($fval!='0'){ $data[$fid] = $fobj->getstr('', '', 3, "`id` in($fval)"); } } if($fty=='uploadimg' || $fty=='graph'){ $fval = arrvalue($data, $fid); if(!isempt($fval) && substr($fval,0,4)!='rock->gethttppath($fval); $fwei = ($fty=='graph') ? 50 : 100; $data[$fid] = ''; } } if($fty=='textarea'){ $this->replacepbr($data, $fid); } if($fty=='ditumap' && !isempt($rs['data'])){ $wzhi = arrvalue($data, $rs['data']); if(!isempt($wzhi))$data[$fid].='[鏌ョ湅鍦板浘]'; } $farrobj[$fid] = $rs; } $_logarr = $qfields = array(); foreach($arr['logarr'] as $k1=>$rs1)$_logarr[$rs1['id']] = $rs1; $logrows = $this->flogmodel->getrows($this->mwhere.' and `modeid`='.$this->modeid.' and `courseid`>0 and `status`>0 and `valid`=1','*','id desc'); $togdar = array(); foreach($logrows as $k2=>$rs2){ $sie1 = $rs2['courseid'].'_'.$rs2['checkid']; if(isset($togdar[$sie1])){ $logrows[$k2]['show'] = false; }else{ $togdar[$sie1] = true; $logrows[$k2]['show'] = true; } } foreach($logrows as $k2=>$rs2){ if(!$rs2['show'])continue; $rs3 = $_logarr[$rs2['id']]; $_coid = $rs2['courseid']; if(!isempt($rs3['qmimg']))$rs3['name'] = ''; $key1 = 'course'.$_coid.''; if(!isset($data[''.$key1.'_name'])){ $data[''.$key1.'_name'] = $rs3['name']; $data[''.$key1.'_zt'] = ''.$rs3['statusname'].''; $data[''.$key1.'_sm'] = $rs3['sm']; $data[''.$key1.'_dt'] = $rs3['checkdt']; }else{ $data[''.$key1.'_name'] .= ','.$rs3['name']; $data[''.$key1.'_sm'] .= ','.$rs3['sm']; $data[''.$key1.'_dt'] = $rs3['checkdt']; } $key2 = ''.$key1.'_all'; if(!isset($data[$key2])){ $qfields[$key2] = $rs2['name']; $data[$key2]=''; } $str1 = $rs3['name'].' '.$rs3['statusname'].' '.$rs3['checkdt'].''; if(!isempt($rs3['sm']))$str1.='锛'.$rs3['sm'].''; if($data[$key2]!='')$data[$key2].='
'; $data[$key2].= $str1; } $ztass = $this->getnowstatus(); $data['base_status'] = $ztass[3]; if(file_exists($path)){ $contview = $this->flowviewtpl(file_get_contents($path), $lx); preg_match_all('/\^(.*?)\^/', $contview, $list); foreach($list[1] as $k=>$nrs){ $fzdrs = arrvalue($farrobj, $nrs); if($fzdrs)$contview = str_replace('^'.$nrs.'^', $fzdrs['name'], $contview); } $contview = $this->rock->reparr($contview, $data); } $arr['isdefaultview'] = 0; foreach($chufarr as $f1=>$v1)$qfields[$f1] = $v1; if($this->isempt($contview) || contain($contview, '$contview$')){ $arr['isdefaultview'] = 1; $_fields = array(); if($this->isflow>0){ $_fields['base_sericnum'] = $farrobj['base_sericnum']['name']; $_fields['base_name'] = $farrobj['base_name']['name']; $_fields['base_deptname'] = $farrobj['base_deptname']['name']; $_fields['base_status'] = $farrobj['base_status']['name']; } $fields = array_merge($_fields, $this->getfields($lx)); if($fstr!='')$fields['file_content'] = $farrobj['file_content']['name']; foreach($subdata as $zb=>$da){ $fields[$da['fields']] = $da['name']; } if($qfields)$fields = array_merge($fields,$qfields); if($lx==0)foreach($fields as $k=>$rs){$data[''.$k.'_style'] = 'width:75%';break;} $_colsr = $this->xiangbordercolor; if($_colsr=='')$_colsr = getconfig('bcolorxiang'); $contvimr = c('html')->xiangtable($fields, $data, $_colsr); $contvimr = '
'.$contvimr.'
'; if($lx==1){ $contvimr = ''; if($this->isflow>0 && $this->urs){ $contvimr.='
+ class flowModel extends Model { public $modenum; public $editcont= ''; public $id = 0; public $moders; public $modeid; public $modename; public $sericnum; public $billrs = array(); public $rs = array(); public $urs = array(); public $drs = array(); public $fieldsarr = array(); public $fieldsarra = array(); public $mwhere; public $mtable; public $uname; public $uid = 0; public $optid = 0; public $isflow = 0; public $ismobile= 0; public $minwidth= 100; public $inputwidth= 0; public $atype = ''; public $daochubo= false; public $companyid= 1; protected function flowinit(){} protected function flowchangedata(){} protected function flowchangetodo(){} protected function flowdeletebill($sm){} protected function flowzuofeibill($sm){} protected function flowsubmit($na, $sm){} protected function flowaddlog($arr){} protected function flowdatalog($arr){} protected function flowcheckbefore(){} protected function flowcheckafter($zt, $sm){} protected function flowcheckfinsh($zt){} protected function flowgetfields($lx){} protected function flowgetoptmenu($opt){} protected function flowcheckname($num){} protected function flowcoursejudge($num){} protected function flowoptmenu($ors, $crs){} protected function flowisreadqx(){return false;} protected function flowisdeleteqx(){return false;} protected function flowprintrows($r){return $r;} protected function flowsubdata($r, $lx=0){return $r;} protected function flownexttodo($type){return false;} protected function flowbillwhere($lx, $uid){return '';} protected $flowweixinarr = array(); protected $flowviewufieds = 'uid'; protected $flowcompanyidfieds = 'comid'; protected $flowfieldstype = 0; public function flowrsreplace($rs){return $rs;} public function flowrsreplace_we($row, $rs){return $row;} public function flowwesearchdata($lx){return array();} protected function flowrsreplaceedit($rs){return $rs;} protected $flowstatusarr = array(1); protected $subsubdatastyle = ''; protected $wherejoin = array(); public $defaultorder = ''; public $floweditother = false; public $xiangbordercolor = ''; public $flowlogtable = 'flow_log'; public $viewmodel,$chaomodel,$billmodel,$todomodel,$todosmodel,$flogmodel,$checksmodel,$cnamemodel,$wheremodel,$adminmodel,$remindmodel,$option,$rssust,$flowarr,$nowcourse,$nextcourse,$flowisend,$pipeiCoursearrc,$pipeiCoursearrs,$pipeiCoursearr,$_tempauoe,$checkiszhuanyi,$checkistui,$lastlogid,$tfieldarr,$inputobj,$companymodel; public function echomsg($msg) { if(!isajax())exit($msg); showreturn('', $msg, 201); exit(); } public function flowfieldarr($farr, $lx){return $farr;} public function flowinputtpl($cont, $lx){return $cont;} public function flowviewtpl($cont, $lx){return $cont;} public function floweditoffice($frs, $ofrs){} public function initdata($num, $id=null) { $this->initbase($num); $this->viewmodel = m('view'); $this->chaomodel = m('flow_chao'); $this->billmodel = m('flow_bill'); $this->todomodel = m('flow_todo'); $this->todosmodel = m('flowtodo'); $this->flogmodel = m('flow_log'); $this->checksmodel = m('flow_checks'); $this->cnamemodel = m('flowcname'); $this->wheremodel = m('where'); $this->adminmodel = m('admin'); $this->remindmodel = m('remind'); $this->companymodel = m('company'); $this->option = m('option'); $this->companyid = $this->adminmodel->getcompanyid(); $this->tfieldsarra(); $this->mwhere = "`table`='$this->mtable' and `mid`=-1"; if(!$this->defaultorder){ $sortdir = arrvalue($this->moders, 'sortdir'); if(!isempt($sortdir))$this->defaultorder = str_replace(' ',',', $sortdir); } $this->flowinit(); if($id==null)return $this; $this->loaddata($id, true); return $this; } public function initbase($num) { if(is_array($num)){ $this->moders= $num; }else{ $this->moders = m('flow_set')->getone(is_numeric($num) ? $num : "`num`='$num'"); if(!$this->moders)$this->echomsg('妯″潡['.$num.']涓嶅瓨鍦紝璇峰埌[娴佺▼妯″潡鍒楄〃]涓嬫坊鍔'); } $this->daochubo = ($this->rock->post('execldown')=='true') ? true :false; $table = $this->moders['table']; $this->modeid = $this->moders['id']; $this->modenum = $this->moders['num']; $this->moders['name'] = $this->lang($this->moders['name']); $this->modename = $this->moders['name']; $this->isflow = (int)$this->moders['isflow']; $this->settable($table); $this->mtable = $table; return $this; } private function tfieldsarra() { $this->tfieldarr = array(); $rows = m('flow_element')->getrows("`mid`='$this->modeid' and `iszb`=0",'`name`,`fields`,`isbt`,`iszs`,`fieldstype`,`savewhere`,`data`,`isdr`,`iszb`,`issou`,`islu`,`islb`,`isonly`,`attr`','`sort`'); $this->fieldsarr = array(); if($rows)foreach($rows as $k=>$rs){ if($rs['islu']==1)$this->fieldsarr[] = $rs; if(in_array($rs['fieldstype'], array('select','rockcombo','uploadimg')))$this->tfieldarr[] = $rs; } $this->fieldsarra = $rows; } public function inputtitle() { return $this->moders['name']; } public function flowsearchfields() { $arr = array(); if($this->isflow>0){ $arr[] = array('name'=>''.lang('鐢宠浜').'...','fields'=>'uid'); $arr[] = array('name'=>''.lang('鎻愪氦浜').'...','fields'=>'optid'); } return $arr; } public function setLogtable($id) { $logstr = arrvalue($this->moders,'logstr'); $logsv = ''; if(!isempt($logstr)){ $logarr = json_decode($logstr, true); $mins = 1; ksort($logarr); foreach($logarr as $max=>$fval){ $maxs = (int)$max; if($id < $maxs && $id >= $mins)$logsv = $fval; $mins = $maxs; } } $this->flowlogtable = 'flow_log'.$logsv.''; $this->flogmodel->settable($this->flowlogtable); } public function loaddata($id, $ispd=true) { $this->id = (int)$id; $this->mwhere = "`table`='$this->mtable' and `mid`='$id'"; $swhere = "`id`='$id'"; $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $swhere .= ' and '.$wherestr; } $this->rs = $this->getone($swhere); $this->uname = ''; if(!$this->rs)$this->echomsg('鏁版嵁璁板綍涓嶅瓨鍦ㄤ簡'); $this->setLogtable($this->id); $this->rs['base_name'] = ''; $this->rs['base_deptname'] = ''; if(isset($this->rs['uid']))$this->uid = $this->rs['uid']; if(isset($this->rs['comid']))$this->companyid = $this->rs['comid']; if(!isset($this->rs['applydt']))$this->rs['applydt'] = ''; if(!isset($this->rs['status']))$this->rs['status'] = 1; $uisfield = property_exists($this, 'uidfields') ? $this->uidfields : 'optid'; if($this->uid==0 && isset($this->rs[$uisfield]))$this->uid = $this->rs[$uisfield]; $this->optid = isset($this->rs['optid']) ? $this->rs['optid'] : $this->uid; $this->urs = $this->adminmodel->getone($this->uid,'id,name,user,deptid,deptids,deptname,deptallname,face,ranking,superid,superpath,superman,deptpath'); if($this->isempt($this->rs['applydt'])&&isset($this->rs['optdt']))$this->rs['applydt']=substr($this->rs['optdt'],0,10); if($this->urs){ $this->drs = $this->db->getone('[Q]dept',"`id`='".$this->urs['deptid']."'"); $this->uname = $this->urs['name']; $this->rs['base_name'] = $this->uname; if($this->drs){ $this->rs['base_deptname'] = $this->drs['name']; } } $this->sericnum = ''; $this->billrs = $this->billmodel->getone($this->mwhere); if($this->billrs){ $this->sericnum = $this->billrs['sericnum']; if(isempt(arrvalue($this->billrs,'uname'))){ $this->savebill(); } if($this->billrs['status']!=$this->rs['status'])$this->billmodel->update('`status`='.$this->rs['status'].'', $this->billrs['id']); if($this->billrs['isturn']!=$this->rs['isturn'])$this->billmodel->update('`isturn`='.$this->rs['isturn'].'', $this->billrs['id']); if(isempt($this->rs['base_name']))$this->rs['base_name'] = $this->billrs['uname']; if(isempt($this->rs['base_deptname']))$this->rs['base_deptname'] = $this->billrs['udeptname']; }else{ if($this->isflow>0)$this->savebill(); } if($this->isflow>0){ if($this->rs['status']==1 && $this->rs['isturn']=='0'){ $this->update(array('isturn' => 1), $this->id); $this->rs['isturn'] = 1; if($this->billrs)$this->billmodel->update('`isturn`=1', $this->billrs['id']); } } $this->getlogrows = array(); if($ispd)$this->isreadqx(); $this->rssust = $this->rs; $this->flowchangedata(); $this->rs['base_systitle'] = TITLE; $this->rs['base_modename'] = $this->modename; $this->rs['base_sericnum'] = $this->sericnum; $this->rs['base_summary'] = $this->getsummary(); } public function getdaiban() { $s = $this->rock->dbinstr('nowcheckid', $this->adminid); $to = $this->billmodel->rows('`modeid`='.$this->modeid.' and `isdel`=0 and `status` not in(1,2) and '.$s.''); return $to; } public function isreadqx($glx=0) { $bo = false; if($this->adminid==1)$bo=true; if($this->uid==$this->adminid && $this->adminid>0)$bo=true; if(!$bo && $this->isflow>0){ if($this->billrs){ $allcheckid = $this->billrs['allcheckid']; if(contain(','.$allcheckid.',',','.$this->adminid.','))$bo = true; } } if(!$bo){ if($this->urs && contain($this->urs['superpath'],'['.$this->adminid.']'))$bo = true; } if(!$bo){ $tos = $this->todosmodel->rows("".$this->mwhere." and `uid`='$this->adminid'"); if($tos>0)$bo=true; } if(!$bo){ $tos = $this->chaomodel->rows($this->mwhere.' and '.$this->rock->dbinstr('csnameid', $this->adminid).''); if($tos>0)$bo=true; } if(!$bo){ $tos = $this->db->rows('[Q]todo', "`uid`='$this->adminid' and ".$this->mwhere.""); if($tos>0)$bo=true; } if(!$bo)$bo = $this->flowisreadqx(); if(!$bo){ $bo = $this->isreadqxs(); } if(!$bo){ $tos = $this->isjiankongqx(); if($tos>0)$bo=true; } if($glx==1)return $bo; if(!$bo)$this->echomsg('鏃犳潈闄愭煡鐪嬫ā鍧梉'.$this->modenum.'.'.$this->modename.']'.$this->uname.'鐨勬暟鎹紝璇疯仈绯荤鐞嗗憳鍒癧娴佺▼妯″潡鈫掓祦绋嬫ā鍧楁潈闄怾涓嬭缃'); } public function isreadqxs() { $bo = false; $where = $this->viewmodel->viewwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=true; return $bo; } public function iseditqx() { $bo = 0; if($bo==0 && $this->isflow>0){ if($this->billrs && ($this->uid == $this->adminid || $this->optid==$this->adminid)){ if($this->billrs['nstatus']==0 || $this->billrs['nstatus']==2){ $bo = 1; } } if($this->rs['status']==1)$bo=0; } if($bo==0){ $where = $this->viewmodel->editwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } return $bo; } public function isdeleteqx() { $bo = 0; if($bo==0 && $this->isflow>0){ if($this->billrs && ($this->uid == $this->adminid || $this->optid==$this->adminid)){ if($this->billrs['nstatus']==0 || $this->billrs['nstatus']==2){ $bo = 1; } } if($this->rs['status']==1)$bo=0; } if($bo==0){ $where = $this->viewmodel->deletewhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } $isd = $this->flowisdeleteqx(); if(is_numeric($isd) && $isd <= 1)$bo = $isd; return $bo; } public function isjiankongqx() { $bo = 0; if($bo==0){ $where = $this->viewmodel->jiankongwhere($this->moders, $this->adminid, $this->flowviewufieds); $where = str_replace('{asqom}','', $where); $tos = $this->rows("`id`='$this->id' $where "); if($tos>0)$bo=1; } return $bo; } public function getfields($lx=0) { $fields = array(); if(!$this->fieldsarra)$this->tfieldsarra(); $farr = $this->fieldsarra; foreach($farr as $k=>$rs)if($rs['iszs']=='1')$fields[$rs['fields']] = $rs['name']; $fters = $this->flowgetfields($lx); if(is_array($fters))$fields = array_merge($fields, $fters); return $fields; } public function getinputurl($num='',$mid=0,$can=array()) { if($num=='')$num = $this->modenum; $xa = 'lu'; if($this->ismobile==1)$xa = 'lum'; $url = 'index.php?a='.$xa.'&m=input&d=flow&num='.$num.'&mid='.$mid.''; if(is_array($can)){ foreach($can as $k=>$v)$url.='&'.$k.'='.$v.''; }else{ $url .= '&'.$can.''; } return $url; } public function replacepbr(&$arr, $k) { $val = arrvalue($arr, $k); if(!c('html')->ishtml($val))$arr[$k] = str_replace("\n",'
', $val); return $arr; } public function getdatalog($lx=0, $isdy=0) { m('log')->addread($this->mtable, $this->id); $this->todosmodel->biaoyidu($this->adminid, $this->modenum, $this->id); $fobj = m('file'); $this->ismobile = $lx; $arr['modename'] = $this->modename; $arr['title'] = $this->modename; $arr['modeid'] = $this->modeid; $arr['modenum'] = $this->modenum; $arr['mid'] = $this->id; $arr['status'] = arrvalue($this->rs,'status'); $arr['logarr'] = $this->getlog(1); $arr['isplview'] = arrvalue($this->moders,'ispl','0'); $arr['isys'] = arrvalue($this->moders,'isys','0'); $contview = ''; $lsds = ($isdy==2) ? $isdy: $lx; $path = ''.P.'/flow/page/view_'.$this->modenum.'_'.$lsds.'.html'; if(COMPANYNUM){ $path1 = ''.P.'/flow/page/view_'.$this->modenum.'_'.COMPANYNUM.'_'.$lsds.'.html'; if(file_exists($path1))$path = $path1; } $fstr = $fobj->getstr($this->mtable, $this->id, 3); $issubtabs = 0; if($fstr != ''){ $this->rs['file_content'] = $fstr; } $subdata = $this->getsuballdata(1); $this->rs['subdatarows'] = $subdata; $data = $this->rsreplace($this->rs, ($isdy==2) ? 3 : 1); $dataa = $this->viewjinfields(array($data)); $data = $dataa[0]; if($subdata){ $zbzd = m('flow_element')->getrows("`mid`='$this->modeid' and `iszb`>0 and `iszs`=1 and `fieldstype` in('uploadimg','uploadfile','textarea','select','rockcombo')",'`name`,`fields`,`fieldstype`,`iszb`,`data`','`iszb`,`sort`'); foreach($subdata as $zb=>$da){ $sub = $da['fields']; $data[$sub] = $this->getsubdata($zb,$da['data'],arrvalue($data,'subdatays'.$zb.'',$lx)); $data[''.$sub.'_style'] = 'padding:0'; } } $farrobj = $chufarr= array(); if(method_exists($this, 'flowxiangfields'))$chufarr = $this->flowxiangfields($chufarr); $farrobj['base_sericnum'] = array('name'=>arrvalue($chufarr,'base_sericnum','鍗曞彿')); $farrobj['base_name'] = array('name'=>arrvalue($chufarr,'base_name','鐢宠浜')); $farrobj['base_deptname'] = array('name'=>arrvalue($chufarr,'base_deptname','鐢宠浜洪儴闂')); $farrobj['base_status'] = array('name'=>arrvalue($chufarr,'base_status','娴佺▼鐘舵')); $farrobj['file_content'] = array('name'=>arrvalue($chufarr,'file_content','鐩稿叧鏂囦欢')); $farrobj['comidname'] = array('name'=>arrvalue($chufarr,'comidname','鎵灞炲崟浣嶁')); foreach($this->fieldsarra as $k=>$rs){ $fid = $rs['fields']; $fty = $rs['fieldstype']; if($fty=='uploadfile'){ $fval = arrvalue($data, $fid); if(isempt($fval))$fval='0'; $data[$fid] = ''; if($fval!='0'){ $data[$fid] = $fobj->getstr('', '', 3, "`id` in($fval)"); } } if($fty=='uploadimg' || $fty=='graph'){ $fval = arrvalue($data, $fid); if(!isempt($fval) && substr($fval,0,4)!='rock->gethttppath($fval); $fwei = ($fty=='graph') ? 50 : 100; $data[$fid] = ''; } } if($fty=='textarea'){ $this->replacepbr($data, $fid); } if($fty=='ditumap' && !isempt($rs['data'])){ $wzhi = arrvalue($data, $rs['data']); if(!isempt($wzhi))$data[$fid].='[鏌ョ湅鍦板浘]'; } $farrobj[$fid] = $rs; } $_logarr = $qfields = array(); foreach($arr['logarr'] as $k1=>$rs1)$_logarr[$rs1['id']] = $rs1; $logrows = $this->flogmodel->getrows($this->mwhere.' and `modeid`='.$this->modeid.' and `courseid`>0 and `status`>0 and `valid`=1','*','id desc'); $togdar = array(); foreach($logrows as $k2=>$rs2){ $sie1 = $rs2['courseid'].'_'.$rs2['checkid']; if(isset($togdar[$sie1])){ $logrows[$k2]['show'] = false; }else{ $togdar[$sie1] = true; $logrows[$k2]['show'] = true; } } foreach($logrows as $k2=>$rs2){ if(!$rs2['show'])continue; $rs3 = $_logarr[$rs2['id']]; $_coid = $rs2['courseid']; if(!isempt($rs3['qmimg']))$rs3['name'] = ''; $key1 = 'course'.$_coid.''; if(!isset($data[''.$key1.'_name'])){ $data[''.$key1.'_name'] = $rs3['name']; $data[''.$key1.'_zt'] = ''.$rs3['statusname'].''; $data[''.$key1.'_sm'] = $rs3['sm']; $data[''.$key1.'_dt'] = $rs3['checkdt']; }else{ $data[''.$key1.'_name'] .= ','.$rs3['name']; $data[''.$key1.'_sm'] .= ','.$rs3['sm']; $data[''.$key1.'_dt'] = $rs3['checkdt']; } $key2 = ''.$key1.'_all'; if(!isset($data[$key2])){ $qfields[$key2] = $rs2['name']; $data[$key2]=''; } $str1 = $rs3['name'].' '.$rs3['statusname'].' '.$rs3['checkdt'].''; if(!isempt($rs3['sm']))$str1.='锛'.$rs3['sm'].''; if($data[$key2]!='')$data[$key2].='
'; $data[$key2].= $str1; } $ztass = $this->getnowstatus(); $data['base_status'] = $ztass[3]; if(file_exists($path)){ $contview = $this->flowviewtpl(file_get_contents($path), $lx); preg_match_all('/\^(.*?)\^/', $contview, $list); foreach($list[1] as $k=>$nrs){ $fzdrs = arrvalue($farrobj, $nrs); if($fzdrs)$contview = str_replace('^'.$nrs.'^', $fzdrs['name'], $contview); } $contview = $this->rock->reparr($contview, $data); } $arr['isdefaultview'] = 0; foreach($chufarr as $f1=>$v1)$qfields[$f1] = $v1; if($this->isempt($contview) || contain($contview, '$contview$')){ $arr['isdefaultview'] = 1; $_fields = array(); if($this->isflow>0){ $_fields['base_sericnum'] = $farrobj['base_sericnum']['name']; $_fields['base_name'] = $farrobj['base_name']['name']; $_fields['base_deptname'] = $farrobj['base_deptname']['name']; $_fields['base_status'] = $farrobj['base_status']['name']; } $fields = array_merge($_fields, $this->getfields($lx)); if($fstr!='')$fields['file_content'] = $farrobj['file_content']['name']; foreach($subdata as $zb=>$da){ $fields[$da['fields']] = $da['name']; } if($qfields)$fields = array_merge($fields,$qfields); if(ISMORECOM && !isset($fields[$this->flowcompanyidfieds]))$fields['comidname'] = $farrobj['comidname']['name']; if($lx==0)foreach($fields as $k=>$rs){$data[''.$k.'_style'] = 'width:75%';break;} $_colsr = $this->xiangbordercolor; if($_colsr=='')$_colsr = getconfig('bcolorxiang'); $contvimr = c('html')->xiangtable($fields, $data, $_colsr); $contvimr = '
'.$contvimr.'
'; if($lx==1){ $contvimr = ''; if($this->isflow>0 && $this->urs){ $contvimr.='
'.$this->urs['name'].'('.$this->urs['ranking'].')
'.$this->urs['deptallname'].'
-
'; unset($fields['base_name']); unset($fields['base_deptname']); } $contvimr .= '
'; foreach($fields as $f=>$n){ $vs = arrvalue($data, $f); if(!isempt($vs)){ if(substr($f,0,7)=='subdata'){ $contvimr .= ''; }else{ $contvimr .= ''; } } } $contvimr .= '
'.$n.'
'.$vs.'
'.str_replace(' ','
',$n).'
'.$vs.'
'; } if(isempt($contview))$contview = $contvimr; $contview = str_replace('$contview$',$contvimr, $contview); } unset($farrobj); $arr['contview'] = $contview; $arr['readarr'] = m('log')->getreadarr($this->mtable, $this->id); $arr['isedit'] = $this->iseditqx(); $arr['isdel'] = $this->isdeleteqx(); $arr['isflow'] = $this->isflow; $arr['modename'] = $this->modename; $arr['ischehui'] = $this->ischehui(); $arr['statustext'] = $ztass[4]; $arr['statuscolor'] = $ztass[1]; $arr['optmenu'] = $this->getoptmenu(1); $arr['isgbjl'] = (int)$this->rock->arrvalue($this->moders,'isgbjl','0'); $arr['isgbcy'] = (int)$this->rock->arrvalue($this->moders,'isgbcy','0'); $receiptrs = false; $receiptrow = m('receipt')->getall("`modenum`='$this->modenum' and `mid`='$this->id' and `status`=1"); foreach($receiptrow as $k=>$hrs){ $uid1 = ','.$this->adminid.','; if(!contain(','.$hrs['receid'].',', $uid1))continue; if(!contain(','.$hrs['receids'].',', $uid1)){ $receiptrs = array( 'id' => $hrs['id'], 'optname' => $hrs['optname'], ); break; } } $arr['flowinfor'] = array(); $arr['readunarr'] = array(); $arr['receiptrs'] = $receiptrs; if($this->isflow>0){ $arr['flowinfor']= $this->getflowinfor(); if($arr['flowinfor']['ischeck']==1){ $arr['isplview']='0'; } } if(isset($data['title']))$arr['title'] = $data['title']; $_oarr = $this->flowdatalog($arr); if(is_array($_oarr))foreach($_oarr as $k=>$v)$arr[$k]=$v; $conta = $this->rock->matcharr($contview,2); $edbof = false; foreach($conta as $fids){ $thnr = ''; $contview = str_replace('`'.$fids.'`', $thnr, $contview); } $arr['contview'] = $contview; return $arr; } private function getsubdata($xu, $rows, $lx=0) { $iscz = 0; $iszb = $xu+1; $fields = 'subdata'.$xu.''; $subrows = $this->db->getrows('[Q]flow_element','`mid`='.$this->modeid.' and `iszb`='.$iszb.' and `iszs`=1','`fields`,`name`,`isalign`','`sort`'); $cont = ''; if($this->db->count > 0){ $iscz = 1; $headstr = '@xuhaos,,center'; $colorbb = getconfig('bcolorxiang', '#cccccc'); foreach($subrows as $k=>$rs){ $headstr.='@'.$rs['fields'].','.$rs['name'].''; if($rs['isalign']=='1')$headstr.=',left'; if($rs['isalign']=='2')$headstr.=',right'; } foreach($rows as $k=>$rs)$rows[$k]['xuhaos'] = $k+1; $slex = ($lx==0) ? 'noborder':''; if($this->subsubdatastyle!='')$slex = $this->subsubdatastyle; $cont = c('html')->createrows($rows, substr($headstr,1), $colorbb, $slex); } return $cont; } public function ischehui() { $is = 0; if($this->rs['status']==1 || $this->isflow==3)return $is; $where = "".$this->mwhere." and `valid`=1 order by `id` desc"; $rs = $this->flogmodel->getone($where); $sj = (int)getconfig('flowchehuitime','2'); $time = time()-$sj*3600; if($rs && $rs['status']=='1' && $rs['checkid']==$this->adminid && strtotime($rs['optdt'])>$time && ($rs['courseid']>0 || $rs['iszb']=='1' )) $is = $rs['id']; return $is; } public function chehui($sm='') { return $this->bd6('5peg5L!h5ZG8562!5o6I5peg5q2k5Yqf6IO9'); } public function bd6($str) { return $this->rock->jm->base64dencode($str); } public function getdataedit() { $fobj = m('file'); $arr['data'] = $this->flowrsreplaceedit($this->rssust); $arr['table'] = $this->mtable; $arr['tables'] = $this->moders['tables']; $arr['modeid'] = $this->modeid; $arr['isedit'] = $this->iseditqx(); $arr['isflow'] = $this->isflow; $arr['user'] = $this->urs; $arr['status'] = $this->rs['status']; $filers = $fobj->getfile($this->mtable,$this->id); foreach($filers as $fk=>$frs1)$filers[$fk]['thumbpath']=$fobj->getthumbpath($frs1); $arr['filers'] = $filers; $arr['subdata'] = $this->getsuballdata(); $filearr = array(); $fileids = ''; foreach($this->fieldsarr as $k=>$rs){ $fid = $rs['fields']; $flx = $rs['fieldstype']; if($flx=='uploadfile'){ $fval = arrvalue($this->rssust, $fid); if(!isempt($fval))$fileids.=','.$fval.''; } if($flx=='uploadimg'){ $arr['data'][''.$fid.'_view'] = $this->rock->gethttppath($arr['data'][$fid]); } } if($fileids!=''){ $frows = $fobj->getall('`id` in('.substr($fileids, 1).')','filename,id,filesizecn,fileext,optname,thumbpath,thumbplat'); foreach($frows as $k1=>$rs1){ $rs1['thumbpath'] = $fobj->getthumbpath($rs1); $filearr['f'.$rs1['id'].''] = $rs1; } } $arr['filearr'] = $filearr; $ztarr = $this->getnowstatus(); $arr['statustext'] = $ztarr[0]; $arr['statuscolor'] = $ztarr[1]; return $arr; } public function getflowinfor() { $ischeck = 0; $ischange= 0; $str = ''; $arr = $this->getflow(); if($arr['nowcheckid'] != $this->billrs['nowcheckid'])$this->getflowsave($arr, true); $nstatus = $this->rs['status']; $isturn = $this->rs['isturn']; $nowcheckid = ','.$arr['nowcheckid'].','; if($isturn==1 && $nstatus !=1 && contain($nowcheckid, ','.$this->adminid.',') && !in_array($nstatus, array(2,5))){ $ischeck = 1; } $logarr = $this->getlog(); $nowcur = $this->nowcourse; if(arrvalue($this->nextcourse,'checktype')=='change'){ $ischange = 1; } $sarr['ischeck'] = $ischeck; $sarr['ischange'] = $ischange; $sarr['nowcourse'] = $nowcur; $sarr['iszhuanban'] = 0; $sarr['ischao'] = 0; $sarr['nextcourse'] = $this->nextcourse; $sarr['nstatustext'] = $arr['nstatustext']; if($isturn==0)$sarr['nstatustext'] = '寰呮彁浜'; $_checkfields = arrvalue($nowcur,'checkfields'); $checkfields = array(); if($ischeck == 1 && !isempt($_checkfields)){ $_checkfieldsa = explode('|', $_checkfields); $_checkfields = join(',',$_checkfieldsa); $_checkxuant = arrvalue($_checkfieldsa, 1); $inputobj = c('input'); $inputobj->flow = $this; $inputobj->mid = $this->id; $inputobj->urs = $this->urs; $elwswhere = "`mid`='$this->modeid' and `iszb`=0 and instr(',$_checkfields,', concat(',',`fields`,','))>0"; $infeidss = $inputobj->initFields($elwswhere); foreach($infeidss as $_fs=>$fsva){ $_sfes = $fsva['fields']; $_type = $fsva['fieldstype']; $showinpus = 1; $isbt = 1; if($_checkxuant && contain(','.$_checkxuant.',',','.$_sfes.','))$isbt=0; if($_type=='hidden' || $_type=='fixed')$showinpus=2; $_val = arrvalue($this->rssust, $_sfes); $cheo = (substr($_type,0,6)=='change' && !isempt($fsva['data'])); if($cheo)$_val.='|'.arrvalue($this->rssust, $fsva['data']).''; $checkfields[$_sfes] = array( 'inputstr' => $inputobj->getfieldcontval($_sfes, $_val), 'name' => $fsva['name'], 'isbt' => $isbt, 'fieldstype'=> $_type, 'fieldsarr' => $fsva, 'showinpus' => $showinpus ); if($cheo){ $_sfes = $fsva['data']; $checkfields[$_sfes] = array( 'inputstr' => '', 'isbt' => $isbt, 'name' => $fsva['name'].'id', 'fieldstype'=> $_type, 'fieldsarr' => false, 'showinpus' => 2 ); } } } $sarr['checkfields'] = $checkfields; if($nstatus==2)$sarr['nstatustext'] ='寰呮彁浜や汉澶勭悊('.$this->urs['name'].')'; $loglen = count($logarr); foreach($logarr as $k=>$rs){ if($rs['courseid']>0){ $sty = ''; $col = $rs['color']; if($str!='')$str.=' 鈫 '; $str.=''.$rs['actname'].'('.$rs['name'].''.$rs['statusname'].')'; } } if($nstatus=='2'){ if($str!='')$str.=' 鈫 '; $str.= $sarr['nstatustext']; }else if($nstatus=='5'){ if($str!='')$str.=' 鈫 '; $sarr['nstatustext'] = '宸蹭綔搴'; $str.= '宸蹭綔搴'; }else{ foreach($this->flowarr as $k=>$rs){ if($rs['ischeck']==0){ $sty = 'color:#888888'; if($rs['isnow']==1)$sty='font-weight:bold;color:#800000'; if($str!='')$str.=' '; $str.=''.$rs['name'].''; if(!isempt($rs['nowcheckname']))$str.='('.$rs['nowcheckname'].')'; $str.=''; } } } $sarr['flowcoursestr'] = $str; if($nstatus==1)$sarr['nstatustext'] = $this->getnowstatus(1); $actstr = ',鍚屾剰|green,涓嶅悓鎰弢red'; if(isset($nowcur['courseact']) ){ $actstrt = $nowcur['courseact']; if(!isempt($actstrt))$actstr = ','.$actstrt; } $act = c('array')->strtoarray($actstr); foreach($act as $k=>$as1)if($k>0 && $as1[0]==$as1[1])$act[$k][1]=''; if(arrvalue($this->moders,'isys')=='1' && (int)arrvalue($nowcur,'mid','0')>=0){ $act[25]= array('鍓嶅姞绛','',''); $act[26]= array('鍚庡姞绛','',''); } $sarr['courseact'] = $act; $nowstatus = $this->rs['status']; if($this->isflow>0 && $this->rs['isturn']==0)$nowstatus=3; $sarr['nowstatus'] = $nowstatus; $step = $this->rock->arrvalue($nowcur, 'step','0'); $tuicourse = $this->flogmodel->getall($this->mwhere.' and `courseid`>0 and `valid`=1 and `status`=1 and `step`<'.$step.'','`id`,`checkname`,`name`','`step` desc'); $sarr['tuicourse'] = $tuicourse; return $sarr; } public function updatestatus($zt) { $this->update('`status`='.$zt.'', $this->id); $this->billmodel->update('`status`='.$zt.'', $this->mwhere); } public function getstatusarr() { return $this->getstatus(null, '','',2); } public function getstatus($rs, $statusstr='',$other='', $glx=0) { $statustext = $statuscolor = ''; if($statusstr=='')$statusstr=$this->rock->arrvalue($this->moders,'statusstr'); $statusara = array(); $colorsa = array('blue','green','red','#ff6600','#526D08','#888888','','','','','','','','','','','','',''); if(isempt($statusstr)){ $statussst = '涓嶅悓鎰'; $statusstr = '寰?澶勭悊|blue,宸插鏍竱green,'.$statussst.'|red'; } $nowcheckname= arrvalue($rs,'nowcheckname', arrvalue($this->billrs,'nowcheckname')); if(isempt($other))$other = $nowcheckname; $statusar = c('array')->strtoarray($statusstr); foreach($statusar as $k=>$v){ if($v[0]==$v[1])$v[1]= arrvalue($colorsa, $k); $statusara[$k] = $v; } $statusara[5] = array('宸蹭綔搴','#888888'); $statusara[23] = array('閫鍥','#17B2B7'); if($glx==2)return $statusara; $isturn = -1; if(isset($rs['isturn']))$isturn = (int)$rs['isturn']; $zt = $this->rock->arrvalue($rs, 'status'); if($isturn==0){ $statustext = '寰呮彁浜'; $statuscolor= '#ff6600'; }elseif(!isempt($zt)){ if(isset($statusara[$zt])){ $statustext = $statusara[$zt][0]; $statuscolor = $statusara[$zt][1]; } } if(contain($statustext,'?')){ $statusstr = str_replace('?', ''.$other.'', $statustext); }else{ $statusstr = ''.$statustext.''; } if($glx==1){ return $statusstr; } return array(str_replace('?', $other, $statustext), $statuscolor, $zt, $statusstr, str_replace('?', '', $statustext)); } public function getstatusstr($rs) { return $this->getstatus($rs, '','', 1); } public function getnowstatus($glx=0) { return $this->getstatus($this->rs, '','', $glx); } private $getlogrows = array(); public function getlog($lx=0) { if(isset($this->getlogrows[$lx]))return $this->getlogrows[$lx]; $rows = $this->flogmodel->getrows($this->mwhere, '`checkname` as `name`,`checkid`,`name` as actname,`optdt`,`status`,`explain`,`statusname`,`valid`,`courseid`,`color`,`id`,`qmimg`','`id` asc'); $uids = $idss = ''; $dts = c('date'); $fo = m('file'); $editarrs = array(); foreach($rows as $k=>$rs){ $uids.=','.$rs['checkid'].''; $idss.=','.$rs['id'].''; $col = $rs['color']; if(isempt($col))$col='green'; if(contain($rs['statusname'],'涓') || $rs['status']=='2')$col='red'; $rows[$k]['color'] = $col; $rows[$k]['checkdt'] = $rs['optdt']; $rows[$k]['sm'] = str_replace("\n",'
', (string)$rs['explain']); $rows[$k]['explain'] = $rows[$k]['sm']; if(!isempt($rs['qmimg'])){ if(!contain($rs['qmimg'],'.')){ $qmimg = ''.UPDIR.'/'.date('Y-m').'/qmimg'.$rs['id'].'.png'; $bo = true; if(!file_exists($qmimg)){ $bar= explode(',', $rs['qmimg']); $bo = $this->rock->createtxt($qmimg, base64_decode($bar[1])); } if(!$bo){ $qmimg = $rs['qmimg']; }else{ $qmimg = ''.URL.''.$qmimg.''; } }else{ $qmimg = $rs['qmimg']; if(!file_exists($qmimg)){ $qmimg = ''; }else{ $qmimg = ''.URL.''.$qmimg.''; } } $rows[$k]['qmimg'] = $qmimg; if(!isempt($qmimg))$rows[$k]['explain']= ''.$rs['explain'].''; } } if($idss!=''){ $farr = $fo->getfile($this->flowlogtable, substr($idss, 1)); if($farr)foreach($rows as $k=>$rs){ $fstr = $fo->getallstr($farr, $rs['id'],2); $rows[$k]['explain']= $this->strappend($rs['explain'], $fstr, '
'); } } if($uids!=''){ $rows = m('admin')->getadmininfor($rows, substr($uids, 1), 'checkid'); } $this->getlogrows[$lx] = $rows; return $rows; } public function addlog($arr=array()) { $addarr = array( 'table' => $this->mtable, 'mid' => $this->id, 'checkname' => $this->adminname, 'checkid' => $this->adminid, 'optdt' => $this->rock->now, 'courseid' => '0', 'status' => '1', 'ip' => $this->rock->ip, 'web' => $this->rock->web, 'modeid' => $this->modeid ); foreach($arr as $k=>$v)$addarr[$k]=$v; if(isset($addarr['explain']))$addarr['explain']= htmlspecialchars($addarr['explain']); $this->flogmodel->insert($addarr); $ssid = $this->db->insert_id(); $fileid = $this->rock->post('fileid'); if($fileid!='')m('file')->addfile($fileid, $this->flowlogtable, $ssid, $this->modenum.'|'.$this->id); $logfileid = $this->rock->post('logfileid'); if($logfileid!='')m('file')->addfile($logfileid, $this->flowlogtable, $ssid, $this->modenum.'|'.$this->id); $addarr['id'] = $ssid; $this->flowaddlog($addarr); $this->getlogrows = array(); return $ssid; } public function submit($na='', $sm='') { if($na=='')$na='鎻愪氦'; $isturn = 1; if($na=='淇濆瓨')$isturn = 0; $this->addlog(array( 'name' => $na, 'explain' => $sm )); if($this->isflow>0){ $marr['isturn'] = $isturn; $marr['status'] = 0; $this->rs['status'] = 0; $this->update($marr, $this->id); if(arrvalue($this->moders,'isflowlx')=='1' || $this->isflow>=3){ $this->checksmodel->delete($this->mwhere); $this->flogmodel->update('`valid`=0', ''.$this->mwhere.' and `courseid`>0 and `valid`=1'); } $farr = $this->getflow(); if($farr['nowcourseid']>0){ $sysnextoptid = $this->rock->post('sysnextoptid'); $sysnextopt = $this->rock->post('sysnextopt'); $sysnextcustidid = (int)$this->rock->post('sysnextcustidid'); if($sysnextcustidid == $farr['nowcourseid'] && !isempt($sysnextoptid) && !isempt($sysnextopt)){ $this->addcheckname($sysnextcustidid, $sysnextoptid, $sysnextopt, true, 1); $farr = $this->getflow(); } } $farr['status'] = 0; $this->savebill($farr); if($isturn == 1){ $this->nexttodo($farr['nowcheckid'],'submit'); } } $this->flowsubmit($na, $sm); $this->savecsname( $this->rock->post('syschaosongid'), $this->rock->post('syschaosong'), $this->adminid,0,$isturn,$na); if($na=='缂栬緫'){ $this->gettodosend('boedit'); }else{ $this->gettodosend('boturn'); } } private function savecsname($csnameid,$csname,$uid,$type,$isturn, $na) { if(!isempt($csnameid)){ $where = $this->mwhere.' and `type`='.$type.''; if($type>0)$where.=' and `uid`='.$uid.''; $csid = (int)$this->chaomodel->getmou('id', $where); if($csid==0)$where = ''; $this->chaomodel->record(array( 'modeid' => $this->modeid, 'table' => $this->mtable, 'mid' => $this->id, 'uid' => $uid, 'type' => $type, 'csname' => $csname, 'csnameid' => $csnameid, ),$where); if($isturn==1)$this->nexttodo($csnameid,'chao', $na); } } public function getcsname($id=0) { if($id>0){ $where= "`table`='$this->mtable' and `mid`='$id' and `type`=0"; }else{ $where= "`modeid`={$this->modeid} and `uid`={$this->adminid} and `type`=0"; $iscs = (int)$this->moders['iscs']; } $ors = $this->chaomodel->getone($where,'*','`id` desc'); $csname = $csnameid = ''; if($ors){ $csname = $ors['csname']; $csnameid = $ors['csnameid']; } return array( 'csname' => $csname, 'csnameid' => $csnameid, 'id' => $id, ); } public function zhuijiaexplain($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '杩藉姞璇存槑', 'status' => 1, )); $zt = $this->rs['status']; if($zt==2 && $this->isflow>0 && $this->adminid==$this->uid){ $marr['status'] = 0; $this->rs['status'] = 0; $this->update($marr, $this->id); $farr = $this->getflow(); $farr['status'] = 0; $this->savebill($farr); $this->nexttodo($farr['nowcheckid'],'zhui', $sm); } $this->gettodosend('bozhui','', $sm); } public function chuiban($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '鍌姙', 'status' => 1, )); $farr = $this->getflow(true); $this->nexttodo($farr['nowcheckid'],'cuiban', $sm); $this->gettodosend('cuiban','', $sm); } public function getyushen($rows) { return $rows; } private function getyushenss($id, $rows, $xu, $isq) { if($xu==0)$this->_tempauoe = array(); if(isset($rows[$id])){ $_tars = $rows[$id]; if($isq==1)$this->getyushenss($_tars['id'], $rows, $xu+1, $isq); $this->_tempauoe[] = $_tars; if($isq==0)$this->getyushenss($_tars['id'], $rows, $xu+1, $isq); } return $this->_tempauoe; } public function getflowpipei($uid=0) { $urs = $this->urs; if(!$urs)$urs = $uid; if(!is_array($urs))$urs = $this->db->getone('[Q]admin', "`id`='$urs'", '`deptid`,`deptpath`,`id`'); $coursedb = m('flowcourse'); $barr = $coursedb->pipeiCourse($this->modeid); $rows = $barr['rows']; $this->pipeiCoursearrc = $barr['rowd']; $this->pipeiCoursearrs = array(); $this->pipeiCoursearr = array(); $kqobj = m('kaoqin'); $this->getflowpipeis($rows, $urs, $kqobj); unset($this->pipeiCoursearrs); unset($this->pipeiCoursearrc); return $this->getyushen($this->pipeiCoursearr); } private function getflowpipeis($rows,$urs, $kqobj) { $shiyong = array(); $defix = $xuhao = 0; $uid = arrvalue($urs,'id',0); $zshu = count($rows); foreach($rows as $k=>$rs){ $whereid = (int)$rs['whereid']; $receid = $rs['receid']; $wherestr= arrvalue($rs, 'where'); if($rs['status']=='0')continue; if(!isempt($wherestr)){ $wherestr = m('base')->strreplace($this->rock->jm->base64decode($wherestr), $uid); $to = $this->rows("`id`='$this->id' and $wherestr "); if($to==0)continue; } if($whereid > 0){ $bo = $this->wheremanzhu($whereid); if(!$bo)continue; } if(!isempt($rs['num'])){ $bo = $this->flowcoursejudge($rs['num'], $rs); if(is_bool($bo) && !$bo)continue; } $xuhao++; if($defix==0 && (isempt($receid) || contain($receid,'all'))){ $defix = $xuhao; } if(isempt($receid) && (!isempt($wherestr) || $whereid > 0)){ $defix = $xuhao; } $rs['xuhao'] = $xuhao; $shiyong[] = $rs; } $pboss = false; if($shiyong){ $gxuha = $kqobj->getpipeimid($urs, $shiyong, 'xuhao', $defix); if($gxuha>0){ $pboss = true; $gxuha = $gxuha-1; $prs = $shiyong[$gxuha]; $this->getflowpipeisss($prs, $urs, $kqobj); } } if(!$pboss && $zshu==1 && $rows[0]['childshu']>0){ $this->getflowpipeis($rows[0]['children'], $urs, $kqobj); } } private function getflowpipeisss($prsnrs, $urs, $kqobj) { $prs = $prsnrs; unset($prs['children']); $this->pipeiCoursearrs[]= $prs['id']; $this->pipeiCoursearr[] = $prs; if($prs['childshu']>0){ $this->getflowpipeis($prsnrs['children'], $urs, $kqobj); }else{ $nid = arrvalue($prs,'nid','0'); if($nid>0 && !in_array($nid, $this->pipeiCoursearrs) && isset($this->pipeiCoursearrc, $nid)){ $this->getflowpipeis(array($this->pipeiCoursearrc[$nid]), $urs, $kqobj); } } } public function getflow($sbo=false) { $this->flowarr = array(); $allcheckid = $nowcheckid = $nowcheckname = $nstatustext = ''; $allcheckids = array(); $nowcourseid = 0; $nstatus = $this->rs['status']; $this->nowcourse = array(); $this->nextcourse = array(); $this->flowisend = 0; $curs = $this->flogmodel->getrows($this->mwhere,'checkid,checkname,courseid,`valid`,`status`,`statusname`,`name`,`iszb`','id desc'); $cufss = $ztnas = $chesarr = array(); foreach($curs as $k=>$rs){ if($rs['iszb']=='1' && !in_array($rs['checkid'], $allcheckids))$allcheckids[] = $rs['checkid']; if($rs['courseid']=='0')continue; $_su = ''.$rs['courseid'].''; $_su1 = ''.$rs['courseid'].'_'.$rs['checkid'].''; if($rs['valid']==1 && in_array($rs['status'], $this->flowstatusarr)){ if(!isset($cufss[$_su]))$cufss[$_su]=0; $cufss[$_su]++; $chesarr[$_su1] = 1; } if(!in_array($rs['checkid'], $allcheckids))$allcheckids[] = $rs['checkid']; if($nstatustext=='' && $rs['courseid']>0){ $nstatustext = ''.$rs['checkname'].'澶勭悊'.$rs['statusname'].''; $nstatus = $rs['status']; } $ztnas[$rs['courseid']] = ''.$rs['checkname'].''.$rs['statusname'].''; } $nowstep = $zongsetp = -1; $isend = 0; $czt = $this->rs['status']; $coutye = 0; $rows = ($czt==1 || $czt==5)? array() : $this->getflowpipei($this->uid); if($rows){ $checksa = $this->checksmodel->getrows($this->mwhere.' and `addlx`=3'); $coursea = $nrows = array(); foreach($checksa as $k=>$rs)$coursea[$rs['courseid']]='1'; $nrows = array(); $allcheckid = ''; $isoptsuperbo = false; foreach($rows as $k=>$rs){ $uarr = $this->getcheckname($rs); $rows[$k]['checkid'] = $uarr[0]; $rows[$k]['checkname'] = $uarr[1]; $allcheckid .= ','.$uarr[0].''; if($rs['checktype']=='optsuper' && isempt($uarr[0]))$isoptsuperbo=true; } if($isoptsuperbo)foreach($rows as $k=>$rs){ if($rs['checktype']=='optsuper'){ $_k1 = $k-1; $_uid = $this->optid; if($_k1>=0){ $ours = $this->flogmodel->getone($this->mwhere.' and `courseid`='.$rows[$_k1]['id'].' and `valid`=1 ','`checkid`','`id` desc'); if(!$ours){ $_uid = (int)$rows[$_k1]['checkid']; }else{ $_uid = $ours['checkid']; } } $uarr = $this->adminmodel->getsuperman($_uid); if($uarr){ $rows[$k]['checkid'] = $uarr[0]; $rows[$k]['checkname'] = $uarr[1]; } } } foreach($rows as $k=>$rs){ $nrows[] = $rs; if($rs['checktype']=='superall'){ $ids1 = $rs['id']; $suparr = $this->adminmodel->getsuperarr($this->uid); if($suparr){ $logdsar = $this->getlog(); foreach($logdsar as $k1=>$rs1){ if($rs1['courseid']>0 && $rs1['status']=='1' && $rs1['valid']=='1')$allcheckid .= ','.$rs1['checkid'].''; } foreach($suparr as $k1=>$surs){ if(!contain(','.$allcheckid.',', ','.$surs['id'].',')){ $rs['oldid'] = $ids1; $rs['id'] = $ids1 * 99999 + $surs['id']; $rs['checkid'] = $surs['id']; $rs['checkname'] = $surs['name']; $rs['iszf'] = 0; $nrows[] = $rs; $allcheckid .= ','.$surs['id'].''; } } } } } $yisheh = ''; if($this->isflow==2){ $logdsar = $this->getlog(); foreach($logdsar as $k1=>$rs1) if($rs1['courseid']>0 && $rs1['status']==1 && $rs1['valid']==1)$yisheh .= ','.$rs1['checkid'].''; } $jwcllx = arrvalue($this->moders, 'jwcllx','0'); foreach($nrows as $k=>$rs){ $whereid = (int)$rs['whereid']; $checkshu = $rs['checkshu']; $checkid = $rs['checkid']; $checkname = $rs['checkname']; $checktype = $rs['checktype']; if($this->isflow==2 && !isempt($checkid) && isempt($rs['checkfields'])){ if(($checkid==$this->uid || $checkid==$this->optid) )continue; $k2 = $k+1; $ntype = 'yes'; if(isset($nrows[$k2])){ if($nrows[$k2]['checktype']=='change')$ntype='no'; } if($ntype=='yes' && contain(','.$yisheh.',',','.$checkid.','))continue; } if(!isempt($checkid))$yisheh .= ','.$checkid.''; $zongsetp++; $ischeck = 0; $checkids = $checknames = ''; $_su = ''.$rs['id'].''; $nowshu = 0; if(isset($cufss[$_su]))$nowshu = $cufss[$_su]; if(!$this->isempt($checkid)){ $checkida = explode(',', $checkid); $checkidna = explode(',', $checkname); $_chid = $_chna = ''; foreach($checkida as $k1=>$chkid){ $_su1 = ''.$rs['id'].'_'.$chkid.''; if($jwcllx == 0 && !in_array($chkid, $allcheckids))$allcheckids[] = $chkid; if(!isset($chesarr[$_su1])){ $_chid.=','.$chkid.''; $_chna.=','.arrvalue($checkidna, $k1).''; } } if($_chid!='')$_chid = substr($_chid, 1); if($_chna!='')$_chna = substr($_chna, 1); if($_chid==''){ $ischeck = 1; }else{ if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1; } $checkids = $_chid; $checknames = $_chna; }else{ if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1; if($checkshu == 0 && $nowshu>0)$ischeck = 1; } if($ischeck==0 && $coutye==0){ if((int)arrvalue($rs,'coursetype','0')>0)$coutye = 1; } $rs['ischeck'] = $ischeck; $rs['islast'] = 0; $rs['checkid'] = $checkid; $rs['checkname'] = $checkname; $rs['nowcheckid'] = $checkids; $rs['nowcheckname'] = $checknames; $rs['isnow'] = 0; $rs['nowstep'] = $zongsetp; $rs['step'] = $k+1; if($ischeck==0 && $nowstep==-1){ $rs['isnow']= 1; $nowstep = $zongsetp; $this->nowcourse = $rs; $nowcourseid = $rs['id']; $nowcheckid = $checkids; $nowcheckname = $checknames; } if($nowstep>-1 && $zongsetp==$nowstep+1)$this->nextcourse = $rs; $this->flowarr[]= $rs; } } if($zongsetp>-1)$this->flowarr[$zongsetp]['islast']=1; if($nowstep == -1){ $isend = 1; }else{ $nstatustext = '寰'.$nowcheckname.'澶勭悊'; } $this->flowisend = $isend; $allcheckid = join(',', $allcheckids); $arrbill['allcheckid'] = $allcheckid; $arrbill['nowcourseid'] = $nowcourseid; $arrbill['nowcheckid'] = $nowcheckid; $arrbill['nowcheckname'] = $nowcheckname; $arrbill['nstatustext'] = $nstatustext; $arrbill['nstatus'] = $nstatus; $arrbill['status'] = $this->rs['status']; $arrbill['isturn'] = $this->rs['isturn']; if($sbo)$this->getflowsave($arrbill); return $arrbill; } public function wheremanzhu($id) { $uid = $this->uid; $ser = $this->wheremodel->getflowwhere($id, $uid); if(!$ser)return true; $str = $ser['ntr']; if(!isempt($str)){ $to = $this->db->rows('[Q]admin',"`id`='$uid' and ($str)"); if($to>0)return false; } $str = $ser['str']; if(!isempt($str)){ $str= str_replace('{asqom}','', $str); $to = $this->rows("`id`='$this->id' and $str"); if($to==0)return false; } $str = $ser['utr']; if(!isempt($str)){ $to = $this->db->rows('[Q]admin',"`id`='$uid' and $str"); if($to==0)return false; } return true; } public function getflowsave($sarr, $suvu=false) { if(!$sarr)return; if($suvu)$sarr['updt'] = $this->rock->now; $this->billmodel->update($sarr, $this->mwhere); } private function getcheckname($crs) { $type = $crs['checktype']; $cuid = $name = ''; $courseid= $crs['id']; $cheorws = $this->checksmodel->getall($this->mwhere.' and `courseid`='.$courseid.'','checkid,checkname'); if($cheorws){ foreach($cheorws as $k=>$rs){ $lxss = $rs['checkid']; if(isempt($lxss) || $lxss=='0')continue; $cuid.=','.$lxss.''; $name.=','.$rs['checkname'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); return array($cuid, $name); } } if(!$this->isempt($crs['num'])){ $uarr = $this->flowcheckname($crs['num']); if(is_array($uarr)){ if(!$this->isempt($uarr[0]))return $uarr; } } if($type=='super' || $type=='superall'){ $cuid = $this->urs['superid']; $name = $this->urs['superman']; } if($type=='dept' || $type=='super' || $type=='superall'){ if($this->isempt($cuid) && $this->drs){ $cuid = $this->drs['headid']; $name = $this->drs['headman']; } } if($type=='apply'){ $cuid = $this->urs['id']; $name = $this->urs['name']; } if($type=='opt'){ $cuid = $this->rs['optid']; $name = $this->rs['optname']; if(isempt($cuid)){ $cuid = $this->urs['id']; $name = $this->urs['name']; } } if($type=='user'){ $cuid = $crs['checktypeid']; $name = $crs['checktypename']; } if($type=='rank'){ $rank = $crs['checktypename']; if(!$this->isempt($rank)){ $wheer1 = $this->adminmodel->getcompanywhere(5,'',$this->companyid); $rnurs = $this->db->getrows('[Q]admin',"`status`=1 and `ranking`='$rank' ".$wheer1."",'id,name','sort'); foreach($rnurs as $k=>$rns){ $cuid.=','.$rns['id'].''; $name.=','.$rns['name'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); } } } if($type=='cname'){ $cnbar = $this->cnamemodel->getcheckname($crs['checktypeid'], $this->uid); $cuid = arrvalue($cnbar, 0); $name = arrvalue($cnbar, 1); } if($type=='field'){ $fids = $crs['checktypeid']; if(!isempt($fids)){ $vals = ''; $farrs= explode(',', $fids); foreach($farrs as $fid){ $vid = arrvalue($this->rs, $fid); if(!isempt($vid))$vals.=','.$vid.''; } if($vals!=''){ $vals = substr($vals, 1); $uarr = $this->adminmodel->getrows('`status`=1 and `id` in('.$vals.')','id,name','FIELD(`id`,'.$vals.')'); foreach($uarr as $k=>$rs){ $cuid.=','.$rs['id'].''; $name.=','.$rs['name'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); } } } } $cuid = $this->rock->repempt($cuid); $name = $this->rock->repempt($name); return array($cuid, $name); } public function createbianhao($num, $fid, $wshu=3) { if(isempt($num))$num=''.$this->modenum.'-'; @$appdt = $this->rs['applydt']; if(isempt($appdt))$appdt = $this->rock->date; $apdt = str_replace('-','', substr($appdt,0,10)); $num = str_replace('Ymd',$apdt,$num); return $this->db->sericnum($num,'[Q]'.$this->mtable.'', $fid, $wshu); } public function createinputnum($num, $fid) { $acta = ''; if(method_exists($this, $num)){ $acta = $num; }else{ if(contain($num, ',')){ $arra = explode(',', $num); $acta = $arra[0]; $num = $arra[1]; } } if($acta && method_exists($this, $acta)){ $barr = $this->$acta($num); if(is_array($barr)){ $qom = arrvalue($barr, 'qom', $num); $wshu= arrvalue($barr, 'wshu', 3); $bom = arrvalue($barr, 'bom'); $fields = arrvalue($barr, 'fields', $fid); return $this->createbianhao($qom, $fields, $wshu).$bom; }else{ if(isempt($barr))$barr = $num; return $this->createbianhao($barr, $fid); } }else{ return $this->createbianhao($num, $fid); } } public function createnum() { $num = $this->moders['sericnum']; if($num=='鏃'||$this->isempt($num))$num='TM-Ymd-'; @$appdt = $this->rs['applydt']; if(isempt($appdt))$appdt = $this->rock->date; $apdt = str_replace('-','', $appdt); $num = str_replace('Ymd',$apdt,$num); return $this->db->sericnum($num,'[Q]flow_bill', 'sericnum', 3); } public function savebill($oarr=array()) { $dbs = $this->billmodel; $whes= $this->mwhere; $birs= $dbs->getone($whes); $arr = array( 'table' => $this->mtable, 'mid' => $this->id, 'optdt' => isset($this->rs['optdt']) ? $this->rs['optdt'] : $this->rock->now, 'optname' => arrvalue($this->rs,'optname', $this->adminname), 'optid' => arrvalue($this->rs,'optid', $this->adminid), 'modeid' => $this->modeid, 'updt' => $this->rock->now, 'isturn' => $this->rs['isturn'], 'nstatus' => $this->rs['status'], 'applydt' => $this->rs['applydt'], 'modename' => $this->modename, 'uname' => $this->rs['base_name'], 'udeptname' => $this->rs['base_deptname'], 'uid' => $this->uid, 'isdel' => '0', ); foreach($oarr as $k=>$v)$arr[$k]=$v; if(!$birs){ $arr['status'] = $arr['nstatus']; $arr['createdt']= $arr['optdt']; $arr['sericnum']= $this->createnum(); $arr['udeptid'] = $this->rock->post('sysudeptid', arrvalue($this->urs,'deptid')); $whes = ''; $this->sericnum = $arr['sericnum']; }else{ $udeptid = $birs['udeptid']; if($udeptid==0)$arr['udeptid']= arrvalue($this->urs,'deptid'); } $fstr = $this->rock->post('sysflow5str'); if($fstr)$arr['flow5str'] = $fstr; $dbs->record($arr, $whes); return $arr; } public function getsummary() { return $this->rock->reparr($this->moders['summary'], $this->rs); } public function addcheckname($courseid, $uid, $uname, $onbo=false, $addlx=0) { if(isempt($uid)){$uid = '0';$uname= 'auto';} $uida = explode(',', ''.$uid.''); $uidan = explode(',', $uname); if($onbo)$this->checksmodel->delete($this->mwhere.' and `courseid`='.$courseid.''); if($uida)foreach($uida as $k=>$uid){ $uname = $this->rock->arrvalue($uidan, $k); $zyarr = array( 'table' => $this->mtable, 'mid' => $this->id, 'modeid' => $this->modeid, 'courseid' => $courseid, 'optid' => $this->adminid, 'optname' => $this->adminname, 'addlx' => $addlx, 'optdt' => $this->rock->now, 'status' => 0 ); $this->checksmodel->delete($this->mwhere.' and `checkid`='.$uid.' and `courseid`='.$courseid.''); $zyarr['checkid'] = $uid; $zyarr['checkname'] = $uname; $this->checksmodel->insert($zyarr); } if($addlx==4)$this->checksmodel->delete($this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.''); } public function savedatastr($fval, $farr, $data=array()) { $str = ''; if(!$farr)return $str; $savewhere = $farr['savewhere']; $name = $farr['name']; $types = $farr['fieldstype']; if(isempt($savewhere) || isempt($fval))return $str; $savewhere = str_replace(array('{0}','{date}','{now}'), array($name, $this->rock->date,$this->rock->now), $savewhere); $savewhere = $this->rock->reparr($savewhere, $data); $saees = explode(',', $savewhere); if($types=='date' || $types=='datetime')$fval = strtotime($fval); if($types=='number')$fval = floatval($fval); foreach($saees as $saeess){ $fsaed = explode('|', $saeess); $msg = isset($fsaed[2]) ? $fsaed[2] : ''.$name.'鏁版嵁涓嶇鍙'; $val = isset($fsaed[1]) ? $fsaed[1] : ''; $lfs = $fsaed[0]; if($val != ''){ if($types=='date' || $types=='datetime')$val = strtotime($val); if($types=='number')$val = floatval($val); if($lfs=='gt'){$bo = $fval>$val;if(!$bo)return $msg;} if($lfs=='egt'){$bo = $fval>=$val;if(!$bo)return $msg;} if($lfs=='lt'){$bo = $fval<$val;if(!$bo)return $msg;} if($lfs=='elt'){$bo = $fval<=$val;if(!$bo)return $msg;} if($lfs=='eg'){$bo = $fval==$val;if(!$bo)return $msg;} if($lfs=='neg'){$bo = $fval!=$val;if(!$bo)return $msg;} } } return $str; } public function update($arr, $where) { if(is_array($arr)){ foreach($arr as $k=>$v)$this->rs[$k]=$v; } return parent::update($arr,$where); } public function updatelogvalid($whe) { $this->flogmodel->update('valid=0', $this->mwhere.' '.$whe); } public function strappend($sm, $str, $fh=',') { if(isempt($str))return $sm; if(!isempt($sm))$sm.=$fh; $sm.=$str; return $sm; } public function checkerror($lx=1,$sm='') { if($sm=='')$sm='鍗曟嵁寮傚父绠$悊鍛樺鐞'; $msg = $this->check($lx, $sm, 1); return $msg; } public function check($zt, $sm='', $lx=0) { if($this->rs['status']==1)return '娴佺▼宸插鐞嗗畬鎴,鏃犻渶鎿嶄綔'; $arr = $this->getflow(); $flowinfor = $this->getflowinfor(); if($flowinfor['ischeck']==0 && $lx==0)return '褰撳墠鏄痆'.$arr['nowcheckname'].']澶勭悊'; $nowcourse = $this->nowcourse; if($lx==1){ if($arr['nowcourseid']!=0)return '褰撳墠鏈夊鏍告楠D鏄瓨鍦ㄧ殑涓嶈兘鐩存帴鏍囪瘑宸插畬鎴'; $to = $this->flogmodel->rows($this->mwhere.' and `courseid`>0 and `status`=1'); if($to==0)return '璇ュ崟鎹病鏈変换浣曢氳繃瀹℃牳澶勭悊涓嶈兘鐩存帴鏍囪瘑宸插畬鎴愭垨宸插鏍'; $nowcourse = array('id'=>66666,'name'=>'寮傚父澶勭悊','step'=>0); } $nextcourse = $this->nextcourse; $zynameid = $this->rock->post('zynameid'); $zyname = $this->rock->post('zyname'); $csnameid = ''; $csname = ''; $nextname = $this->rock->post('nextname'); $nextnameid = $this->rock->post('nextnameid'); $qmimgstr = $this->rock->post('qmimgstr'); $tuiid = (int)$this->rock->post('tuiid'); $iszhuanyi = $ischangenext = 0; if($zt==1 && $this->isflow!=3 && isempt($zynameid) && arrvalue($nextcourse,'checktype')=='change'){ $ischangenext = 1; } if($zt!=2)$tuiid = 0; $istongyi = in_array($zt, $this->flowstatusarr); if($zynameid!='' && $istongyi){ if($zynameid==$this->adminid)return '涓嶈兘杞粰鑷繁'; $sm = $this->strappend($sm, '杞粰锛'.$zyname.''); $iszhuanyi = 1; $this->rs['syszb_name'] = $zyname; $this->rs['syszb_nameid'] = $zynameid; } if($nextnameid=='' && $ischangenext==1)return '璇烽夋嫨涓嬩竴姝ュ鐞嗕汉'; $ufied = array(); if($iszhuanyi == 0 && $zt!=2){ foreach($flowinfor['checkfields'] as $chef=>$chefv){ $ufied[$chef] = $_val = $this->rock->post('cfields_'.$chef.''); if(isempt($_val) && $chefv['isbt']=='1')$this->echomsg(''.$chefv['name'].'涓嶈兘涓虹┖'); $_stype = arrvalue($chefv, 'fieldstype'); if($_stype=='graph')$ufied[$chef] = c('input')->createqianming($_val); $_str = $this->savedatastr($_val, $chefv['fieldsarr'], $this->rs); if($_str!='')$this->echomsg($_str); } } $this->checkiszhuanyi = $iszhuanyi; $barr = $this->flowcheckbefore($zt, $ufied, $sm); $msg = ''; if(is_array($barr) && isset($barr['msg']))$msg = $barr['msg']; if(is_array($barr) && isset($barr['update'])){ foreach($barr['update'] as $_k=>$_v)$ufied[$_k] = $_v; } if(is_string($barr))$msg = $barr; if(!isempt($msg))return $msg; if($ufied){ $bo = $this->update($ufied, $this->id); if(!$bo)return 'dberr:'.$this->db->error(); } $courseact = $flowinfor['courseact']; $act = $courseact[$zt]; $statusname = $act[0]; $statuscolor= $act[1]; $nzt = $act[2]; $courseid = $nowcourse['id']; $this->checksmodel->update('`status`='.$zt.'', $this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.''); if($iszhuanyi == 1){ $this->addcheckname($courseid, $zynameid, $zyname, false, 4); $nowcourse['id'] = 0; } if($ischangenext==1){ $this->addcheckname($nextcourse['id'], $nextnameid, $nextname, true, 1); } $tuirs = array(); if($tuiid > 0)$tuirs = $this->flogmodel->getone($tuiid); if(!$tuirs)$tuiid = 0; if($tuiid>0){ $sm = $this->strappend($sm, '閫鍥炲埌['.$tuirs['name'].'('.$tuirs['checkname'].')]'); $statusname = '閫鍥'; $statuscolor = '#17B2B7'; } $this->checkistui = $tuiid; $logsm = $sm; if($iszhuanyi==0 && $csname)$logsm = $this->strappend($logsm,'鎶勯佺粰锛'.$csname.''); $this->lastlogid = $this->addlog(array( 'courseid' => $nowcourse['id'], 'name' => $nowcourse['name'], 'step' => $nowcourse['step'], 'status' => $zt, 'statusname'=> $statusname, 'color' => $statuscolor, 'explain' => $logsm, 'iszb' => $iszhuanyi, 'qmimg' => $qmimgstr )); if($tuiid > 0){ $this->addcheckname($tuirs['courseid'], $tuirs['checkid'], $tuirs['checkname'], true, 3); $this->updatelogvalid('and `courseid`>0 and `status`=1 and `step`>='.$tuirs['step'].''); } $lzt = $this->rock->repempt($nzt, $zt); $uparr = $nexttodoarr = $nexttodoarc = array(); $bsarr = $this->getflow(); $bsarr['tuiid'] = $tuiid; $nextcheckid = $bsarr['nowcheckid']; if($istongyi){ if($iszhuanyi==0){ $uparr['status']= $this->rock->repempt($nzt,'0'); } $nexttodoarr = array($nextcheckid, 'next', $sm, $statusname); }else{ if($tuiid>0){ $lzt = 23; $nexttodoarr = array($nextcheckid, 'tui', $sm, $statusname); }elseif($zt==2){ $nexttodoarr = array($this->optid, 'nothrough', $sm, $statusname); } $uparr['status'] = $lzt; } $this->flowcheckafter($zt, $sm, $nowcourse); $bsarr['nstatus'] = $lzt; $bsarr['checksm'] = $sm; if(!$this->nowcourse){ $uparr['status'] = $lzt; $nexttodoarc = array($this->optid, 'finish', $sm, ''); } if($uparr){ $this->update($uparr, $this->id); } if(!$this->nowcourse){ $this->flowcheckfinsh($zt); if($istongyi){ $this->checksmodel->delete($this->mwhere); } } $bsarr['status'] = $this->rs['status']; $this->getflowsave($bsarr, true); if($this->db->backsql()){ $bos = ($courseid == arrvalue($this->nowcourse, 'id') && $istongyi); if($nexttodoarr && (!$bos || $iszhuanyi==1))$this->nexttodo($nexttodoarr[0],$nexttodoarr[1],$nexttodoarr[2],$nexttodoarr[3]); if($nexttodoarc)$this->nexttodo($nexttodoarc[0],$nexttodoarc[1],$nexttodoarc[2],$nexttodoarc[3]); } if($iszhuanyi == 1){ $this->gettodosend('bozhuan','', $sm, 0, ''.$this->adminname.'灏哰'.$nowcourse['name'].']杞粰:'.$zyname.''); }else{ if($istongyi)$this->gettodosend('botong', $statusname, $sm, $nowcourse['id']); if($zt==2)$this->gettodosend('bobutong',$statusname, $sm, $nowcourse['id']); if(!$this->nowcourse && $istongyi)$this->gettodosend('bofinish', '', $sm); } if($iszhuanyi==0){ $sm1 = '鍦ㄢ'.$nowcourse['name'].'鈥濆鐞'.$statusname.''; $this->savecsname($csnameid,$csname,$this->adminid,$nowcourse['id'],1, $sm1); } return 'ok'; } public function pushs($receid, $cont, $title='', $params=array()) { return $this->push($receid,'', $cont, $title, 0, $params); } public function getxiangurl($num='', $id=0, $lx='x') { if($num=='')$num = $this->modenum; if($id==0)$id = $this->id; $url = URL; if($lx=='auto')$lx = ($this->ismobile==1)?'x':'p'; if($lx=='x' || $lx=='a')$url = $this->rock->getouturl(); $url = ''.$url.'task.php?a='.$lx.'&num='.$num.'&mid='.$id.''; if(COMPANYNUM)$url.='&dwnum='.COMPANYNUM.''; return $url; } public function getxiangurlx($num='',$id=0){return $this->getxiangurl($num,$id,'x');} public function push($receid, $gname='', $cont='', $title='', $wkal=0, $params=array()) { if(isempt($receid) && $wkal==1)$receid='all'; if(isempt($receid))return false; if(contain(','.$receid.',', ',d1,'))$receid='all'; $modenum = arrvalue($params, 'modenum', $this->modenum); $modename = arrvalue($params, 'modename', $this->modename); $id = (int)arrvalue($params, 'id', $this->id); $moders = arrvalue($params, 'moders'); if(!is_array($moders))$moders = $this->moders; if($gname=='')$gname = $modename; $reim = m('reim'); $url = $this->getxiangurl($modenum, $id, 'p'); $wxurl = $this->getxiangurl($modenum, $id, 'x'); $emurl = $this->getxiangurl($modenum, $id, 'a'); if($id==0){ $url = '';$wxurl = '';$emurl=''; } $url = arrvalue($params, 'url', $url); $wxurl = arrvalue($params, 'wxurl', $wxurl); $emurl = arrvalue($params, 'emurl', $emurl); $slx = 0; $pctx = $moders['pctx']; $mctx = $moders['mctx']; $wxtx = $moders['wxtx']; $ddtx = $moders['ddtx']; $emtx = $moders['emtx']; if($pctx==0 && $mctx==1)$slx=2; if($pctx==1 && $mctx==0)$slx=1; if($pctx==0 && $mctx==0)$slx=3; $this->rs['now_adminname'] = $this->adminname; $this->rs['now_modename'] = $modename; $cont = $this->rock->reparr($cont, $this->rs); $receido= $receid; $receid = $this->adminmodel->gjoins($receid); $uids = m('todo')->addtodo($receid, $modename, $cont, $modenum, $id); if($uids!='' && $moders['type'] != '绯荤粺' && $id > 0)$this->todosmodel->addtotouids($uids, array( 'table' => $moders['table'], 'mid' => $id, 'modename' => $modename, 'modenum' => $modenum, )); $title = $this->rock->reparr($title, $this->rs); $reim->pushagent($uids, $gname, $cont, $title, $url, $wxurl, $slx, ''.$modenum.'|'.$id.''); $this->flowchangetodo($uids, $gname); if(isempt($title))$title = $modename; $this->flowweixinarr=array(); return $receid; } public function nexttodo($nuid, $type, $sm='', $act='') { $cont = ''; $tit = ''; $gname = '娴佺▼寰呭姙'; $summary= $this->getsummary(); if($type=='submit' || $type=='next' || $type == 'cuiban'){ $cont = '浣犳湁['.$this->uname.']鐨刐'.$this->modename.',鍗曞彿:'.$this->sericnum.']闇瑕佸鐞'; if($sm!='')$cont.='锛岃鏄:'.$sm.''; $tit = ''.$this->uname.'鐨'.$this->modename.''; if($type != 'cuiban'){ $txnum = $this->option->getval('sms_txnum'); if(!isempt($txnum)){ $mknum = $this->option->getval('sms_mknum'); if($mknum=='all' || contain(','.$mknum.',',','.$this->modenum.',')){ $wxurl = $this->getxiangurlx(); $barr = c('xinhuapi')->sendsms($nuid, '', $txnum, array( 'modename' => $this->modename, 'sericnum' => $this->sericnum, 'applyname'=> $this->uname, 'deptname' => $this->rs['base_deptname'], ),$wxurl); } } } $type = 'daiban'; } if($type == 'nothrough'){ $cont = '浣犳彁浜'.$this->modename.',鍗曞彿:'.$this->sericnum.']'.$this->adminname.'澶勭悊['.$act.']锛屽師鍥:['.$sm.']'; $gname= '娴佺▼鐢宠'; $tit = ''.$this->modename.'澶勭悊'.$act.''; } if($type == 'finish'){ $cont = '浣犳彁浜ょ殑['.$this->modename.',鍗曞彿:'.$this->sericnum.']宸插叏閮ㄥ鐞嗗畬鎴'; $gname= '娴佺▼鐢宠'; $tit = ''.$this->modename.'鍏ㄩ儴澶勭悊瀹屾垚'; } if($type == 'zhui'){ $cont = ''.$this->adminname.'杩藉姞鍗曟嵁璇存槑['.$this->modename.',鍗曞彿:'.$this->sericnum.']锛岃鏄:['.$sm.']'; } if($type == 'tui'){ $cont = '['.$this->adminname.']閫鍥炲崟鎹甗'.$this->modename.',鍗曞彿:'.$this->sericnum.']鍒颁綘杩欒鍙婃椂澶勭悊锛岃鏄:'.$sm.''; } if($type == 'chao'){ $cont = ''.$this->adminname.''.$sm.'浜嗏'.$this->modename.'鈥'; if(!isempt($summary))$cont.='锛屾憳瑕佲'.$summary.'鈥'; if($this->isflow>0)$cont.='锛屽崟鍙封'.$this->sericnum.'鈥'; $gname= ''; $tit = ''.$this->modename.'鐨勫崟鎹妱閫'; } if($type=='pinglun'){ $cont = ''.$this->adminname.''.$act.'浣犵殑['.$this->modename.']鍗曟嵁锛岃鏄:'.$sm.''; $gname = ''; $tit = ''.$this->modename.'璇勮'; } if($type=='receipt'){ $cont = ''.$this->adminname.''.$act.'['.$this->modename.']鐨勫崟鎹'; if($sm!='')$cont.='锛岃鏄:'.$sm.''; $gname = '鍥炴墽纭'; $tit = ''.$this->modename.'鍥炴墽纭'; } $nbis = $this->flownexttodo($type); if($nbis){ if(is_string($nbis))$cont = $nbis; if(is_array($nbis)){ $tit = arrvalue($nbis, 'title', $tit); $gname = arrvalue($nbis, 'gname', $gname); $cont = arrvalue($nbis, 'cont', $cont); } } if($cont!='')$this->push($nuid, $gname, $cont, $tit); } public function getwxurl($num='') { if($num=='')$num = $this->modenum; $url = $this->rock->getouturl(); $str = ''.$url.'?m=ying&d=we&num='.$num.''; return $str; } public function getweurl($num='') { if($num=='')$num = $this->modenum; $url = $this->rock->getouturl(); $str = ''.$url.'?m=ying&d=we&mnum='.$num.''; return $str; } public function deletebill($sm='', $qxpd=true) { if(getconfig('systype')=='demo')return '婕旂ず璇峰嬁鍒犻櫎'; if($qxpd){ $is = $this->isdeleteqx(); if($is==0)return '鏃犳潈鍒犻櫎'; } if(method_exists($this,'flowdeletebillbefore')){ $bstr = $this->flowdeletebillbefore($sm); if(!isempt($bstr))return $bstr; } $modewhere = "`modenum`='".$this->modenum."' and `mid`=".$this->id.""; $this->flogmodel->delete($this->mwhere); m('reads')->delete($this->mwhere); m('file')->delfile('', "`mtype`='".$this->mtable."' and `mid`=".$this->id." and `id` not in(select `fileid` from `[Q]files` where `type`=3)"); $tables = $this->moders['tables']; if(!isempt($tables)){ $arrse = explode(',', $tables); foreach($arrse as $arrses)m($arrses)->delete('mid='.$this->id.''); } $this->billmodel->delete($this->mwhere); $this->todosmodel->delete($this->mwhere); $this->checksmodel->delete($this->mwhere); $this->chaomodel->delete($this->mwhere); m('remind')->delete($this->mwhere); m('todo')->delete($this->mwhere); m('todo')->delete($modewhere); m('receipt')->delete($this->mwhere); m('im_history')->delete("`xgurl`='".$this->modenum."|".$this->id."'"); m('files')->delete("`ip`='".$this->modenum."|".$this->id."'"); $this->delete($this->id); $this->flowdeletebill($sm); $this->flowzuofeibill($sm); $this->gettodosend('bodel','', $sm); $dels = '鍒犻櫎妯″潡['.$this->modename.']id涓'.$this->id.'鐨勫崟鎹'; $ztss = arrvalue($this->rs,'base_summary'); if(!isempt($ztss))$dels.=',鎽樿['.$ztss.']'; if(!isempt($sm))$dels.=',璇存槑:'.$sm.''; m('log')->addlogs('鍒犻櫎鍗曟嵁', $dels, 3); foreach($this->wherejoin as $num=>$fields){ $this->deletebilljoin($num, "`$fields`='$this->id'", $sm); } return 'ok'; } public function deletebilljoin($num, $where, $sm='') { $flow = m('flow')->initflow($num); $rows = $flow->getall($where); foreach($rows as $k1=>$rs1){ $mid = $rs1['id']; $flow->loaddata($mid, false); $flow->deletebill($sm, false); } } public function zuofeibilljoin($num, $where, $sm='') { $flow = m('flow')->initflow($num); $rows = $flow->getall($where); foreach($rows as $k1=>$rs1){ $mid = $rs1['id']; $flow->loaddata($mid, false); $flow->zuofeibill($sm); } } public function zuofeibill($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '浣滃簾', 'status' => 1, )); $this->update('`status`=5', $this->id); $zfarr = array( 'status' => 5, 'nstatus' => 5, 'checksm' => '浣滃簾锛'.$sm.'', 'nowcheckid' => '', 'nowcheckname' => '', 'nstatustext' => '浣滃簾', 'updt' => $this->rock->now, ); $this->billmodel->update($zfarr, $this->mwhere); $tables = $this->moders['tables']; if(!isempt($tables)){ $arrse = explode(',', $tables); foreach($arrse as $arrses)m($arrses)->delete('mid='.$this->id.''); } $this->flowzuofeibill($sm); $this->gettodosend('bozuofei','', $sm); foreach($this->wherejoin as $num=>$fields){ $this->zuofeibilljoin($num, "`$fields`='$this->id'", $sm); } return 'ok'; } public function openxiang() { $xiangdata = $btndata = array(); $data = $this->flowrsreplace($this->rs,4); foreach($this->fieldsarra as $k=>$rs){ if($rs['iszs']=='1'){ $xiangdata[] = array( 'name' => $rs['name'], 'fields'=> $rs['fields'], 'value' => $this->rock->repempt(arrvalue($data,$rs['fields'])) ); } } $barr['xiangdata'] = $xiangdata; $btnrows = $this->db->getrows('[Q]flow_menu',"`setid`='$this->modeid' and `status`=1 and `num` like 'open%'",'id,wherestr,name,num,issm,type','`sort`'); foreach($btnrows as $k=>$rs){ $wherestr = $rs['wherestr']; $bo = false; if(isempt($wherestr)){ $bo = true; }else{ $ewet = $this->wheremodel->getstrwhere($this->rock->jm->base64decode($wherestr)); $ewet = str_replace(array('{asqom}','1=2 and'),'', $ewet); $tos = $this->rows("`id`='$this->id' and $ewet"); if($tos>0)$bo = true; } if($bo)$btndata[] = array( 'id' => $rs['id'], 'name' => $rs['name'], 'issm' => $rs['issm'], ); } $barr['btndata'] = $btndata; if(method_exists($this,'flowopenxiang')){ $lbarr = $this->flowopenxiang($data,$xiangdata,$btndata); if(is_array($lbarr))foreach($lbarr as $k=>$v)$barr[$k]=$v; } return $barr; } public function smschuiban($sm='') { if($this->isflow>0 && $this->adminid==$this->uid){ $farr = $this->getflow(true); $nowcheckid = $farr['nowcheckid']; $tplnum = $this->option->getval('sms_cbnum','defnum'); $wxurl = $this->getxiangurlx(); $barr = c('xinhuapi')->sendsms($nowcheckid, '', $tplnum, array( 'modename' => $this->modename, 'sericnum' => $this->sericnum, 'applyname'=> $this->uname, 'deptname' => $this->rs['base_deptname'], ),$wxurl, false, false); if(!$barr['success'])return $barr['msg']; $this->addlog(array( 'explain' => $sm, 'name' => '鐭俊鍌姙', 'status' => 1, )); } return 'ok'; } public function reloadflow($sm='') { $this->update(array('status'=>0), $this->id); $this->flogmodel->update('`valid`=0', ''.$this->mwhere.' and `courseid`>0'); $this->addlog(array( 'explain' => $sm, 'name' => '閲嶆柊瀹℃壒', 'status' => 1, )); $this->getflow(true); $this->billmodel->update('`status`=0,`nstatus`=0',$this->mwhere); return 'ok'; } public function addschedule($sm='') { $txdt = $this->rock->post('txdt'); if(isempt($sm))return '璇存槑涓嶈兘涓虹┖'; if(isempt($txdt))return '鎻愰啋鏃堕棿涓嶈兘涓虹┖'; $barr['title'] = $sm; $barr['startdt'] = $txdt; $barr['uid'] = $this->adminid; $barr['optdt'] = $this->rock->now; $barr['optname']= $this->adminname; $barr['txsj'] = 1; m('schedule')->insert($barr); return 'ok'; } public function getoptmenu($flx=0) { $where = ''; if($flx==1)$where='and `iszs`=1'; $rows = $this->db->getrows('[Q]flow_menu',"`setid`='$this->modeid' ".$where." and `status`=1",'id,wherestr,name,statuscolor,statusvalue,num,islog,issm,type,upgcont','`sort`'); $arr = array(); $bfrom = $this->rock->post('bfrom'); if($flx==0)$arr[] = array('lx'=>0,'name'=>$this->rock->jm->base64decode('5pyq562!5o6I5peg5rOV5pi!56S66I!c5Y2V5aaC5bey562!5o6I5Y675Y2H57qn'),'optmenuid'=>0,'color'=>'red'); if($flx==1)return $arr; $status = (int)arrvalue($this->rs,'status','0'); $isturn = (int)arrvalue($this->rs, 'isturn','0'); $ismy = ($this->uid == $this->adminid or $this->optid == $this->adminid); $isreadbo = $this->isreadqx(1); if($this->isflow>0 && $isturn==1){ } if($status != 5 && arrvalue($this->moders,'ispl','1')=='1' && $isreadbo){ $arr[] = array('name'=>lang('璇勮'),'lx'=>15,'nup'=>1,'issm'=>1,'optmenuid'=>-15); } if($ismy && arrvalue($this->moders,'ishz')=='1' && $status==1){ $smcont = $this->getsummary(); $mid = (int)m('receipt')->getmou('id',"`uid`='$this->adminid' and `modenum`='$this->modenum' and `mid`='$this->id'"); $namess = '鍥炴墽纭璁剧疆'; if($mid>0)$namess = '鍥炴墽纭缂栬緫'; $arr[] = array('name'=>$namess,'djmid'=>$mid,'optnum'=>'receipt','lx'=>'18','optmenuid'=>-18,'modename'=>$this->modename,'smcont'=>$smcont); } if($isreadbo && arrvalue($this->moders,'istxset','1')=='1' && $this->modenum != 'remind' && !in_array($status, array(2,5))){ $smcont = ''.$this->modename.'锛'.$this->getsummary(); $mid = (int)m('remind')->getmou('id',"`uid`='$this->adminid' and `modenum`='$this->modenum' and `mid`='$this->id'"); $namess = '锛嬫坊鍔犳彁閱掕缃'; if($mid>0)$namess = '鎻愰啋璁剧疆缂栬緫'; $arr[] = array('name'=>$namess,'djmid'=>$mid,'smcont'=>$smcont,'issm'=>1,'optnum'=>'tixing','lx'=>'14','optmenuid'=>-14); } if($this->iseditqx()==1 && $isreadbo){ $arr[] = array('name'=>lang('缂栬緫'),'optnum'=>'edit','lx'=>'11','optmenuid'=>-11); } if($this->isdeleteqx()==1){ $arr[] = array('name'=>lang('鍒犻櫎'),'color'=>'red','optnum'=>'del','nup'=>1,'issm'=>0,'islog'=>0,'statusvalue'=>9,'lx'=>'9','optmenuid'=>-9); } if(method_exists($this,'flowgetoptmenuarr')){ $lbarr = $this->flowgetoptmenuarr($flx); if(is_array($lbarr))foreach($lbarr as $k=>$v)$arr[]=$v; } return $arr; } public function optmenu($czid, $zt, $sm='') { $msg = ''; $cname = $this->rock->post('changename'); $cnameid = $this->rock->post('changenameid'); $cdate = $this->rock->post('changedate'); $darr = array( 'cname' => $cname, 'cnameid' => $cnameid, 'cdate' => $cdate, 'sm' => $sm, ); if($czid==-9){ $msg = $this->deletebill($sm); }else if($czid==-10){ $msg = $this->check($zt, $sm); if(contain($msg,'鎴愬姛'))$msg = 'ok'; }else if($czid==-12){ $this->zhuijiaexplain($sm); }else if($czid==-13){ $this->chuiban($sm); }else if($czid==-14){ $msg = $this->addschedule($sm); }else if($czid==-15){ $actname = $this->rock->post('name'); $this->addlog(array( 'explain' => $sm, 'name' => $actname, )); $uids = ''; if(isset($this->rs['uid'])){ $uids= $this->rs['uid']; }else if(isset($this->rs['optid'])){ $uids= $this->rs['optid']; } if($uids)$this->nexttodo($uids, 'pinglun', $sm, $actname); $this->gettodosend('boping','', $sm); }else if($czid==-16){ $this->zuofeibill($sm); }else if($czid==-17){ $msg = $this->smschuiban($sm); }else if($czid==-18){ $msg = $this->jiankongzb($darr); }else if($czid==-19){ $msg = $this->reloadflow($sm); }else{ } if($msg=='')$msg='ok'; return $msg; } public function jiankongzb($darr) { return $this->bd6('5peg5L!h5ZG8562!5o6I5peg5q2k5Yqf6IO9'); } public function billwhere($uid, $lx) { $arr['table'] = $this->mtable; $arr['tableleft'] = ''; $arr['fields'] = ''; $arr['order'] = ''; $arr['group'] = ''; $arr['keywhere']= ''; $arr['asqom'] = ''; $arr['onlywhere'] = ''; $arr['companywhere']= ''; $this->atype = $lx; $nas = $this->flowbillwhere($uid, $lx); $inwhere = ''; if(substr($lx,0,5)=='grant'){ $inwhere = $this->viewmodel->viewwhere($this->moders, $this->adminid, $this->flowviewufieds, 1); } if($lx=='chaos'){ $inwhere = "and {asqom}`id` in(select `mid` from `[Q]flow_chao` where `table`='{$this->mtable}' and ".$this->rock->dbinstr('csnameid', $this->adminid).")"; } if($lx=='mychuli'){ $inwhere = "and {asqom}`id` in(select bill.`mid` from `[Q]flow_bill` as `bill` where bill.`modeid`='{$this->modeid}' and ".$this->rock->dbinstr('bill.`allcheckid`', $this->adminid).")"; } $_wehs = ''; if(is_array($nas)){ if(isset($nas['where']))$_wehs = $nas['where']; $ftears = explode(',','asqom,order,fields,fieldsleft,table,group,companywhere,onlywhere,keywhere,tableleft'); foreach($ftears as $fid)if(isset($nas[$fid]))$arr[$fid] = $nas[$fid]; }else{ $_wehs = $nas; } $fwhere = $this->getflowwhere($uid, $lx); $path = ''.P.'/flow/page/rock_page_'.$this->modenum.'.php'; $table = $arr['table']; $temsao = 0; if(!contain($table, ' ') && $this->isflow>0){ $arr['table'] = '`[Q]'.$this->mtable.'` a left join `[Q]flow_bill` b on a.`id`=b.`mid` and b.`table`=\''.$this->mtable.'\''; if(!isempt($arr['tableleft']))$arr['table'].=' left join '.$arr['tableleft'].''; $arr['asqom'] = 'a.'; $arr['fields']= 'a.*,b.`uname` as base_name,b.`udeptname` as base_deptname,b.`sericnum`,b.`nowcheckname`'; if(isset($arr['fieldsleft']) && $arr['fieldsleft'])$arr['fields'].=','.$arr['fieldsleft'].''; if($arr['order']=='')$arr['order'] = 'a.`optdt` desc'; $temsao = 1; if($this->defaultorder){ $defa = explode(',', $this->defaultorder); $desc = arrvalue($defa, 1, 'desc'); $arr['order'] = 'a.`'.$defa[0].'` '.$desc.''; } } if(isempt($arr['order'])){ $arr['order'] = '{asqom}`id` desc'; if($this->defaultorder){ $defa = explode(',', $this->defaultorder); $desc = arrvalue($defa, 1, 'desc'); $arr['order'] = '{asqom}`'.$defa[0].'` '.$desc.''; } } if(isempt($fwhere) && isempt($inwhere) && $this->moders['isscl']>0){ $fwhere = 'and 1=2'; } $where = $inwhere; $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $where .= ' and {asqom}'.$wherestr; } if($fwhere!='')$where .= ' '.$fwhere; if($_wehs!='')$where .= ' '.$_wehs; $highwhere = $this->gethighwhere(); $allfields = array(); $key = $this->rock->post('key'); $pnum = $this->rock->post('pnum'); $status = $this->rock->post('keystatus'); $ztfields = arrvalue($nas, 'ztfields', 'status'); $xhlikea = array('like','=','>=','<=', 'not like'); $xhfields = $this->rock->post('xhfields'); $xhlike = (int)$this->rock->post('xhlike','0'); $xhkeygj = $this->rock->jm->base64decode($this->rock->post('xhkeygj')); if(!isempt($xhkeygj) && $xhfields){ if(substr($xhfields,0,2)=='zb'){ $xu = substr($xhfields,2,1); $zbasr = explode(',', $this->moders['tables']); $zbts = arrvalue($zbasr,$xu); $xhfields = substr($xhfields,4); $wher1 = "`$xhfields` ".$xhlikea[$xhlike].""; if($xhlike==0 || $xhlike==4)$wher1.=" '%".$xhkeygj."%'"; if($xhlike==1 || $xhlike==2 || $xhlike==3)$wher1.=" '$xhkeygj'"; $wher1 = " and {asqom}`id` in(select `mid` from `[Q]".$zbts."` where ".$wher1.")"; $where.= $wher1; }else{ $wher1 = " and {asqom}`$xhfields` ".$xhlikea[$xhlike].""; if($xhlike==0 || $xhlike==4)$wher1.=" '%".$xhkeygj."%'"; if($xhlike==1 || $xhlike==2 || $xhlike==3)$wher1.=" '$xhkeygj'"; $where.= $wher1; } } if(!isempt($status))$where .= ' and {asqom}`'.$ztfields.'`='.$status.''; if(!isempt($key) && isempt($arr['keywhere'])){ $check = c('check'); $allfields = $this->db->getallfields('[Q]'.$this->mtable.''); $_kearr = array(); if($check->isdate($key) || $check->ismonth($key)){ $skeay = array('date','datetime','month'); foreach($this->fieldsarra as $k=>$rs){ $flx = $rs['fieldstype']; $fid = $rs['fields']; if($rs['issou']==1 && in_array($flx, $skeay) && in_array($fid, $allfields)){ if($check->isdate($key)){ if($flx=='date')$_kearr[] = "{asqom}`".$fid."`='$key'"; if($flx=='datetime')$_kearr[] = "{asqom}`".$fid."` like '$key%'"; if($flx=='month')$_kearr[] = "{asqom}`".$fid."`='".substr($key,0,7)."'"; if($temsao==1){ $_kearr[] = "b.`applydt`='$key'"; } } if($check->ismonth($key)){ if($flx=='month'){ $_kearr[] = "{asqom}`".$fid."`='$key'"; }else{ $_kearr[] = "{asqom}`".$fid."` like '$key%'"; } if($temsao==1){ $_kearr[] = "b.`applydt` like '$key%'"; } } } } } if(!$_kearr){ $skeay = array('text','textarea','htmlediter','changeuser','changeusercheck','changedept','changedeptusercheck','selectdatafalse','selectdatatrue','num'); $xiakk = array('rockcombo','select'); foreach($this->fieldsarra as $k=>$rs){ if($rs['issou']==1 && in_array($rs['fields'], $allfields) && substr($rs['fields'],-2) != 'dt'){ if(in_array($rs['fieldstype'], $skeay))$_kearr[] = "{asqom}`".$rs['fields']."` like '%".$key."%'"; } } if($temsao==1){ $_kearr[] = "b.`uname` like '%".$key."%'"; $_kearr[] = "b.`udeptname` like '%".$key."%'"; $_kearr[] = "b.`sericnum` = '$key'"; $_kearr[] = "b.`nowcheckname` = '$key'"; } if(isset($nas['orlikefields'])){ $owhee = explode(',', $nas['orlikefields']); foreach($owhee as $owhees){ $_owhees = explode('@', $owhees); $sle = arrvalue($_owhees, 1); if($sle=='1'){ $_kearr[] = "".$_owhees[0]." ='$key'"; }else{ $_kearr[] = "".$_owhees[0]." like '%".$key."%'"; } } } } if($_kearr && $arr['onlywhere']=='')$arr['keywhere'] = "and (".join(' or ',$_kearr).")"; } if(!isempt($arr['companywhere']) && getconfig('companymode'))$where .= ' '.$arr['companywhere']; if(!isempt($arr['onlywhere']))$where .= ' '.$arr['onlywhere']; if(!isempt($arr['keywhere']))$where .= ' '.$arr['keywhere']; if($highwhere!='')$where .= ' '.$highwhere; $where = str_replace('{asqom}', $arr['asqom'], $where); $arr['order'] = str_replace('{asqom}', $arr['asqom'], $arr['order']); $where = str_replace('[A]', $arr['asqom'], $where); $fields = $arr['fields']; if($this->flowfieldstype==1 && (isempt($fields) || $fields=='*') && $this->moders['isscl']>0){ if(!$allfields)$allfields = $this->db->getallfields('[Q]'.$this->mtable.''); $fields = '{asqom}`id`'; $odlvs = $this->option->getval('columns_'.$this->modenum.'_'.$pnum.''); if(isempt($odlvs)){ foreach($this->fieldsarra as $k=>$rs){ if($rs['islb']==1 && in_array($rs['fields'],$allfields)){ $fields.=',{asqom}`'.$rs['fields'].'`'; } } }else{ $odlvsa = explode(',', $odlvs); foreach($odlvsa as $odlvs1){ if(in_array($odlvs1, $allfields)){ $fields.=',{asqom}`'.$odlvs1.'`'; } } } if($this->isflow>0){ if(!contain($fields,'`status`'))$fields.=',{asqom}`status`'; } $fields = str_replace('{asqom}', $arr['asqom'], $fields); $arr['fields'] = $fields; } $fields = $arr['fields']; if(!isempt($fields) && $fields!='*'){ $fieldsa = explode(',', $fields); $fieldss = ''; foreach($fieldsa as $fieldsas){ if(contain($fieldsas,'`') || contain($fieldsas,'.') || contain($fieldsas,' ') || contain($fieldsas,'(')){ $fieldss.=','.$fieldsas.''; }else{ $fieldss.=',`'.$fieldsas.'`'; } } $arr['fields'] = substr($fieldss, 1); } $arr['where'] = str_replace('{asqom}','`[Q]'.$this->mtable.'`.', $where); return $arr; } public function gethighwhere() { $s = ''; return $s; } public function getflowwhere($uid, $num) { $where = ''; $rs = $this->wheremodel->getone("`setid`='$this->modeid' and `num`='$num'"); if(!$rs)return $where; $where = $this->wheremodel->getwherestr($rs, $uid, $this->flowviewufieds); return $where; } public function getflowrows($uid, $lx, $limit=5, $swher='') { $nas = $this->billwhere($uid, $lx); $table = $nas['table']; if(!contain($table,' '))$table='[Q]'.$table.''; if(isempt($nas['fields']))$nas['fields'] = '*'; $swher = str_replace('{asqom}',$nas['asqom'], $swher); $where = '1=1 '.$nas['where'].' '.$swher.''; if($limit==0)return $this->db->rows($table, $where ); $rows = $this->db->getrows($table, $where , $nas['fields'], $nas['order'], $limit); foreach($rows as $k=>$rs){ $rows[$k] = $this->rsreplace($rs, 2); } return $rows; } public function gettodorows($whereid) { $where = $this->wheremodel->getwherestr($whereid, $this->adminid, $this->flowviewufieds); $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $where .= ' and '.$wherestr; } $where = str_replace('{asqom}','', $where); $rows = $this->getall('2=2 '.$where.''); foreach($rows as $k=>$rs){ $rows[$k] = $this->rsreplace($rs, 1); } return $rows; } public function printexecl($event) { $arr['moders'] = $this->moders; $arr['fields'] = $this->getfields(); $cell = 1; foreach($arr['fields'] as $k=>$v)$cell++; $arr['cell'] = $cell; $where = '1=1'; $str1 = $this->moders['where']; if(!isempt($str1)){ $str1 = $this->rock->covexec($str1); $where = $str1; } $vwhere = $this->viewmodel->viewwhere($this->moders, $this->adminid); $rows = $this->getrows(''.$where.' '.$vwhere.'', '*', 'id desc', 100); $arr['rows'] = $this->flowprintrows($rows); $arr['count'] = $this->db->count; return $arr; } public function getsuballdata($lx=0, $mid=0) { $tabless = $this->moders['tables']; $subdata = array(); if($mid==0)$mid = $this->id; if(!isempt($tabless)){ $tablessa = explode(',', $tabless); $namessa = explode(',', $this->moders['names']); $tabless1 = '['.str_replace(',','],[', $tabless).']'; foreach($tablessa as $zbx=>$tables){ $cis = substr_count($tabless1, '['.$tables.']'); $whes = ''; if($cis>1)$whes=' and `sslx`='.$zbx.''; $data = m($tables)->getall('mid='.$mid.''.$whes.'','*','`sort`'); $data = $this->flowsubdata($data, $lx, $zbx); if($lx == 0){ $subdata['subdata'.$zbx.''] = $data; }else{ $subdata[$zbx] = array( 'data' => $data, 'fields'=> 'subdata'.$zbx.'', 'name' => $this->rock->arrvalue($namessa, $zbx) ); } } } return $subdata; } private $gettodolistarr = null; public function gettodolist($act) { if(is_array($act))return $act; if($this->gettodolistarr === null){ $rows = $this->todomodel->getrows("`setid`='".$this->modeid."' and `status`=1"); $barr = array(); foreach($rows as $k=>$rs){ $whereid = (int)$rs['whereid']; if($whereid > 0){ $bo = $this->wheremanzhu($whereid); if(!$bo)continue; } $barr[] = $rs; } $this->gettodolistarr = $barr; }else{ $barr = $this->gettodolistarr; } $garr = array(); if($barr)foreach($barr as $k=>$rs){ if(arrvalue($rs,$act)=='1')$garr[] = $rs; } return $garr; } public function gettodosend($act, $actname='',$sm='', $courseid=0, $conts='') { $barr = $this->gettodolist($act); if(!$barr)return; $changearr = array('boturn'=>'鎻愪氦','boedit'=>'缂栬緫','bozhuan'=>'杞姙','bochang'=>'淇敼瀛楁','bodel'=>'鍒犻櫎','bozuofei'=>'浣滃簾','botong'=>'澶勭悊鍚屾剰','bobutong'=>'澶勭悊涓嶅悓鎰','bofinish'=>'鍏ㄩ儴澶勭悊瀹屾垚','bozhui'=>'杩藉姞璇存槑','boping'=>'璇勮','bohuiz'=>'鍥炴墽纭'); if($actname=='' && is_string($act))$actname = arrvalue($changearr, $act); if(isempt($actname))return; $cheo = c('check'); foreach($barr as $k=>$rs){ $receid = $rs['receid']; if($act=='botong' || $act=='bobutong'){ $changewe = $rs['changecourse']; if(!isempt($changewe) && !contain(','.$changewe.',',','.$courseid.','))continue; } if($rs['toturn']==1)$receid.=','.$this->uid.''; if(arrvalue($rs,'tosuper')=='1'){ $supar = $this->adminmodel->getsuperman($this->uid); $shnej = arrvalue($supar, 0); if(!isempt($shnej))$receid.=','.$shnej.''; } if($rs['tocourse']==1 && $this->billrs){ $allcheckid = $this->billrs['allcheckid']; if(!isempt($allcheckid))$receid.=','.$allcheckid.''; } $todofields = $rs['todofields']; if(!isempt($todofields)){ $toad = explode(',', $todofields); foreach($toad as $toads){ $ttv = arrvalue($this->rs, $toads); if(!isempt($ttv) && $cheo->isinnumber($ttv))$receid.=','.$ttv.''; } } if(isempt($receid))continue; if(substr($receid,0,1)==',')$receid = substr($receid, 1); $cont = $rs['summary']; if(isempt($cont))$cont = $conts; if(isempt($cont)){ $cont = ''.$this->adminname.''.$actname.'['.$this->modename.',鍗曞彿:'.$this->sericnum.']'; if($sm!='')$cont.=',璇存槑:'.$sm.''; } $this->push($receid, '', $cont, $this->rock->repempt($rs['name'])); } } public function numtodosend($num, $actname='',$sm='') { $rows = $this->todomodel->getrows("`setid`='".$this->modeid."' and `num`='$num' and `status`=1"); if(!$rows)return; $this->gettodosend($rows, $actname, $sm); } public function flowtotal($fields='', $type='') { if($fields=='')$fields = $this->rock->post('total_fields'); if($type=='')$type = $this->rock->post('total_type','jls'); $typea = explode('|', $type); $typefields = ''; $type = $typea[0]; $typefields = arrvalue($typea, 1); $rowa = array(); $rowa[] = array( 'name' => '鏆傛棤鏁版嵁', 'value' => 0, 'bili' => '' ); $tofiels= 'count(1)'; if($type=='sum')$tofiels = 'sum([A]`'.$typefields.'`)'; if($type=='avg')$tofiels = 'avg([A]`'.$typefields.'`)'; $atype = $this->rock->post('atype'); $table = '[Q]'.$this->mtable.''; $narr = $this->billwhere($this->adminid, $atype); $where = $narr['where']; $table = $narr['table']; if(!contain($table,' '))$table = '[Q]'.$table.''; $gwhere = $this->rock->post('where'); if(!isempt($gwhere)){ $gwhere = $this->rock->jm->uncrypt($this->rock->iconvsql($gwhere)); $where .= ' '.$gwhere.''; } $sql = 'select '.$fields.' as `name`,'.$tofiels.' as value from '.$table.' where 1=1 '.$where.' group by '.$fields.''; $sql = str_replace('[A]', $narr['asqom'], $sql); $rows = $this->db->getall($sql); $total = 0; if($rows){ foreach($rows as $k=>$rs)$total+=floatval($rs['value']); if($total>0)foreach($rows as $k=>$rs){ $rows[$k]['bili'] = $this->rock->number($rs['value']*100/$total).'%'; } if($type!='avg' && count($rows)>1)$rows[] = array('name' => '鍚堣','value' => $total,'bili' => ''); }else{ $rows = $rowa; } return $rows; } public function receiptcheck($hid, $sm) { return 'ok'; } public function getrowstable($atype, $where, $limit=100,$fields='') { $rows = $this->getflowrows($this->adminid,$atype,$limit,$where); $headstr = '@xuhaos,,center'; foreach($this->fieldsarra as $k=>$rs){ $bo = false; if(!$fields && $rs['islb']==1 && $rs['iszb']=='0')$bo = true; if($fields && contain(','.$fields.',',','.$rs['fields'].','))$bo = true; if($bo)$headstr.='@'.$rs['fields'].','.$rs['name'].''; } if($this->isflow>0){ $headstr.='@statustext,鐘舵'; if(is_array($rows))foreach($rows as $k=>$rs){ $rows[$k]['statustext'] = $this->getstatusstr($rs); } } $cont = c('html')->createrows($rows, substr($headstr, 1),'#cccccc','noborder'); return $cont; } public function lang($ky) { return lang($ky,'mode_'.$this->modenum.''); } public function rsreplace($rs, $lx, $kzq=null, $ly=0) { $id = (int)arrvalue($rs, 'id','0'); if($id<=0)return $rs; $rs = $this->flowrsreplace($rs, $lx); if($this->tfieldarr)foreach($this->tfieldarr as $k1=>$frs){ $type = $frs['fieldstype']; $fid = $frs['fields']; $val = arrvalue($rs, $fid); if($type=='uploadimg' && !contain($val,'<')){ if($val && $lx==2)$rs[''.$fid.'_textcn'] = ''; continue; } if(isempt($frs['data']))continue; if(isempt($val) || !is_numeric($val))continue; if(!array_key_exists('store', $frs)){ if($this->inputobj == null){ $this->inputobj = c('input'); $this->inputobj->flow = $this; } $store = $this->inputobj->getdatastore($frs['fieldstype'], $kzq, $frs['data'], $fid); $this->tfieldarr[$k1]['store'] = $store; }else{ $store = $frs['store']; } if($store)foreach($store as $x=>$rv){ if($rv['value']==$val){ $rs[''.$fid.'_yuan'] = $val; if($lx==2 && $ly==0){ $rs[''.$fid.'_textcn'] = $rv['name']; if(isset($rv['color']))$rs[''.$fid.'_color'] = $rv['color']; }else{ $rs[$fid] = $rv['name']; if(isset($rv['color']))$rs[$fid] = ''.$rs[$fid].''; } break; } } } return $rs; } public function viewjinfields($rows) { if(!$rows)return $rows; return $rows; } public function daochusubtable($rows) { return $rows; } } \ No newline at end of file +
'; unset($fields['base_name']); unset($fields['base_deptname']); } $contvimr .= '
'; foreach($fields as $f=>$n){ $vs = arrvalue($data, $f); if(!isempt($vs)){ if(substr($f,0,7)=='subdata'){ $contvimr .= ''; }else{ $contvimr .= ''; } } } $contvimr .= '
'.$n.'
'.$vs.'
'.str_replace(' ','
',$n).'
'.$vs.'
'; } if(isempt($contview))$contview = $contvimr; $contview = str_replace('$contview$',$contvimr, $contview); } unset($farrobj); $arr['contview'] = $contview; $arr['readarr'] = m('log')->getreadarr($this->mtable, $this->id); $arr['isedit'] = $this->iseditqx(); $arr['isdel'] = $this->isdeleteqx(); $arr['isflow'] = $this->isflow; $arr['modename'] = $this->modename; $arr['ischehui'] = $this->ischehui(); $arr['statustext'] = $ztass[4]; $arr['statuscolor'] = $ztass[1]; $arr['optmenu'] = $this->getoptmenu(1); $arr['isgbjl'] = (int)$this->rock->arrvalue($this->moders,'isgbjl','0'); $arr['isgbcy'] = (int)$this->rock->arrvalue($this->moders,'isgbcy','0'); $receiptrs = false; $receiptrow = m('receipt')->getall("`modenum`='$this->modenum' and `mid`='$this->id' and `status`=1"); foreach($receiptrow as $k=>$hrs){ $uid1 = ','.$this->adminid.','; if(!contain(','.$hrs['receid'].',', $uid1))continue; if(!contain(','.$hrs['receids'].',', $uid1)){ $receiptrs = array( 'id' => $hrs['id'], 'optname' => $hrs['optname'], ); break; } } $arr['flowinfor'] = array(); $arr['readunarr'] = array(); $arr['receiptrs'] = $receiptrs; if($this->isflow>0){ $arr['flowinfor']= $this->getflowinfor(); if($arr['flowinfor']['ischeck']==1){ $arr['isplview']='0'; } } if(isset($data['title']))$arr['title'] = $data['title']; $_oarr = $this->flowdatalog($arr); if(is_array($_oarr))foreach($_oarr as $k=>$v)$arr[$k]=$v; $conta = $this->rock->matcharr($contview,2); $edbof = false; foreach($conta as $fids){ $thnr = ''; $contview = str_replace('`'.$fids.'`', $thnr, $contview); } $arr['contview'] = $contview; return $arr; } private function getsubdata($xu, $rows, $lx=0) { $iscz = 0; $iszb = $xu+1; $fields = 'subdata'.$xu.''; $subrows = $this->db->getrows('[Q]flow_element','`mid`='.$this->modeid.' and `iszb`='.$iszb.' and `iszs`=1','`fields`,`name`,`isalign`','`sort`'); $cont = ''; if($this->db->count > 0){ $iscz = 1; $headstr = '@xuhaos,,center'; $colorbb = getconfig('bcolorxiang', '#cccccc'); foreach($subrows as $k=>$rs){ $headstr.='@'.$rs['fields'].','.$rs['name'].''; if($rs['isalign']=='1')$headstr.=',left'; if($rs['isalign']=='2')$headstr.=',right'; } foreach($rows as $k=>$rs)$rows[$k]['xuhaos'] = $k+1; $slex = ($lx==0) ? 'noborder':''; if($this->subsubdatastyle!='')$slex = $this->subsubdatastyle; $cont = c('html')->createrows($rows, substr($headstr,1), $colorbb, $slex); } return $cont; } public function ischehui() { $is = 0; if($this->rs['status']==1 || $this->isflow==3)return $is; $where = "".$this->mwhere." and `valid`=1 order by `id` desc"; $rs = $this->flogmodel->getone($where); $sj = (int)getconfig('flowchehuitime','2'); $time = time()-$sj*3600; if($rs && $rs['status']=='1' && $rs['checkid']==$this->adminid && strtotime($rs['optdt'])>$time && ($rs['courseid']>0 || $rs['iszb']=='1' )) $is = $rs['id']; return $is; } public function chehui($sm='') { return $this->bd6('5peg5L!h5ZG8562!5o6I5peg5q2k5Yqf6IO9'); } public function bd6($str) { return $this->rock->jm->base64dencode($str); } public function getdataedit() { $fobj = m('file'); $arr['data'] = $this->flowrsreplaceedit($this->rssust); $arr['table'] = $this->mtable; $arr['tables'] = $this->moders['tables']; $arr['modeid'] = $this->modeid; $arr['isedit'] = $this->iseditqx(); $arr['isflow'] = $this->isflow; $arr['user'] = $this->urs; $arr['status'] = $this->rs['status']; $filers = $fobj->getfile($this->mtable,$this->id); foreach($filers as $fk=>$frs1)$filers[$fk]['thumbpath']=$fobj->getthumbpath($frs1); $arr['filers'] = $filers; $arr['subdata'] = $this->getsuballdata(); $filearr = array(); $fileids = ''; foreach($this->fieldsarr as $k=>$rs){ $fid = $rs['fields']; $flx = $rs['fieldstype']; if($flx=='uploadfile'){ $fval = arrvalue($this->rssust, $fid); if(!isempt($fval))$fileids.=','.$fval.''; } if($flx=='uploadimg'){ $arr['data'][''.$fid.'_view'] = $this->rock->gethttppath($arr['data'][$fid]); } } if($fileids!=''){ $frows = $fobj->getall('`id` in('.substr($fileids, 1).')','filename,id,filesizecn,fileext,optname,thumbpath,thumbplat'); foreach($frows as $k1=>$rs1){ $rs1['thumbpath'] = $fobj->getthumbpath($rs1); $filearr['f'.$rs1['id'].''] = $rs1; } } $arr['filearr'] = $filearr; $ztarr = $this->getnowstatus(); $arr['statustext'] = $ztarr[0]; $arr['statuscolor'] = $ztarr[1]; return $arr; } public function getflowinfor() { $ischeck = 0; $ischange= 0; $str = ''; $arr = $this->getflow(); if($arr['nowcheckid'] != $this->billrs['nowcheckid'])$this->getflowsave($arr, true); $nstatus = $this->rs['status']; $isturn = $this->rs['isturn']; $nowcheckid = ','.$arr['nowcheckid'].','; if($isturn==1 && $nstatus !=1 && contain($nowcheckid, ','.$this->adminid.',') && !in_array($nstatus, array(2,5))){ $ischeck = 1; } $logarr = $this->getlog(); $nowcur = $this->nowcourse; if(arrvalue($this->nextcourse,'checktype')=='change'){ $ischange = 1; } $sarr['ischeck'] = $ischeck; $sarr['ischange'] = $ischange; $sarr['nowcourse'] = $nowcur; $sarr['iszhuanban'] = 0; $sarr['ischao'] = 0; $sarr['nextcourse'] = $this->nextcourse; $sarr['nstatustext'] = $arr['nstatustext']; if($isturn==0)$sarr['nstatustext'] = '寰呮彁浜'; $_checkfields = arrvalue($nowcur,'checkfields'); $checkfields = array(); if($ischeck == 1 && !isempt($_checkfields)){ $_checkfieldsa = explode('|', $_checkfields); $_checkfields = join(',',$_checkfieldsa); $_checkxuant = arrvalue($_checkfieldsa, 1); $inputobj = c('input'); $inputobj->flow = $this; $inputobj->mid = $this->id; $inputobj->urs = $this->urs; $elwswhere = "`mid`='$this->modeid' and `iszb`=0 and instr(',$_checkfields,', concat(',',`fields`,','))>0"; $infeidss = $inputobj->initFields($elwswhere); foreach($infeidss as $_fs=>$fsva){ $_sfes = $fsva['fields']; $_type = $fsva['fieldstype']; $showinpus = 1; $isbt = 1; if($_checkxuant && contain(','.$_checkxuant.',',','.$_sfes.','))$isbt=0; if($_type=='hidden' || $_type=='fixed')$showinpus=2; $_val = arrvalue($this->rssust, $_sfes); $cheo = (substr($_type,0,6)=='change' && !isempt($fsva['data'])); if($cheo)$_val.='|'.arrvalue($this->rssust, $fsva['data']).''; $checkfields[$_sfes] = array( 'inputstr' => $inputobj->getfieldcontval($_sfes, $_val), 'name' => $fsva['name'], 'isbt' => $isbt, 'fieldstype'=> $_type, 'fieldsarr' => $fsva, 'showinpus' => $showinpus ); if($cheo){ $_sfes = $fsva['data']; $checkfields[$_sfes] = array( 'inputstr' => '', 'isbt' => $isbt, 'name' => $fsva['name'].'id', 'fieldstype'=> $_type, 'fieldsarr' => false, 'showinpus' => 2 ); } } } $sarr['checkfields'] = $checkfields; if($nstatus==2)$sarr['nstatustext'] ='寰呮彁浜や汉澶勭悊('.$this->urs['name'].')'; $loglen = count($logarr); foreach($logarr as $k=>$rs){ if($rs['courseid']>0){ $sty = ''; $col = $rs['color']; if($str!='')$str.=' 鈫 '; $str.=''.$rs['actname'].'('.$rs['name'].''.$rs['statusname'].')'; } } if($nstatus=='2'){ if($str!='')$str.=' 鈫 '; $str.= $sarr['nstatustext']; }else if($nstatus=='5'){ if($str!='')$str.=' 鈫 '; $sarr['nstatustext'] = '宸蹭綔搴'; $str.= '宸蹭綔搴'; }else{ foreach($this->flowarr as $k=>$rs){ if($rs['ischeck']==0){ $sty = 'color:#888888'; if($rs['isnow']==1)$sty='font-weight:bold;color:#800000'; if($str!='')$str.=' '; $str.=''.$rs['name'].''; if(!isempt($rs['nowcheckname']))$str.='('.$rs['nowcheckname'].')'; $str.=''; } } } $sarr['flowcoursestr'] = $str; if($nstatus==1)$sarr['nstatustext'] = $this->getnowstatus(1); $actstr = ',鍚屾剰|green,涓嶅悓鎰弢red'; if(isset($nowcur['courseact']) ){ $actstrt = $nowcur['courseact']; if(!isempt($actstrt))$actstr = ','.$actstrt; } $act = c('array')->strtoarray($actstr); foreach($act as $k=>$as1)if($k>0 && $as1[0]==$as1[1])$act[$k][1]=''; if(arrvalue($this->moders,'isys')=='1' && (int)arrvalue($nowcur,'mid','0')>=0){ $act[25]= array('鍓嶅姞绛','',''); $act[26]= array('鍚庡姞绛','',''); } $sarr['courseact'] = $act; $nowstatus = $this->rs['status']; if($this->isflow>0 && $this->rs['isturn']==0)$nowstatus=3; $sarr['nowstatus'] = $nowstatus; $step = $this->rock->arrvalue($nowcur, 'step','0'); $tuicourse = $this->flogmodel->getall($this->mwhere.' and `courseid`>0 and `valid`=1 and `status`=1 and `step`<'.$step.'','`id`,`checkname`,`name`','`step` desc'); $sarr['tuicourse'] = $tuicourse; return $sarr; } public function updatestatus($zt) { $this->update('`status`='.$zt.'', $this->id); $this->billmodel->update('`status`='.$zt.'', $this->mwhere); } public function getstatusarr() { return $this->getstatus(null, '','',2); } public function getstatus($rs, $statusstr='',$other='', $glx=0) { $statustext = $statuscolor = ''; if($statusstr=='')$statusstr=$this->rock->arrvalue($this->moders,'statusstr'); $statusara = array(); $colorsa = array('blue','green','red','#ff6600','#526D08','#888888','','','','','','','','','','','','',''); if(isempt($statusstr)){ $statussst = '涓嶅悓鎰'; $statusstr = '寰?澶勭悊|blue,宸插鏍竱green,'.$statussst.'|red'; } $nowcheckname= arrvalue($rs,'nowcheckname', arrvalue($this->billrs,'nowcheckname')); if(isempt($other))$other = $nowcheckname; $statusar = c('array')->strtoarray($statusstr); foreach($statusar as $k=>$v){ if($v[0]==$v[1])$v[1]= arrvalue($colorsa, $k); $statusara[$k] = $v; } $statusara[5] = array('宸蹭綔搴','#888888'); $statusara[23] = array('閫鍥','#17B2B7'); if($glx==2)return $statusara; $isturn = -1; if(isset($rs['isturn']))$isturn = (int)$rs['isturn']; $zt = $this->rock->arrvalue($rs, 'status'); if($isturn==0){ $statustext = '寰呮彁浜'; $statuscolor= '#ff6600'; }elseif(!isempt($zt)){ if(isset($statusara[$zt])){ $statustext = $statusara[$zt][0]; $statuscolor = $statusara[$zt][1]; } } if(contain($statustext,'?')){ $statusstr = str_replace('?', ''.$other.'', $statustext); }else{ $statusstr = ''.$statustext.''; } if($glx==1){ return $statusstr; } return array(str_replace('?', $other, $statustext), $statuscolor, $zt, $statusstr, str_replace('?', '', $statustext)); } public function getstatusstr($rs) { return $this->getstatus($rs, '','', 1); } public function getnowstatus($glx=0) { return $this->getstatus($this->rs, '','', $glx); } private $getlogrows = array(); public function getlog($lx=0) { if(isset($this->getlogrows[$lx]))return $this->getlogrows[$lx]; $rows = $this->flogmodel->getrows($this->mwhere, '`checkname` as `name`,`checkid`,`name` as actname,`optdt`,`status`,`explain`,`statusname`,`valid`,`courseid`,`color`,`id`,`qmimg`','`id` asc'); $uids = $idss = ''; $dts = c('date'); $fo = m('file'); $editarrs = array(); foreach($rows as $k=>$rs){ $uids.=','.$rs['checkid'].''; $idss.=','.$rs['id'].''; $col = $rs['color']; if(isempt($col))$col='green'; if(contain($rs['statusname'],'涓') || $rs['status']=='2')$col='red'; $rows[$k]['color'] = $col; $rows[$k]['checkdt'] = $rs['optdt']; $rows[$k]['sm'] = str_replace("\n",'
', (string)$rs['explain']); $rows[$k]['explain'] = $rows[$k]['sm']; if(!isempt($rs['qmimg'])){ if(!contain($rs['qmimg'],'.')){ $qmimg = ''.UPDIR.'/'.date('Y-m').'/qmimg'.$rs['id'].'.png'; $bo = true; if(!file_exists($qmimg)){ $bar= explode(',', $rs['qmimg']); $bo = $this->rock->createtxt($qmimg, base64_decode($bar[1])); } if(!$bo){ $qmimg = $rs['qmimg']; }else{ $qmimg = ''.URL.''.$qmimg.''; } }else{ $qmimg = $rs['qmimg']; if(!file_exists($qmimg)){ $qmimg = ''; }else{ $qmimg = ''.URL.''.$qmimg.''; } } $rows[$k]['qmimg'] = $qmimg; if(!isempt($qmimg))$rows[$k]['explain']= ''.$rs['explain'].''; } } if($idss!=''){ $farr = $fo->getfile($this->flowlogtable, substr($idss, 1)); if($farr)foreach($rows as $k=>$rs){ $fstr = $fo->getallstr($farr, $rs['id'],2); $rows[$k]['explain']= $this->strappend($rs['explain'], $fstr, '
'); } } if($uids!=''){ $rows = m('admin')->getadmininfor($rows, substr($uids, 1), 'checkid'); } $this->getlogrows[$lx] = $rows; return $rows; } public function addlog($arr=array()) { $addarr = array( 'table' => $this->mtable, 'mid' => $this->id, 'checkname' => $this->adminname, 'checkid' => $this->adminid, 'optdt' => $this->rock->now, 'courseid' => '0', 'status' => '1', 'ip' => $this->rock->ip, 'web' => $this->rock->web, 'modeid' => $this->modeid ); foreach($arr as $k=>$v)$addarr[$k]=$v; if(isset($addarr['explain']))$addarr['explain']= htmlspecialchars($addarr['explain']); $this->flogmodel->insert($addarr); $ssid = $this->db->insert_id(); $fileid = $this->rock->post('fileid'); if($fileid!='')m('file')->addfile($fileid, $this->flowlogtable, $ssid, $this->modenum.'|'.$this->id); $logfileid = $this->rock->post('logfileid'); if($logfileid!='')m('file')->addfile($logfileid, $this->flowlogtable, $ssid, $this->modenum.'|'.$this->id); $addarr['id'] = $ssid; $this->flowaddlog($addarr); $this->getlogrows = array(); return $ssid; } public function submit($na='', $sm='') { if($na=='')$na='鎻愪氦'; $isturn = 1; if($na=='淇濆瓨')$isturn = 0; $this->addlog(array( 'name' => $na, 'explain' => $sm )); if($this->isflow>0){ $marr['isturn'] = $isturn; $marr['status'] = 0; $this->rs['status'] = 0; $this->update($marr, $this->id); if(arrvalue($this->moders,'isflowlx')=='1' || $this->isflow>=3){ $this->checksmodel->delete($this->mwhere); $this->flogmodel->update('`valid`=0', ''.$this->mwhere.' and `courseid`>0 and `valid`=1'); } $farr = $this->getflow(); if($farr['nowcourseid']>0){ $sysnextoptid = $this->rock->post('sysnextoptid'); $sysnextopt = $this->rock->post('sysnextopt'); $sysnextcustidid = (int)$this->rock->post('sysnextcustidid'); if($sysnextcustidid == $farr['nowcourseid'] && !isempt($sysnextoptid) && !isempt($sysnextopt)){ $this->addcheckname($sysnextcustidid, $sysnextoptid, $sysnextopt, true, 1); $farr = $this->getflow(); } } $farr['status'] = 0; $this->savebill($farr); if($isturn == 1){ $this->nexttodo($farr['nowcheckid'],'submit'); } } $this->flowsubmit($na, $sm); $this->savecsname( $this->rock->post('syschaosongid'), $this->rock->post('syschaosong'), $this->adminid,0,$isturn,$na); if($na=='缂栬緫'){ $this->gettodosend('boedit'); }else{ $this->gettodosend('boturn'); } } private function savecsname($csnameid,$csname,$uid,$type,$isturn, $na) { if(!isempt($csnameid)){ $where = $this->mwhere.' and `type`='.$type.''; if($type>0)$where.=' and `uid`='.$uid.''; $csid = (int)$this->chaomodel->getmou('id', $where); if($csid==0)$where = ''; $this->chaomodel->record(array( 'modeid' => $this->modeid, 'table' => $this->mtable, 'mid' => $this->id, 'uid' => $uid, 'type' => $type, 'csname' => $csname, 'csnameid' => $csnameid, ),$where); if($isturn==1)$this->nexttodo($csnameid,'chao', $na); } } public function getcsname($id=0) { if($id>0){ $where= "`table`='$this->mtable' and `mid`='$id' and `type`=0"; }else{ $where= "`modeid`={$this->modeid} and `uid`={$this->adminid} and `type`=0"; $iscs = (int)$this->moders['iscs']; } $ors = $this->chaomodel->getone($where,'*','`id` desc'); $csname = $csnameid = ''; if($ors){ $csname = $ors['csname']; $csnameid = $ors['csnameid']; } return array( 'csname' => $csname, 'csnameid' => $csnameid, 'id' => $id, ); } public function zhuijiaexplain($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '杩藉姞璇存槑', 'status' => 1, )); $zt = $this->rs['status']; if($zt==2 && $this->isflow>0 && $this->adminid==$this->uid){ $marr['status'] = 0; $this->rs['status'] = 0; $this->update($marr, $this->id); $farr = $this->getflow(); $farr['status'] = 0; $this->savebill($farr); $this->nexttodo($farr['nowcheckid'],'zhui', $sm); } $this->gettodosend('bozhui','', $sm); } public function chuiban($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '鍌姙', 'status' => 1, )); $farr = $this->getflow(true); $this->nexttodo($farr['nowcheckid'],'cuiban', $sm); $this->gettodosend('cuiban','', $sm); } public function getyushen($rows) { return $rows; } private function getyushenss($id, $rows, $xu, $isq) { if($xu==0)$this->_tempauoe = array(); if(isset($rows[$id])){ $_tars = $rows[$id]; if($isq==1)$this->getyushenss($_tars['id'], $rows, $xu+1, $isq); $this->_tempauoe[] = $_tars; if($isq==0)$this->getyushenss($_tars['id'], $rows, $xu+1, $isq); } return $this->_tempauoe; } public function getflowpipei($uid=0) { $urs = $this->urs; if(!$urs)$urs = $uid; if(!is_array($urs))$urs = $this->db->getone('[Q]admin', "`id`='$urs'", '`deptid`,`deptpath`,`id`'); $coursedb = m('flowcourse'); $barr = $coursedb->pipeiCourse($this->modeid); $rows = $barr['rows']; $this->pipeiCoursearrc = $barr['rowd']; $this->pipeiCoursearrs = array(); $this->pipeiCoursearr = array(); $kqobj = m('kaoqin'); $this->getflowpipeis($rows, $urs, $kqobj); unset($this->pipeiCoursearrs); unset($this->pipeiCoursearrc); return $this->getyushen($this->pipeiCoursearr); } private function getflowpipeis($rows,$urs, $kqobj) { $shiyong = array(); $defix = $xuhao = 0; $uid = arrvalue($urs,'id',0); $zshu = count($rows); foreach($rows as $k=>$rs){ $whereid = (int)$rs['whereid']; $receid = $rs['receid']; $wherestr= arrvalue($rs, 'where'); if($rs['status']=='0')continue; if(!isempt($wherestr)){ $wherestr = m('base')->strreplace($this->rock->jm->base64decode($wherestr), $uid); $to = $this->rows("`id`='$this->id' and $wherestr "); if($to==0)continue; } if($whereid > 0){ $bo = $this->wheremanzhu($whereid); if(!$bo)continue; } if(!isempt($rs['num'])){ $bo = $this->flowcoursejudge($rs['num'], $rs); if(is_bool($bo) && !$bo)continue; } $xuhao++; if($defix==0 && (isempt($receid) || contain($receid,'all'))){ $defix = $xuhao; } if(isempt($receid) && (!isempt($wherestr) || $whereid > 0)){ $defix = $xuhao; } $rs['xuhao'] = $xuhao; $shiyong[] = $rs; } $pboss = false; if($shiyong){ $gxuha = $kqobj->getpipeimid($urs, $shiyong, 'xuhao', $defix); if($gxuha>0){ $pboss = true; $gxuha = $gxuha-1; $prs = $shiyong[$gxuha]; $this->getflowpipeisss($prs, $urs, $kqobj); } } if(!$pboss && $zshu==1 && $rows[0]['childshu']>0){ $this->getflowpipeis($rows[0]['children'], $urs, $kqobj); } } private function getflowpipeisss($prsnrs, $urs, $kqobj) { $prs = $prsnrs; unset($prs['children']); $this->pipeiCoursearrs[]= $prs['id']; $this->pipeiCoursearr[] = $prs; if($prs['childshu']>0){ $this->getflowpipeis($prsnrs['children'], $urs, $kqobj); }else{ $nid = arrvalue($prs,'nid','0'); if($nid>0 && !in_array($nid, $this->pipeiCoursearrs) && isset($this->pipeiCoursearrc, $nid)){ $this->getflowpipeis(array($this->pipeiCoursearrc[$nid]), $urs, $kqobj); } } } public function getflow($sbo=false) { $this->flowarr = array(); $allcheckid = $nowcheckid = $nowcheckname = $nstatustext = ''; $allcheckids = array(); $nowcourseid = 0; $nstatus = $this->rs['status']; $this->nowcourse = array(); $this->nextcourse = array(); $this->flowisend = 0; $curs = $this->flogmodel->getrows($this->mwhere,'checkid,checkname,courseid,`valid`,`status`,`statusname`,`name`,`iszb`','id desc'); $cufss = $ztnas = $chesarr = array(); foreach($curs as $k=>$rs){ if($rs['iszb']=='1' && !in_array($rs['checkid'], $allcheckids))$allcheckids[] = $rs['checkid']; if($rs['courseid']=='0')continue; $_su = ''.$rs['courseid'].''; $_su1 = ''.$rs['courseid'].'_'.$rs['checkid'].''; if($rs['valid']==1 && in_array($rs['status'], $this->flowstatusarr)){ if(!isset($cufss[$_su]))$cufss[$_su]=0; $cufss[$_su]++; $chesarr[$_su1] = 1; } if(!in_array($rs['checkid'], $allcheckids))$allcheckids[] = $rs['checkid']; if($nstatustext=='' && $rs['courseid']>0){ $nstatustext = ''.$rs['checkname'].'澶勭悊'.$rs['statusname'].''; $nstatus = $rs['status']; } $ztnas[$rs['courseid']] = ''.$rs['checkname'].''.$rs['statusname'].''; } $nowstep = $zongsetp = -1; $isend = 0; $czt = $this->rs['status']; $coutye = 0; $rows = ($czt==1 || $czt==5)? array() : $this->getflowpipei($this->uid); if($rows){ $checksa = $this->checksmodel->getrows($this->mwhere.' and `addlx`=3'); $coursea = $nrows = array(); foreach($checksa as $k=>$rs)$coursea[$rs['courseid']]='1'; $nrows = array(); $allcheckid = ''; $isoptsuperbo = false; foreach($rows as $k=>$rs){ $uarr = $this->getcheckname($rs); $rows[$k]['checkid'] = $uarr[0]; $rows[$k]['checkname'] = $uarr[1]; $allcheckid .= ','.$uarr[0].''; if($rs['checktype']=='optsuper' && isempt($uarr[0]))$isoptsuperbo=true; } if($isoptsuperbo)foreach($rows as $k=>$rs){ if($rs['checktype']=='optsuper'){ $_k1 = $k-1; $_uid = $this->optid; if($_k1>=0){ $ours = $this->flogmodel->getone($this->mwhere.' and `courseid`='.$rows[$_k1]['id'].' and `valid`=1 ','`checkid`','`id` desc'); if(!$ours){ $_uid = (int)$rows[$_k1]['checkid']; }else{ $_uid = $ours['checkid']; } } $uarr = $this->adminmodel->getsuperman($_uid); if($uarr){ $rows[$k]['checkid'] = $uarr[0]; $rows[$k]['checkname'] = $uarr[1]; } } } foreach($rows as $k=>$rs){ $nrows[] = $rs; if($rs['checktype']=='superall'){ $ids1 = $rs['id']; $suparr = $this->adminmodel->getsuperarr($this->uid); if($suparr){ $logdsar = $this->getlog(); foreach($logdsar as $k1=>$rs1){ if($rs1['courseid']>0 && $rs1['status']=='1' && $rs1['valid']=='1')$allcheckid .= ','.$rs1['checkid'].''; } foreach($suparr as $k1=>$surs){ if(!contain(','.$allcheckid.',', ','.$surs['id'].',')){ $rs['oldid'] = $ids1; $rs['id'] = $ids1 * 99999 + $surs['id']; $rs['checkid'] = $surs['id']; $rs['checkname'] = $surs['name']; $rs['iszf'] = 0; $nrows[] = $rs; $allcheckid .= ','.$surs['id'].''; } } } } } $yisheh = ''; if($this->isflow==2){ $logdsar = $this->getlog(); foreach($logdsar as $k1=>$rs1) if($rs1['courseid']>0 && $rs1['status']==1 && $rs1['valid']==1)$yisheh .= ','.$rs1['checkid'].''; } $jwcllx = arrvalue($this->moders, 'jwcllx','0'); foreach($nrows as $k=>$rs){ $whereid = (int)$rs['whereid']; $checkshu = $rs['checkshu']; $checkid = $rs['checkid']; $checkname = $rs['checkname']; $checktype = $rs['checktype']; if($this->isflow==2 && !isempt($checkid) && isempt($rs['checkfields'])){ if(($checkid==$this->uid || $checkid==$this->optid) )continue; $k2 = $k+1; $ntype = 'yes'; if(isset($nrows[$k2])){ if($nrows[$k2]['checktype']=='change')$ntype='no'; } if($ntype=='yes' && contain(','.$yisheh.',',','.$checkid.','))continue; } if(!isempt($checkid))$yisheh .= ','.$checkid.''; $zongsetp++; $ischeck = 0; $checkids = $checknames = ''; $_su = ''.$rs['id'].''; $nowshu = 0; if(isset($cufss[$_su]))$nowshu = $cufss[$_su]; if(!$this->isempt($checkid)){ $checkida = explode(',', $checkid); $checkidna = explode(',', $checkname); $_chid = $_chna = ''; foreach($checkida as $k1=>$chkid){ $_su1 = ''.$rs['id'].'_'.$chkid.''; if($jwcllx == 0 && !in_array($chkid, $allcheckids))$allcheckids[] = $chkid; if(!isset($chesarr[$_su1])){ $_chid.=','.$chkid.''; $_chna.=','.arrvalue($checkidna, $k1).''; } } if($_chid!='')$_chid = substr($_chid, 1); if($_chna!='')$_chna = substr($_chna, 1); if($_chid==''){ $ischeck = 1; }else{ if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1; } $checkids = $_chid; $checknames = $_chna; }else{ if($checkshu>0&&$nowshu>=$checkshu)$ischeck = 1; if($checkshu == 0 && $nowshu>0)$ischeck = 1; } if($ischeck==0 && $coutye==0){ if((int)arrvalue($rs,'coursetype','0')>0)$coutye = 1; } $rs['ischeck'] = $ischeck; $rs['islast'] = 0; $rs['checkid'] = $checkid; $rs['checkname'] = $checkname; $rs['nowcheckid'] = $checkids; $rs['nowcheckname'] = $checknames; $rs['isnow'] = 0; $rs['nowstep'] = $zongsetp; $rs['step'] = $k+1; if($ischeck==0 && $nowstep==-1){ $rs['isnow']= 1; $nowstep = $zongsetp; $this->nowcourse = $rs; $nowcourseid = $rs['id']; $nowcheckid = $checkids; $nowcheckname = $checknames; } if($nowstep>-1 && $zongsetp==$nowstep+1)$this->nextcourse = $rs; $this->flowarr[]= $rs; } } if($zongsetp>-1)$this->flowarr[$zongsetp]['islast']=1; if($nowstep == -1){ $isend = 1; }else{ $nstatustext = '寰'.$nowcheckname.'澶勭悊'; } $this->flowisend = $isend; $allcheckid = join(',', $allcheckids); $arrbill['allcheckid'] = $allcheckid; $arrbill['nowcourseid'] = $nowcourseid; $arrbill['nowcheckid'] = $nowcheckid; $arrbill['nowcheckname'] = $nowcheckname; $arrbill['nstatustext'] = $nstatustext; $arrbill['nstatus'] = $nstatus; $arrbill['status'] = $this->rs['status']; $arrbill['isturn'] = $this->rs['isturn']; if($sbo)$this->getflowsave($arrbill); return $arrbill; } public function wheremanzhu($id) { $uid = $this->uid; $ser = $this->wheremodel->getflowwhere($id, $uid); if(!$ser)return true; $str = $ser['ntr']; if(!isempt($str)){ $to = $this->db->rows('[Q]admin',"`id`='$uid' and ($str)"); if($to>0)return false; } $str = $ser['str']; if(!isempt($str)){ $str= str_replace('{asqom}','', $str); $to = $this->rows("`id`='$this->id' and $str"); if($to==0)return false; } $str = $ser['utr']; if(!isempt($str)){ $to = $this->db->rows('[Q]admin',"`id`='$uid' and $str"); if($to==0)return false; } return true; } public function getflowsave($sarr, $suvu=false) { if(!$sarr)return; if($suvu)$sarr['updt'] = $this->rock->now; $this->billmodel->update($sarr, $this->mwhere); } private function getcheckname($crs) { $type = $crs['checktype']; $cuid = $name = ''; $courseid= $crs['id']; $cheorws = $this->checksmodel->getall($this->mwhere.' and `courseid`='.$courseid.'','checkid,checkname'); if($cheorws){ foreach($cheorws as $k=>$rs){ $lxss = $rs['checkid']; if(isempt($lxss) || $lxss=='0')continue; $cuid.=','.$lxss.''; $name.=','.$rs['checkname'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); return array($cuid, $name); } } if(!$this->isempt($crs['num'])){ $uarr = $this->flowcheckname($crs['num']); if(is_array($uarr)){ if(!$this->isempt($uarr[0]))return $uarr; } } if($type=='super' || $type=='superall'){ $cuid = $this->urs['superid']; $name = $this->urs['superman']; } if($type=='dept' || $type=='super' || $type=='superall'){ if($this->isempt($cuid) && $this->drs){ $cuid = $this->drs['headid']; $name = $this->drs['headman']; } } if($type=='apply'){ $cuid = $this->urs['id']; $name = $this->urs['name']; } if($type=='opt'){ $cuid = $this->rs['optid']; $name = $this->rs['optname']; if(isempt($cuid)){ $cuid = $this->urs['id']; $name = $this->urs['name']; } } if($type=='user'){ $cuid = $crs['checktypeid']; $name = $crs['checktypename']; } if($type=='rank'){ $rank = $crs['checktypename']; if(!$this->isempt($rank)){ $wheer1 = $this->adminmodel->getcompanywhere(5,'',$this->companyid); $rnurs = $this->db->getrows('[Q]admin',"`status`=1 and `ranking`='$rank' ".$wheer1."",'id,name','sort'); foreach($rnurs as $k=>$rns){ $cuid.=','.$rns['id'].''; $name.=','.$rns['name'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); } } } if($type=='cname'){ $cnbar = $this->cnamemodel->getcheckname($crs['checktypeid'], $this->uid); $cuid = arrvalue($cnbar, 0); $name = arrvalue($cnbar, 1); } if($type=='field'){ $fids = $crs['checktypeid']; if(!isempt($fids)){ $vals = ''; $farrs= explode(',', $fids); foreach($farrs as $fid){ $vid = arrvalue($this->rs, $fid); if(!isempt($vid))$vals.=','.$vid.''; } if($vals!=''){ $vals = substr($vals, 1); $uarr = $this->adminmodel->getrows('`status`=1 and `id` in('.$vals.')','id,name','FIELD(`id`,'.$vals.')'); foreach($uarr as $k=>$rs){ $cuid.=','.$rs['id'].''; $name.=','.$rs['name'].''; } if($cuid != ''){ $cuid = substr($cuid, 1); $name = substr($name, 1); } } } } $cuid = $this->rock->repempt($cuid); $name = $this->rock->repempt($name); return array($cuid, $name); } public function createbianhao($num, $fid, $wshu=3) { if(isempt($num))$num=''.$this->modenum.'-'; @$appdt = $this->rs['applydt']; if(isempt($appdt))$appdt = $this->rock->date; $apdt = str_replace('-','', substr($appdt,0,10)); $num = str_replace('Ymd',$apdt,$num); return $this->db->sericnum($num,'[Q]'.$this->mtable.'', $fid, $wshu); } public function createinputnum($num, $fid) { $acta = ''; if(method_exists($this, $num)){ $acta = $num; }else{ if(contain($num, ',')){ $arra = explode(',', $num); $acta = $arra[0]; $num = $arra[1]; } } if($acta && method_exists($this, $acta)){ $barr = $this->$acta($num); if(is_array($barr)){ $qom = arrvalue($barr, 'qom', $num); $wshu= arrvalue($barr, 'wshu', 3); $bom = arrvalue($barr, 'bom'); $fields = arrvalue($barr, 'fields', $fid); return $this->createbianhao($qom, $fields, $wshu).$bom; }else{ if(isempt($barr))$barr = $num; return $this->createbianhao($barr, $fid); } }else{ return $this->createbianhao($num, $fid); } } public function createnum() { $num = $this->moders['sericnum']; if($num=='鏃'||$this->isempt($num))$num='TM-Ymd-'; @$appdt = $this->rs['applydt']; if(isempt($appdt))$appdt = $this->rock->date; $apdt = str_replace('-','', $appdt); $num = str_replace('Ymd',$apdt,$num); return $this->db->sericnum($num,'[Q]flow_bill', 'sericnum', 3); } public function savebill($oarr=array()) { $dbs = $this->billmodel; $whes= $this->mwhere; $birs= $dbs->getone($whes); $arr = array( 'table' => $this->mtable, 'mid' => $this->id, 'optdt' => isset($this->rs['optdt']) ? $this->rs['optdt'] : $this->rock->now, 'optname' => arrvalue($this->rs,'optname', $this->adminname), 'optid' => arrvalue($this->rs,'optid', $this->adminid), 'modeid' => $this->modeid, 'updt' => $this->rock->now, 'isturn' => $this->rs['isturn'], 'nstatus' => $this->rs['status'], 'applydt' => $this->rs['applydt'], 'modename' => $this->modename, 'uname' => $this->rs['base_name'], 'udeptname' => $this->rs['base_deptname'], 'uid' => $this->uid, 'isdel' => '0', ); foreach($oarr as $k=>$v)$arr[$k]=$v; if(!$birs){ $arr['status'] = $arr['nstatus']; $arr['createdt']= $arr['optdt']; $arr['sericnum']= $this->createnum(); $arr['udeptid'] = $this->rock->post('sysudeptid', arrvalue($this->urs,'deptid')); $whes = ''; $this->sericnum = $arr['sericnum']; }else{ $udeptid = $birs['udeptid']; if($udeptid==0)$arr['udeptid']= arrvalue($this->urs,'deptid'); } $fstr = $this->rock->post('sysflow5str'); if($fstr)$arr['flow5str'] = $fstr; $dbs->record($arr, $whes); return $arr; } public function getsummary() { return $this->rock->reparr($this->moders['summary'], $this->rs); } public function addcheckname($courseid, $uid, $uname, $onbo=false, $addlx=0) { if(isempt($uid)){$uid = '0';$uname= 'auto';} $uida = explode(',', ''.$uid.''); $uidan = explode(',', $uname); if($onbo)$this->checksmodel->delete($this->mwhere.' and `courseid`='.$courseid.''); if($uida)foreach($uida as $k=>$uid){ $uname = $this->rock->arrvalue($uidan, $k); $zyarr = array( 'table' => $this->mtable, 'mid' => $this->id, 'modeid' => $this->modeid, 'courseid' => $courseid, 'optid' => $this->adminid, 'optname' => $this->adminname, 'addlx' => $addlx, 'optdt' => $this->rock->now, 'status' => 0 ); $this->checksmodel->delete($this->mwhere.' and `checkid`='.$uid.' and `courseid`='.$courseid.''); $zyarr['checkid'] = $uid; $zyarr['checkname'] = $uname; $this->checksmodel->insert($zyarr); } if($addlx==4)$this->checksmodel->delete($this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.''); } public function savedatastr($fval, $farr, $data=array()) { $str = ''; if(!$farr)return $str; $savewhere = $farr['savewhere']; $name = $farr['name']; $types = $farr['fieldstype']; if(isempt($savewhere) || isempt($fval))return $str; $savewhere = str_replace(array('{0}','{date}','{now}'), array($name, $this->rock->date,$this->rock->now), $savewhere); $savewhere = $this->rock->reparr($savewhere, $data); $saees = explode(',', $savewhere); if($types=='date' || $types=='datetime')$fval = strtotime($fval); if($types=='number')$fval = floatval($fval); foreach($saees as $saeess){ $fsaed = explode('|', $saeess); $msg = isset($fsaed[2]) ? $fsaed[2] : ''.$name.'鏁版嵁涓嶇鍙'; $val = isset($fsaed[1]) ? $fsaed[1] : ''; $lfs = $fsaed[0]; if($val != ''){ if($types=='date' || $types=='datetime')$val = strtotime($val); if($types=='number')$val = floatval($val); if($lfs=='gt'){$bo = $fval>$val;if(!$bo)return $msg;} if($lfs=='egt'){$bo = $fval>=$val;if(!$bo)return $msg;} if($lfs=='lt'){$bo = $fval<$val;if(!$bo)return $msg;} if($lfs=='elt'){$bo = $fval<=$val;if(!$bo)return $msg;} if($lfs=='eg'){$bo = $fval==$val;if(!$bo)return $msg;} if($lfs=='neg'){$bo = $fval!=$val;if(!$bo)return $msg;} } } return $str; } public function update($arr, $where) { if(is_array($arr)){ foreach($arr as $k=>$v)$this->rs[$k]=$v; } return parent::update($arr,$where); } public function updatelogvalid($whe) { $this->flogmodel->update('valid=0', $this->mwhere.' '.$whe); } public function strappend($sm, $str, $fh=',') { if(isempt($str))return $sm; if(!isempt($sm))$sm.=$fh; $sm.=$str; return $sm; } public function checkerror($lx=1,$sm='') { if($sm=='')$sm='鍗曟嵁寮傚父绠$悊鍛樺鐞'; $msg = $this->check($lx, $sm, 1); return $msg; } public function check($zt, $sm='', $lx=0) { if($this->rs['status']==1)return '娴佺▼宸插鐞嗗畬鎴,鏃犻渶鎿嶄綔'; $arr = $this->getflow(); $flowinfor = $this->getflowinfor(); if($flowinfor['ischeck']==0 && $lx==0)return '褰撳墠鏄痆'.$arr['nowcheckname'].']澶勭悊'; $nowcourse = $this->nowcourse; if($lx==1){ if($arr['nowcourseid']!=0)return '褰撳墠鏈夊鏍告楠D鏄瓨鍦ㄧ殑涓嶈兘鐩存帴鏍囪瘑宸插畬鎴'; $to = $this->flogmodel->rows($this->mwhere.' and `courseid`>0 and `status`=1'); if($to==0)return '璇ュ崟鎹病鏈変换浣曢氳繃瀹℃牳澶勭悊涓嶈兘鐩存帴鏍囪瘑宸插畬鎴愭垨宸插鏍'; $nowcourse = array('id'=>66666,'name'=>'寮傚父澶勭悊','step'=>0); } $nextcourse = $this->nextcourse; $zynameid = $this->rock->post('zynameid'); $zyname = $this->rock->post('zyname'); $csnameid = ''; $csname = ''; $nextname = $this->rock->post('nextname'); $nextnameid = $this->rock->post('nextnameid'); $qmimgstr = $this->rock->post('qmimgstr'); $tuiid = (int)$this->rock->post('tuiid'); $iszhuanyi = $ischangenext = 0; if($zt==1 && $this->isflow!=3 && isempt($zynameid) && arrvalue($nextcourse,'checktype')=='change'){ $ischangenext = 1; } if($zt!=2)$tuiid = 0; $istongyi = in_array($zt, $this->flowstatusarr); if($zynameid!='' && $istongyi){ if($zynameid==$this->adminid)return '涓嶈兘杞粰鑷繁'; $sm = $this->strappend($sm, '杞粰锛'.$zyname.''); $iszhuanyi = 1; $this->rs['syszb_name'] = $zyname; $this->rs['syszb_nameid'] = $zynameid; } if($nextnameid=='' && $ischangenext==1)return '璇烽夋嫨涓嬩竴姝ュ鐞嗕汉'; $ufied = array(); if($iszhuanyi == 0 && $zt!=2){ foreach($flowinfor['checkfields'] as $chef=>$chefv){ $ufied[$chef] = $_val = $this->rock->post('cfields_'.$chef.''); if(isempt($_val) && $chefv['isbt']=='1')$this->echomsg(''.$chefv['name'].'涓嶈兘涓虹┖'); $_stype = arrvalue($chefv, 'fieldstype'); if($_stype=='graph')$ufied[$chef] = c('input')->createqianming($_val); $_str = $this->savedatastr($_val, $chefv['fieldsarr'], $this->rs); if($_str!='')$this->echomsg($_str); } } $this->checkiszhuanyi = $iszhuanyi; $barr = $this->flowcheckbefore($zt, $ufied, $sm); $msg = ''; if(is_array($barr) && isset($barr['msg']))$msg = $barr['msg']; if(is_array($barr) && isset($barr['update'])){ foreach($barr['update'] as $_k=>$_v)$ufied[$_k] = $_v; } if(is_string($barr))$msg = $barr; if(!isempt($msg))return $msg; if($ufied){ $bo = $this->update($ufied, $this->id); if(!$bo)return 'dberr:'.$this->db->error(); } $courseact = $flowinfor['courseact']; $act = $courseact[$zt]; $statusname = $act[0]; $statuscolor= $act[1]; $nzt = $act[2]; $courseid = $nowcourse['id']; $this->checksmodel->update('`status`='.$zt.'', $this->mwhere.' and `checkid`='.$this->adminid.' and `courseid`='.$courseid.''); if($iszhuanyi == 1){ $this->addcheckname($courseid, $zynameid, $zyname, false, 4); $nowcourse['id'] = 0; } if($ischangenext==1){ $this->addcheckname($nextcourse['id'], $nextnameid, $nextname, true, 1); } $tuirs = array(); if($tuiid > 0)$tuirs = $this->flogmodel->getone($tuiid); if(!$tuirs)$tuiid = 0; if($tuiid>0){ $sm = $this->strappend($sm, '閫鍥炲埌['.$tuirs['name'].'('.$tuirs['checkname'].')]'); $statusname = '閫鍥'; $statuscolor = '#17B2B7'; } $this->checkistui = $tuiid; $logsm = $sm; if($iszhuanyi==0 && $csname)$logsm = $this->strappend($logsm,'鎶勯佺粰锛'.$csname.''); $this->lastlogid = $this->addlog(array( 'courseid' => $nowcourse['id'], 'name' => $nowcourse['name'], 'step' => $nowcourse['step'], 'status' => $zt, 'statusname'=> $statusname, 'color' => $statuscolor, 'explain' => $logsm, 'iszb' => $iszhuanyi, 'qmimg' => $qmimgstr )); if($tuiid > 0){ $this->addcheckname($tuirs['courseid'], $tuirs['checkid'], $tuirs['checkname'], true, 3); $this->updatelogvalid('and `courseid`>0 and `status`=1 and `step`>='.$tuirs['step'].''); } $lzt = $this->rock->repempt($nzt, $zt); $uparr = $nexttodoarr = $nexttodoarc = array(); $bsarr = $this->getflow(); $bsarr['tuiid'] = $tuiid; $nextcheckid = $bsarr['nowcheckid']; if($istongyi){ if($iszhuanyi==0){ $uparr['status']= $this->rock->repempt($nzt,'0'); } $nexttodoarr = array($nextcheckid, 'next', $sm, $statusname); }else{ if($tuiid>0){ $lzt = 23; $nexttodoarr = array($nextcheckid, 'tui', $sm, $statusname); }elseif($zt==2){ $nexttodoarr = array($this->optid, 'nothrough', $sm, $statusname); } $uparr['status'] = $lzt; } $this->flowcheckafter($zt, $sm, $nowcourse); $bsarr['nstatus'] = $lzt; $bsarr['checksm'] = $sm; if(!$this->nowcourse){ $uparr['status'] = $lzt; $nexttodoarc = array($this->optid, 'finish', $sm, ''); } if($uparr){ $this->update($uparr, $this->id); } if(!$this->nowcourse){ $this->flowcheckfinsh($zt); if($istongyi){ $this->checksmodel->delete($this->mwhere); } } $bsarr['status'] = $this->rs['status']; $this->getflowsave($bsarr, true); if($this->db->backsql()){ $bos = ($courseid == arrvalue($this->nowcourse, 'id') && $istongyi); if($nexttodoarr && (!$bos || $iszhuanyi==1))$this->nexttodo($nexttodoarr[0],$nexttodoarr[1],$nexttodoarr[2],$nexttodoarr[3]); if($nexttodoarc)$this->nexttodo($nexttodoarc[0],$nexttodoarc[1],$nexttodoarc[2],$nexttodoarc[3]); } if($iszhuanyi == 1){ $this->gettodosend('bozhuan','', $sm, 0, ''.$this->adminname.'灏哰'.$nowcourse['name'].']杞粰:'.$zyname.''); }else{ if($istongyi)$this->gettodosend('botong', $statusname, $sm, $nowcourse['id']); if($zt==2)$this->gettodosend('bobutong',$statusname, $sm, $nowcourse['id']); if(!$this->nowcourse && $istongyi)$this->gettodosend('bofinish', '', $sm); } if($iszhuanyi==0){ $sm1 = '鍦ㄢ'.$nowcourse['name'].'鈥濆鐞'.$statusname.''; $this->savecsname($csnameid,$csname,$this->adminid,$nowcourse['id'],1, $sm1); } return 'ok'; } public function pushs($receid, $cont, $title='', $params=array()) { return $this->push($receid,'', $cont, $title, 0, $params); } public function getxiangurl($num='', $id=0, $lx='x') { if($num=='')$num = $this->modenum; if($id==0)$id = $this->id; $url = URL; if($lx=='auto')$lx = ($this->ismobile==1)?'x':'p'; if($lx=='x' || $lx=='a')$url = $this->rock->getouturl(); $url = ''.$url.'task.php?a='.$lx.'&num='.$num.'&mid='.$id.''; if(COMPANYNUM)$url.='&dwnum='.COMPANYNUM.''; return $url; } public function getxiangurlx($num='',$id=0){return $this->getxiangurl($num,$id,'x');} public function push($receid, $gname='', $cont='', $title='', $wkal=0, $params=array()) { if(isempt($receid) && $wkal==1)$receid='all'; if(isempt($receid))return false; if(contain(','.$receid.',', ',d1,'))$receid='all'; $modenum = arrvalue($params, 'modenum', $this->modenum); $modename = arrvalue($params, 'modename', $this->modename); $id = (int)arrvalue($params, 'id', $this->id); $moders = arrvalue($params, 'moders'); if(!is_array($moders))$moders = $this->moders; if($gname=='')$gname = $modename; $reim = m('reim'); $url = $this->getxiangurl($modenum, $id, 'p'); $wxurl = $this->getxiangurl($modenum, $id, 'x'); $emurl = $this->getxiangurl($modenum, $id, 'a'); if($id==0){ $url = '';$wxurl = '';$emurl=''; } $url = arrvalue($params, 'url', $url); $wxurl = arrvalue($params, 'wxurl', $wxurl); $emurl = arrvalue($params, 'emurl', $emurl); $slx = 0; $pctx = $moders['pctx']; $mctx = $moders['mctx']; $wxtx = $moders['wxtx']; $ddtx = $moders['ddtx']; $emtx = $moders['emtx']; if($pctx==0 && $mctx==1)$slx=2; if($pctx==1 && $mctx==0)$slx=1; if($pctx==0 && $mctx==0)$slx=3; $this->rs['now_adminname'] = $this->adminname; $this->rs['now_modename'] = $modename; $cont = htmlspecialchars($this->rock->reparr($cont, $this->rs)); $receido= $receid; $receid = $this->adminmodel->gjoins($receid); $uids = m('todo')->addtodo($receid, $modename, $cont, $modenum, $id); if($uids!='' && $moders['type'] != '绯荤粺' && $id > 0)$this->todosmodel->addtotouids($uids, array( 'table' => $moders['table'], 'mid' => $id, 'modename' => $modename, 'modenum' => $modenum, )); $title = $this->rock->reparr($title, $this->rs); $reim->pushagent($uids, $gname, $cont, $title, $url, $wxurl, $slx, ''.$modenum.'|'.$id.''); $this->flowchangetodo($uids, $gname); if(isempt($title))$title = $modename; $this->flowweixinarr=array(); return $receid; } public function nexttodo($nuid, $type, $sm='', $act='') { $cont = ''; $tit = ''; $gname = '娴佺▼寰呭姙'; $summary= $this->getsummary(); if($type=='submit' || $type=='next' || $type == 'cuiban'){ $cont = '浣犳湁['.$this->uname.']鐨刐'.$this->modename.',鍗曞彿:'.$this->sericnum.']闇瑕佸鐞'; if($sm!='')$cont.='锛岃鏄:'.$sm.''; $tit = ''.$this->uname.'鐨'.$this->modename.''; if($type != 'cuiban'){ $txnum = $this->option->getval('sms_txnum'); if(!isempt($txnum)){ $mknum = $this->option->getval('sms_mknum'); if($mknum=='all' || contain(','.$mknum.',',','.$this->modenum.',')){ $wxurl = $this->getxiangurlx(); $barr = c('xinhuapi')->sendsms($nuid, '', $txnum, array( 'modename' => $this->modename, 'sericnum' => $this->sericnum, 'applyname'=> $this->uname, 'deptname' => $this->rs['base_deptname'], ),$wxurl); } } } $type = 'daiban'; } if($type == 'nothrough'){ $cont = '浣犳彁浜'.$this->modename.',鍗曞彿:'.$this->sericnum.']'.$this->adminname.'澶勭悊['.$act.']锛屽師鍥:['.$sm.']'; $gname= '娴佺▼鐢宠'; $tit = ''.$this->modename.'澶勭悊'.$act.''; } if($type == 'finish'){ $cont = '浣犳彁浜ょ殑['.$this->modename.',鍗曞彿:'.$this->sericnum.']宸插叏閮ㄥ鐞嗗畬鎴'; $gname= '娴佺▼鐢宠'; $tit = ''.$this->modename.'鍏ㄩ儴澶勭悊瀹屾垚'; } if($type == 'zhui'){ $cont = ''.$this->adminname.'杩藉姞鍗曟嵁璇存槑['.$this->modename.',鍗曞彿:'.$this->sericnum.']锛岃鏄:['.$sm.']'; } if($type == 'tui'){ $cont = '['.$this->adminname.']閫鍥炲崟鎹甗'.$this->modename.',鍗曞彿:'.$this->sericnum.']鍒颁綘杩欒鍙婃椂澶勭悊锛岃鏄:'.$sm.''; } if($type == 'chao'){ $cont = ''.$this->adminname.''.$sm.'浜嗏'.$this->modename.'鈥'; if(!isempt($summary))$cont.='锛屾憳瑕佲'.$summary.'鈥'; if($this->isflow>0)$cont.='锛屽崟鍙封'.$this->sericnum.'鈥'; $gname= ''; $tit = ''.$this->modename.'鐨勫崟鎹妱閫'; } if($type=='pinglun'){ $cont = ''.$this->adminname.''.$act.'浣犵殑['.$this->modename.']鍗曟嵁锛岃鏄:'.$sm.''; $gname = ''; $tit = ''.$this->modename.'璇勮'; } if($type=='receipt'){ $cont = ''.$this->adminname.''.$act.'['.$this->modename.']鐨勫崟鎹'; if($sm!='')$cont.='锛岃鏄:'.$sm.''; $gname = '鍥炴墽纭'; $tit = ''.$this->modename.'鍥炴墽纭'; } $nbis = $this->flownexttodo($type); if($nbis){ if(is_string($nbis))$cont = $nbis; if(is_array($nbis)){ $tit = arrvalue($nbis, 'title', $tit); $gname = arrvalue($nbis, 'gname', $gname); $cont = arrvalue($nbis, 'cont', $cont); } } if($cont!='')$this->push($nuid, $gname, $cont, $tit); } public function getwxurl($num='') { if($num=='')$num = $this->modenum; $url = $this->rock->getouturl(); $str = ''.$url.'?m=ying&d=we&num='.$num.''; return $str; } public function getweurl($num='') { if($num=='')$num = $this->modenum; $url = $this->rock->getouturl(); $str = ''.$url.'?m=ying&d=we&mnum='.$num.''; return $str; } public function deletebill($sm='', $qxpd=true) { if(getconfig('systype')=='demo')return '婕旂ず璇峰嬁鍒犻櫎'; if($qxpd){ $is = $this->isdeleteqx(); if($is==0)return '鏃犳潈鍒犻櫎'; } if(method_exists($this,'flowdeletebillbefore')){ $bstr = $this->flowdeletebillbefore($sm); if(!isempt($bstr))return $bstr; } $modewhere = "`modenum`='".$this->modenum."' and `mid`=".$this->id.""; $this->flogmodel->delete($this->mwhere); m('reads')->delete($this->mwhere); m('file')->delfile('', "`mtype`='".$this->mtable."' and `mid`=".$this->id." and `id` not in(select `fileid` from `[Q]files` where `type`=3)"); $tables = $this->moders['tables']; if(!isempt($tables)){ $arrse = explode(',', $tables); foreach($arrse as $arrses)m($arrses)->delete('mid='.$this->id.''); } $this->billmodel->delete($this->mwhere); $this->todosmodel->delete($this->mwhere); $this->checksmodel->delete($this->mwhere); $this->chaomodel->delete($this->mwhere); m('remind')->delete($this->mwhere); m('todo')->delete($this->mwhere); m('todo')->delete($modewhere); m('receipt')->delete($this->mwhere); m('im_history')->delete("`xgurl`='".$this->modenum."|".$this->id."'"); m('files')->delete("`ip`='".$this->modenum."|".$this->id."'"); $this->delete($this->id); $this->flowdeletebill($sm); $this->flowzuofeibill($sm); $this->gettodosend('bodel','', $sm); $dels = '鍒犻櫎妯″潡['.$this->modename.']id涓'.$this->id.'鐨勫崟鎹'; $ztss = arrvalue($this->rs,'base_summary'); if(!isempt($ztss))$dels.=',鎽樿['.$ztss.']'; if(!isempt($sm))$dels.=',璇存槑:'.$sm.''; m('log')->addlogs('鍒犻櫎鍗曟嵁', $dels, 3); foreach($this->wherejoin as $num=>$fields){ $this->deletebilljoin($num, "`$fields`='$this->id'", $sm); } return 'ok'; } public function deletebilljoin($num, $where, $sm='') { $flow = m('flow')->initflow($num); $rows = $flow->getall($where); foreach($rows as $k1=>$rs1){ $mid = $rs1['id']; $flow->loaddata($mid, false); $flow->deletebill($sm, false); } } public function zuofeibilljoin($num, $where, $sm='') { $flow = m('flow')->initflow($num); $rows = $flow->getall($where); foreach($rows as $k1=>$rs1){ $mid = $rs1['id']; $flow->loaddata($mid, false); $flow->zuofeibill($sm); } } public function zuofeibill($sm='') { $this->addlog(array( 'explain' => $sm, 'name' => '浣滃簾', 'status' => 1, )); $this->update('`status`=5', $this->id); $zfarr = array( 'status' => 5, 'nstatus' => 5, 'checksm' => '浣滃簾锛'.$sm.'', 'nowcheckid' => '', 'nowcheckname' => '', 'nstatustext' => '浣滃簾', 'updt' => $this->rock->now, ); $this->billmodel->update($zfarr, $this->mwhere); $tables = $this->moders['tables']; if(!isempt($tables)){ $arrse = explode(',', $tables); foreach($arrse as $arrses)m($arrses)->delete('mid='.$this->id.''); } $this->flowzuofeibill($sm); $this->gettodosend('bozuofei','', $sm); foreach($this->wherejoin as $num=>$fields){ $this->zuofeibilljoin($num, "`$fields`='$this->id'", $sm); } return 'ok'; } public function openxiang() { $xiangdata = $btndata = array(); $data = $this->flowrsreplace($this->rs,4); foreach($this->fieldsarra as $k=>$rs){ if($rs['iszs']=='1'){ $xiangdata[] = array( 'name' => $rs['name'], 'fields'=> $rs['fields'], 'value' => $this->rock->repempt(arrvalue($data,$rs['fields'])) ); } } $barr['xiangdata'] = $xiangdata; $btnrows = $this->db->getrows('[Q]flow_menu',"`setid`='$this->modeid' and `status`=1 and `num` like 'open%'",'id,wherestr,name,num,issm,type','`sort`'); foreach($btnrows as $k=>$rs){ $wherestr = $rs['wherestr']; $bo = false; if(isempt($wherestr)){ $bo = true; }else{ $ewet = $this->wheremodel->getstrwhere($this->rock->jm->base64decode($wherestr)); $ewet = str_replace(array('{asqom}','1=2 and'),'', $ewet); $tos = $this->rows("`id`='$this->id' and $ewet"); if($tos>0)$bo = true; } if($bo)$btndata[] = array( 'id' => $rs['id'], 'name' => $rs['name'], 'issm' => $rs['issm'], ); } $barr['btndata'] = $btndata; if(method_exists($this,'flowopenxiang')){ $lbarr = $this->flowopenxiang($data,$xiangdata,$btndata); if(is_array($lbarr))foreach($lbarr as $k=>$v)$barr[$k]=$v; } return $barr; } public function smschuiban($sm='') { if($this->isflow>0 && $this->adminid==$this->uid){ $farr = $this->getflow(true); $nowcheckid = $farr['nowcheckid']; $tplnum = $this->option->getval('sms_cbnum','defnum'); $wxurl = $this->getxiangurlx(); $barr = c('xinhuapi')->sendsms($nowcheckid, '', $tplnum, array( 'modename' => $this->modename, 'sericnum' => $this->sericnum, 'applyname'=> $this->uname, 'deptname' => $this->rs['base_deptname'], ),$wxurl, false, false); if(!$barr['success'])return $barr['msg']; $this->addlog(array( 'explain' => $sm, 'name' => '鐭俊鍌姙', 'status' => 1, )); } return 'ok'; } public function reloadflow($sm='') { $this->update(array('status'=>0), $this->id); $this->flogmodel->update('`valid`=0', ''.$this->mwhere.' and `courseid`>0'); $this->addlog(array( 'explain' => $sm, 'name' => '閲嶆柊瀹℃壒', 'status' => 1, )); $this->getflow(true); $this->billmodel->update('`status`=0,`nstatus`=0',$this->mwhere); return 'ok'; } public function addschedule($sm='') { $txdt = $this->rock->post('txdt'); if(isempt($sm))return '璇存槑涓嶈兘涓虹┖'; if(isempt($txdt))return '鎻愰啋鏃堕棿涓嶈兘涓虹┖'; $barr['title'] = $sm; $barr['startdt'] = $txdt; $barr['uid'] = $this->adminid; $barr['optdt'] = $this->rock->now; $barr['optname']= $this->adminname; $barr['txsj'] = 1; m('schedule')->insert($barr); return 'ok'; } public function getoptmenu($flx=0) { $where = ''; if($flx==1)$where='and `iszs`=1'; $rows = $this->db->getrows('[Q]flow_menu',"`setid`='$this->modeid' ".$where." and `status`=1",'id,wherestr,name,statuscolor,statusvalue,num,islog,issm,type,upgcont','`sort`'); $arr = array(); $bfrom = $this->rock->post('bfrom'); if($flx==0)$arr[] = array('lx'=>0,'name'=>$this->rock->jm->base64decode('5pyq562!5o6I5peg5rOV5pi!56S66I!c5Y2V5aaC5bey562!5o6I5Y675Y2H57qn'),'optmenuid'=>0,'color'=>'red'); if($flx==1)return $arr; $status = (int)arrvalue($this->rs,'status','0'); $isturn = (int)arrvalue($this->rs, 'isturn','0'); $ismy = ($this->uid == $this->adminid or $this->optid == $this->adminid); $isreadbo = $this->isreadqx(1); if($this->isflow>0 && $isturn==1){ } if($status != 5 && arrvalue($this->moders,'ispl','1')=='1' && $isreadbo){ $arr[] = array('name'=>lang('璇勮'),'lx'=>15,'nup'=>1,'issm'=>1,'optmenuid'=>-15); } if($ismy && arrvalue($this->moders,'ishz')=='1' && $status==1){ $smcont = $this->getsummary(); $mid = (int)m('receipt')->getmou('id',"`uid`='$this->adminid' and `modenum`='$this->modenum' and `mid`='$this->id'"); $namess = '鍥炴墽纭璁剧疆'; if($mid>0)$namess = '鍥炴墽纭缂栬緫'; $arr[] = array('name'=>$namess,'djmid'=>$mid,'optnum'=>'receipt','lx'=>'18','optmenuid'=>-18,'modename'=>$this->modename,'smcont'=>$smcont); } if($isreadbo && arrvalue($this->moders,'istxset','1')=='1' && $this->modenum != 'remind' && !in_array($status, array(2,5))){ $smcont = ''.$this->modename.'锛'.$this->getsummary(); $mid = (int)m('remind')->getmou('id',"`uid`='$this->adminid' and `modenum`='$this->modenum' and `mid`='$this->id'"); $namess = '锛嬫坊鍔犳彁閱掕缃'; if($mid>0)$namess = '鎻愰啋璁剧疆缂栬緫'; $arr[] = array('name'=>$namess,'djmid'=>$mid,'smcont'=>$smcont,'issm'=>1,'optnum'=>'tixing','lx'=>'14','optmenuid'=>-14); } if($this->iseditqx()==1 && $isreadbo){ $arr[] = array('name'=>lang('缂栬緫'),'optnum'=>'edit','lx'=>'11','optmenuid'=>-11); } if($this->isdeleteqx()==1){ $arr[] = array('name'=>lang('鍒犻櫎'),'color'=>'red','optnum'=>'del','nup'=>1,'issm'=>0,'islog'=>0,'statusvalue'=>9,'lx'=>'9','optmenuid'=>-9); } if(method_exists($this,'flowgetoptmenuarr')){ $lbarr = $this->flowgetoptmenuarr($flx); if(is_array($lbarr))foreach($lbarr as $k=>$v)$arr[]=$v; } return $arr; } public function optmenu($czid, $zt, $sm='') { $msg = ''; $cname = $this->rock->post('changename'); $cnameid = $this->rock->post('changenameid'); $cdate = $this->rock->post('changedate'); $darr = array( 'cname' => $cname, 'cnameid' => $cnameid, 'cdate' => $cdate, 'sm' => $sm, ); if($czid==-9){ $msg = $this->deletebill($sm); }else if($czid==-10){ $msg = $this->check($zt, $sm); if(contain($msg,'鎴愬姛'))$msg = 'ok'; }else if($czid==-12){ $this->zhuijiaexplain($sm); }else if($czid==-13){ $this->chuiban($sm); }else if($czid==-14){ $msg = $this->addschedule($sm); }else if($czid==-15){ $actname = $this->rock->post('name'); $this->addlog(array( 'explain' => $sm, 'name' => $actname, )); $uids = ''; if(isset($this->rs['uid'])){ $uids= $this->rs['uid']; }else if(isset($this->rs['optid'])){ $uids= $this->rs['optid']; } if($uids)$this->nexttodo($uids, 'pinglun', $sm, $actname); $this->gettodosend('boping','', $sm); }else if($czid==-16){ $this->zuofeibill($sm); }else if($czid==-17){ $msg = $this->smschuiban($sm); }else if($czid==-18){ $msg = $this->jiankongzb($darr); }else if($czid==-19){ $msg = $this->reloadflow($sm); }else{ } if($msg=='')$msg='ok'; return $msg; } public function jiankongzb($darr) { return $this->bd6('5peg5L!h5ZG8562!5o6I5peg5q2k5Yqf6IO9'); } public function billwhere($uid, $lx) { $arr['table'] = $this->mtable; $arr['tableleft'] = ''; $arr['fields'] = ''; $arr['order'] = ''; $arr['group'] = ''; $arr['keywhere']= ''; $arr['asqom'] = ''; $arr['onlywhere'] = ''; $arr['companywhere']= ''; $this->atype = $lx; $nas = $this->flowbillwhere($uid, $lx); $inwhere = ''; if(substr($lx,0,5)=='grant'){ $inwhere = $this->viewmodel->viewwhere($this->moders, $this->adminid, $this->flowviewufieds, 1); } if($lx=='chaos'){ $inwhere = "and {asqom}`id` in(select `mid` from `[Q]flow_chao` where `table`='{$this->mtable}' and ".$this->rock->dbinstr('csnameid', $this->adminid).")"; } if($lx=='mychuli'){ $inwhere = "and {asqom}`id` in(select bill.`mid` from `[Q]flow_bill` as `bill` where bill.`modeid`='{$this->modeid}' and ".$this->rock->dbinstr('bill.`allcheckid`', $this->adminid).")"; } $_wehs = ''; if(is_array($nas)){ if(isset($nas['where']))$_wehs = $nas['where']; $ftears = explode(',','asqom,order,fields,fieldsleft,table,group,companywhere,onlywhere,keywhere,tableleft'); foreach($ftears as $fid)if(isset($nas[$fid]))$arr[$fid] = $nas[$fid]; }else{ $_wehs = $nas; } $fwhere = $this->getflowwhere($uid, $lx); $path = ''.P.'/flow/page/rock_page_'.$this->modenum.'.php'; $table = $arr['table']; $temsao = 0; if(!contain($table, ' ') && $this->isflow>0){ $arr['table'] = '`[Q]'.$this->mtable.'` a left join `[Q]flow_bill` b on a.`id`=b.`mid` and b.`table`=\''.$this->mtable.'\''; if(!isempt($arr['tableleft']))$arr['table'].=' left join '.$arr['tableleft'].''; $arr['asqom'] = 'a.'; $arr['fields']= 'a.*,b.`uname` as base_name,b.`udeptname` as base_deptname,b.`sericnum`,b.`nowcheckname`'; if(isset($arr['fieldsleft']) && $arr['fieldsleft'])$arr['fields'].=','.$arr['fieldsleft'].''; if($arr['order']=='')$arr['order'] = 'a.`optdt` desc'; $temsao = 1; if($this->defaultorder){ $defa = explode(',', $this->defaultorder); $desc = arrvalue($defa, 1, 'desc'); $arr['order'] = 'a.`'.$defa[0].'` '.$desc.''; } } if(isempt($arr['order'])){ $arr['order'] = '{asqom}`id` desc'; if($this->defaultorder){ $defa = explode(',', $this->defaultorder); $desc = arrvalue($defa, 1, 'desc'); $arr['order'] = '{asqom}`'.$defa[0].'` '.$desc.''; } } if(isempt($fwhere) && isempt($inwhere) && $this->moders['isscl']>0){ $fwhere = 'and 1=2'; } $where = $inwhere; $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $where .= ' and {asqom}'.$wherestr; } if($fwhere!='')$where .= ' '.$fwhere; if($_wehs!='')$where .= ' '.$_wehs; $highwhere = $this->gethighwhere(); $allfields = array(); $key = $this->rock->post('key'); $pnum = $this->rock->post('pnum'); $status = $this->rock->post('keystatus'); $ztfields = arrvalue($nas, 'ztfields', 'status'); $xhlikea = array('like','=','>=','<=', 'not like'); $xhfields = $this->rock->post('xhfields'); $xhlike = (int)$this->rock->post('xhlike','0'); $xhkeygj = $this->rock->jm->base64decode($this->rock->post('xhkeygj')); if(!isempt($xhkeygj) && $xhfields){ if(substr($xhfields,0,2)=='zb'){ $xu = substr($xhfields,2,1); $zbasr = explode(',', $this->moders['tables']); $zbts = arrvalue($zbasr,$xu); $xhfields = substr($xhfields,4); $wher1 = "`$xhfields` ".$xhlikea[$xhlike].""; if($xhlike==0 || $xhlike==4)$wher1.=" '%".$xhkeygj."%'"; if($xhlike==1 || $xhlike==2 || $xhlike==3)$wher1.=" '$xhkeygj'"; $wher1 = " and {asqom}`id` in(select `mid` from `[Q]".$zbts."` where ".$wher1.")"; $where.= $wher1; }else{ $wher1 = " and {asqom}`$xhfields` ".$xhlikea[$xhlike].""; if($xhlike==0 || $xhlike==4)$wher1.=" '%".$xhkeygj."%'"; if($xhlike==1 || $xhlike==2 || $xhlike==3)$wher1.=" '$xhkeygj'"; $where.= $wher1; } } if(!isempt($status))$where .= ' and {asqom}`'.$ztfields.'`='.$status.''; if(!isempt($key) && isempt($arr['keywhere'])){ $check = c('check'); $allfields = $this->db->getallfields('[Q]'.$this->mtable.''); $_kearr = array(); if($check->isdate($key) || $check->ismonth($key)){ $skeay = array('date','datetime','month'); foreach($this->fieldsarra as $k=>$rs){ $flx = $rs['fieldstype']; $fid = $rs['fields']; if($rs['issou']==1 && in_array($flx, $skeay) && in_array($fid, $allfields)){ if($check->isdate($key)){ if($flx=='date')$_kearr[] = "{asqom}`".$fid."`='$key'"; if($flx=='datetime')$_kearr[] = "{asqom}`".$fid."` like '$key%'"; if($flx=='month')$_kearr[] = "{asqom}`".$fid."`='".substr($key,0,7)."'"; if($temsao==1){ $_kearr[] = "b.`applydt`='$key'"; } } if($check->ismonth($key)){ if($flx=='month'){ $_kearr[] = "{asqom}`".$fid."`='$key'"; }else{ $_kearr[] = "{asqom}`".$fid."` like '$key%'"; } if($temsao==1){ $_kearr[] = "b.`applydt` like '$key%'"; } } } } } if(!$_kearr){ $skeay = array('text','textarea','htmlediter','changeuser','changeusercheck','changedept','changedeptusercheck','selectdatafalse','selectdatatrue','num'); $xiakk = array('rockcombo','select'); foreach($this->fieldsarra as $k=>$rs){ if($rs['issou']==1 && in_array($rs['fields'], $allfields) && substr($rs['fields'],-2) != 'dt'){ if(in_array($rs['fieldstype'], $skeay))$_kearr[] = "{asqom}`".$rs['fields']."` like '%".$key."%'"; } } if($temsao==1){ $_kearr[] = "b.`uname` like '%".$key."%'"; $_kearr[] = "b.`udeptname` like '%".$key."%'"; $_kearr[] = "b.`sericnum` = '$key'"; $_kearr[] = "b.`nowcheckname` = '$key'"; } if(isset($nas['orlikefields'])){ $owhee = explode(',', $nas['orlikefields']); foreach($owhee as $owhees){ $_owhees = explode('@', $owhees); $sle = arrvalue($_owhees, 1); if($sle=='1'){ $_kearr[] = "".$_owhees[0]." ='$key'"; }else{ $_kearr[] = "".$_owhees[0]." like '%".$key."%'"; } } } } if($_kearr && $arr['onlywhere']=='')$arr['keywhere'] = "and (".join(' or ',$_kearr).")"; } if(!isempt($arr['companywhere']) && getconfig('companymode'))$where .= ' '.$arr['companywhere']; if(!isempt($arr['onlywhere']))$where .= ' '.$arr['onlywhere']; if(!isempt($arr['keywhere']))$where .= ' '.$arr['keywhere']; if($highwhere!='')$where .= ' '.$highwhere; $where = str_replace('{asqom}', $arr['asqom'], $where); $arr['order'] = str_replace('{asqom}', $arr['asqom'], $arr['order']); $where = str_replace('[A]', $arr['asqom'], $where); $fields = $arr['fields']; if($this->flowfieldstype==1 && (isempt($fields) || $fields=='*') && $this->moders['isscl']>0){ if(!$allfields)$allfields = $this->db->getallfields('[Q]'.$this->mtable.''); $fields = '{asqom}`id`'; $odlvs = $this->option->getval('columns_'.$this->modenum.'_'.$pnum.''); if(isempt($odlvs)){ foreach($this->fieldsarra as $k=>$rs){ if($rs['islb']==1 && in_array($rs['fields'],$allfields)){ $fields.=',{asqom}`'.$rs['fields'].'`'; } } }else{ $odlvsa = explode(',', $odlvs); foreach($odlvsa as $odlvs1){ if(in_array($odlvs1, $allfields)){ $fields.=',{asqom}`'.$odlvs1.'`'; } } } if($this->isflow>0){ if(!contain($fields,'`status`'))$fields.=',{asqom}`status`'; } $fields = str_replace('{asqom}', $arr['asqom'], $fields); $arr['fields'] = $fields; } $fields = $arr['fields']; if(!isempt($fields) && $fields!='*'){ $fieldsa = explode(',', $fields); $fieldss = ''; foreach($fieldsa as $fieldsas){ if(contain($fieldsas,'`') || contain($fieldsas,'.') || contain($fieldsas,' ') || contain($fieldsas,'(')){ $fieldss.=','.$fieldsas.''; }else{ $fieldss.=',`'.$fieldsas.'`'; } } $arr['fields'] = substr($fieldss, 1); } $arr['where'] = str_replace('{asqom}','`[Q]'.$this->mtable.'`.', $where); return $arr; } public function gethighwhere() { $s = ''; return $s; } public function getflowwhere($uid, $num) { $where = ''; $rs = $this->wheremodel->getone("`setid`='$this->modeid' and `num`='$num'"); if(!$rs)return $where; $where = $this->wheremodel->getwherestr($rs, $uid, $this->flowviewufieds); return $where; } public function getflowrows($uid, $lx, $limit=5, $swher='') { $nas = $this->billwhere($uid, $lx); $table = $nas['table']; if(!contain($table,' '))$table='[Q]'.$table.''; if(isempt($nas['fields']))$nas['fields'] = '*'; $swher = str_replace('{asqom}',$nas['asqom'], $swher); $where = '1=1 '.$nas['where'].' '.$swher.''; if($limit==0)return $this->db->rows($table, $where ); $rows = $this->db->getrows($table, $where , $nas['fields'], $nas['order'], $limit); foreach($rows as $k=>$rs){ $rows[$k] = $this->rsreplace($rs, 2); } return $rows; } public function gettodorows($whereid) { $where = $this->wheremodel->getwherestr($whereid, $this->adminid, $this->flowviewufieds); $wherestr = $this->moders['where']; if(!isempt($wherestr)){ $wherestr = $this->rock->covexec($wherestr); $where .= ' and '.$wherestr; } $where = str_replace('{asqom}','', $where); $rows = $this->getall('2=2 '.$where.''); foreach($rows as $k=>$rs){ $rows[$k] = $this->rsreplace($rs, 1); } return $rows; } public function printexecl($event) { $arr['moders'] = $this->moders; $arr['fields'] = $this->getfields(); $cell = 1; foreach($arr['fields'] as $k=>$v)$cell++; $arr['cell'] = $cell; $where = '1=1'; $str1 = $this->moders['where']; if(!isempt($str1)){ $str1 = $this->rock->covexec($str1); $where = $str1; } $vwhere = $this->viewmodel->viewwhere($this->moders, $this->adminid); $rows = $this->getrows(''.$where.' '.$vwhere.'', '*', 'id desc', 100); $arr['rows'] = $this->flowprintrows($rows); $arr['count'] = $this->db->count; return $arr; } public function getsuballdata($lx=0, $mid=0) { $tabless = $this->moders['tables']; $subdata = array(); if($mid==0)$mid = $this->id; if(!isempt($tabless)){ $tablessa = explode(',', $tabless); $namessa = explode(',', $this->moders['names']); $tabless1 = '['.str_replace(',','],[', $tabless).']'; foreach($tablessa as $zbx=>$tables){ $cis = substr_count($tabless1, '['.$tables.']'); $whes = ''; if($cis>1)$whes=' and `sslx`='.$zbx.''; $data = m($tables)->getall('mid='.$mid.''.$whes.'','*','`sort`'); $data = $this->flowsubdata($data, $lx, $zbx); if($lx == 0){ $subdata['subdata'.$zbx.''] = $data; }else{ $subdata[$zbx] = array( 'data' => $data, 'fields'=> 'subdata'.$zbx.'', 'name' => $this->rock->arrvalue($namessa, $zbx) ); } } } return $subdata; } private $gettodolistarr = null; public function gettodolist($act) { if(is_array($act))return $act; if($this->gettodolistarr === null){ $rows = $this->todomodel->getrows("`setid`='".$this->modeid."' and `status`=1"); $barr = array(); foreach($rows as $k=>$rs){ $whereid = (int)$rs['whereid']; if($whereid > 0){ $bo = $this->wheremanzhu($whereid); if(!$bo)continue; } $barr[] = $rs; } $this->gettodolistarr = $barr; }else{ $barr = $this->gettodolistarr; } $garr = array(); if($barr)foreach($barr as $k=>$rs){ if(arrvalue($rs,$act)=='1')$garr[] = $rs; } return $garr; } public function gettodosend($act, $actname='',$sm='', $courseid=0, $conts='') { $barr = $this->gettodolist($act); if(!$barr)return; $changearr = array('boturn'=>'鎻愪氦','boedit'=>'缂栬緫','bozhuan'=>'杞姙','bochang'=>'淇敼瀛楁','bodel'=>'鍒犻櫎','bozuofei'=>'浣滃簾','botong'=>'澶勭悊鍚屾剰','bobutong'=>'澶勭悊涓嶅悓鎰','bofinish'=>'鍏ㄩ儴澶勭悊瀹屾垚','bozhui'=>'杩藉姞璇存槑','boping'=>'璇勮','bohuiz'=>'鍥炴墽纭'); if($actname=='' && is_string($act))$actname = arrvalue($changearr, $act); if(isempt($actname))return; $cheo = c('check'); foreach($barr as $k=>$rs){ $receid = $rs['receid']; if($act=='botong' || $act=='bobutong'){ $changewe = $rs['changecourse']; if(!isempt($changewe) && !contain(','.$changewe.',',','.$courseid.','))continue; } if($rs['toturn']==1)$receid.=','.$this->uid.''; if(arrvalue($rs,'tosuper')=='1'){ $supar = $this->adminmodel->getsuperman($this->uid); $shnej = arrvalue($supar, 0); if(!isempt($shnej))$receid.=','.$shnej.''; } if($rs['tocourse']==1 && $this->billrs){ $allcheckid = $this->billrs['allcheckid']; if(!isempt($allcheckid))$receid.=','.$allcheckid.''; } $todofields = $rs['todofields']; if(!isempt($todofields)){ $toad = explode(',', $todofields); foreach($toad as $toads){ $ttv = arrvalue($this->rs, $toads); if(!isempt($ttv) && $cheo->isinnumber($ttv))$receid.=','.$ttv.''; } } if(isempt($receid))continue; if(substr($receid,0,1)==',')$receid = substr($receid, 1); $cont = $rs['summary']; if(isempt($cont))$cont = $conts; if(isempt($cont)){ $cont = ''.$this->adminname.''.$actname.'['.$this->modename.',鍗曞彿:'.$this->sericnum.']'; if($sm!='')$cont.=',璇存槑:'.$sm.''; } $this->push($receid, '', $cont, $this->rock->repempt($rs['name'])); } } public function numtodosend($num, $actname='',$sm='') { $rows = $this->todomodel->getrows("`setid`='".$this->modeid."' and `num`='$num' and `status`=1"); if(!$rows)return; $this->gettodosend($rows, $actname, $sm); } public function flowtotal($fields='', $type='') { if($fields=='')$fields = $this->rock->post('total_fields'); if($type=='')$type = $this->rock->post('total_type','jls'); $typea = explode('|', $type); $typefields = ''; $type = $typea[0]; $typefields = arrvalue($typea, 1); $rowa = array(); $rowa[] = array( 'name' => '鏆傛棤鏁版嵁', 'value' => 0, 'bili' => '' ); $tofiels= 'count(1)'; if($type=='sum')$tofiels = 'sum([A]`'.$typefields.'`)'; if($type=='avg')$tofiels = 'avg([A]`'.$typefields.'`)'; $atype = $this->rock->post('atype'); $table = '[Q]'.$this->mtable.''; $narr = $this->billwhere($this->adminid, $atype); $where = $narr['where']; $table = $narr['table']; if(!contain($table,' '))$table = '[Q]'.$table.''; $gwhere = $this->rock->post('where'); if(!isempt($gwhere)){ $gwhere = $this->rock->jm->uncrypt($this->rock->iconvsql($gwhere)); $where .= ' '.$gwhere.''; } $sql = 'select '.$fields.' as `name`,'.$tofiels.' as value from '.$table.' where 1=1 '.$where.' group by '.$fields.''; $sql = str_replace('[A]', $narr['asqom'], $sql); $rows = $this->db->getall($sql); $total = 0; if($rows){ foreach($rows as $k=>$rs)$total+=floatval($rs['value']); if($total>0)foreach($rows as $k=>$rs){ $rows[$k]['bili'] = $this->rock->number($rs['value']*100/$total).'%'; } if($type!='avg' && count($rows)>1)$rows[] = array('name' => '鍚堣','value' => $total,'bili' => ''); }else{ $rows = $rowa; } return $rows; } public function receiptcheck($hid, $sm) { return 'ok'; } public function getrowstable($atype, $where, $limit=100,$fields='') { $rows = $this->getflowrows($this->adminid,$atype,$limit,$where); $headstr = '@xuhaos,,center'; foreach($this->fieldsarra as $k=>$rs){ $bo = false; if(!$fields && $rs['islb']==1 && $rs['iszb']=='0')$bo = true; if($fields && contain(','.$fields.',',','.$rs['fields'].','))$bo = true; if($bo)$headstr.='@'.$rs['fields'].','.$rs['name'].''; } if($this->isflow>0){ $headstr.='@statustext,鐘舵'; if(is_array($rows))foreach($rows as $k=>$rs){ $rows[$k]['statustext'] = $this->getstatusstr($rs); } } $cont = c('html')->createrows($rows, substr($headstr, 1),'#cccccc','noborder'); return $cont; } public function lang($ky) { return lang($ky,'mode_'.$this->modenum.''); } public function rsreplace($rs, $lx, $kzq=null, $ly=0) { $id = (int)arrvalue($rs, 'id','0'); if($id<=0)return $rs; $rs = $this->flowrsreplace($rs, $lx); if(isset($rs[$this->flowcompanyidfieds]))$rs['comidname'] = $this->companymodel->comidname($rs[$this->flowcompanyidfieds]); if($this->tfieldarr)foreach($this->tfieldarr as $k1=>$frs){ $type = $frs['fieldstype']; $fid = $frs['fields']; $val = arrvalue($rs, $fid); if($type=='uploadimg' && !contain($val,'<')){ if($val && $lx==2)$rs[''.$fid.'_textcn'] = ''; continue; } if(isempt($frs['data']))continue; if(isempt($val) || !is_numeric($val))continue; if(!array_key_exists('store', $frs)){ if($this->inputobj == null){ $this->inputobj = c('input'); $this->inputobj->flow = $this; } $store = $this->inputobj->getdatastore($frs['fieldstype'], $kzq, $frs['data'], $fid); $this->tfieldarr[$k1]['store'] = $store; }else{ $store = $frs['store']; } if($store)foreach($store as $x=>$rv){ if($rv['value']==$val){ $rs[''.$fid.'_yuan'] = $val; if($lx==2 && $ly==0){ $rs[''.$fid.'_textcn'] = $rv['name']; if(isset($rv['color']))$rs[''.$fid.'_color'] = $rv['color']; }else{ $rs[$fid] = $rv['name']; if(isset($rv['color']))$rs[$fid] = ''.$rs[$fid].''; } break; } } } return $rs; } public function viewjinfields($rows) { if(!$rows)return $rows; return $rows; } public function daochusubtable($rows) { return $rows; } } \ No newline at end of file diff --git a/webmain/model/flow/gongModel.php b/webmain/model/flow/gongModel.php index 658e1c2..852f1e5 100644 --- a/webmain/model/flow/gongModel.php +++ b/webmain/model/flow/gongModel.php @@ -173,7 +173,7 @@ class flow_gongClassModel extends flowModel 'order' => '`istop` desc,`optdt` desc', 'keywere' => $keywere, 'where' => $whyere, - 'fields' => 'id,typename,optdt,title,optname,zuozhe,indate,recename,fengmian,mintou,`status`,`istop`,`appxs`' + 'fields' => 'id,typename,optdt,title,optname,zuozhe,indate,recename,fengmian,mintou,`status`,`istop`,`appxs`,`comid`' ); } diff --git a/webmain/model/flow/userModel.php b/webmain/model/flow/userModel.php index 62a875a..652fb17 100644 --- a/webmain/model/flow/userModel.php +++ b/webmain/model/flow/userModel.php @@ -37,7 +37,7 @@ class flow_userClassModel extends flowModel $where.= " and instr(`deptpath`,'[$detpid]')>0"; } return array( - 'fields'=> '`name`,`id`,`id` as uid,`face`,`sort`,`deptallname`,deptpath,`ranking`,`tel`,`mobile`,`email`,`user`,num,workdate,sex,deptname,deptnames,superman,status,type,online,lastonline,isvcard,`companyid`', + 'fields'=> '`name`,`id`,`id` as uid,`face`,`sort`,`deptallname`,deptpath,`ranking`,`tel`,`mobile`,`email`,`user`,num,workdate,sex,deptname,deptnames,superman,status,type,online,lastonline,isvcard,`companyid`,`comid`', 'order' => '`status` desc,`sort`', 'where' => $where ); diff --git a/webmain/model/flowbillModel.php b/webmain/model/flowbillModel.php index db3cb5b..4adb56f 100644 --- a/webmain/model/flowbillModel.php +++ b/webmain/model/flowbillModel.php @@ -136,6 +136,7 @@ class flowbillClassModel extends Model $modename = $rs['modename']; $summary = ''; $summarx = ''; + $comidname = ''; $modenum = ''; $statustext = '璁板綍涓嶅瓨鍦'; $statusstr = '涓嶅瓨鍦'; @@ -155,6 +156,7 @@ class flowbillClassModel extends Model $rers = $this->db->getone('[Q]'.$rs['table'].'', $rs['mid']); if($rers){ $tihsrs = $flow->rsreplace($rers, 2, null, 1); + $comidname = $tihsrs['comidname']; $summary = $this->rock->reparr($mors['summary'], $tihsrs); $summarx = $this->rock->reparr($mors['summarx'], $tihsrs); @@ -190,6 +192,7 @@ class flowbillClassModel extends Model if(!isempt($rs['checksm']))$cont.='
澶勭悊璇存槑锛'.$rs['checksm'].''; } } + if(ISMORECOM)$cont.='
鎵灞炲崟浣嶁伙細'.$comidname.''; $srows[]= array( 'title' => $title, @@ -298,6 +301,7 @@ class flowbillClassModel extends Model $modename = $rs['modename']; $summary = ''; $modenum = ''; + $comidname = ''; $statustext = '璁板綍涓嶅瓨鍦'; $statuscolor= '#888888'; $ishui = 0; @@ -319,6 +323,7 @@ class flowbillClassModel extends Model $tihsrs = $flow->rsreplace($rers, 2, null, 1); $summary = $this->rock->reparr($mors['summary'], $tihsrs); + $comidname = $tihsrs['comidname'];//鎵灞炲崟浣 $nowsets = $rs['nowcheckname']; //褰撳墠瀹℃牳浜 $ztarr = $flow->getstatus($rers, $mors['statusstr'], $nowsets); $statustext = $ztarr[0]; @@ -349,6 +354,7 @@ class flowbillClassModel extends Model 'modename' => $modename, 'modenum' => $modenum, 'summary' => $summary, + 'comidname' => $comidname, 'status' => $statusstr ); } diff --git a/webmain/model/modeModel.php b/webmain/model/modeModel.php index cfc584b..4e45d77 100644 --- a/webmain/model/modeModel.php +++ b/webmain/model/modeModel.php @@ -113,6 +113,8 @@ class modeClassModel extends Model } } } + + $farr[] = array('name'=>arrvalue($chufarr, 'comidname', lang('鎵灞炲崟浣嶁')),'fields'=>'comidname','islb'=>(ISMORECOM)?1:0); $jgpstr = ''; $hstart = ''; diff --git a/webmain/public/publicAction.php b/webmain/public/publicAction.php index e9b241a..270c8d2 100644 --- a/webmain/public/publicAction.php +++ b/webmain/public/publicAction.php @@ -163,6 +163,11 @@ class publicClassAction extends ActionNot{ $otype = (int)$this->get('otype','0'); $this->smartydata['id'] = $id; $this->smartydata['otype'] = $otype; + $urlbj = getconfig('officebj_url'); + + //璇存槑鏄嚜宸遍儴缃茬紪杈戝钩鍙扮敤鏃х殑椤甸潰 + if(!isempt($urlbj) && !contain($urlbj,'rockoa.com') && getconfig('systype') != 'dev') + $this->displayfile = ''.P.'/public/tpl_public_fileedit_old.html'; } /** diff --git a/webmain/public/tpl_public_fileedit.html b/webmain/public/tpl_public_fileedit.html index feb6b7c..2422449 100644 --- a/webmain/public/tpl_public_fileedit.html +++ b/webmain/public/tpl_public_fileedit.html @@ -8,13 +8,14 @@ + + + + +
+ 澶勭悊涓... +
+ + + \ No newline at end of file diff --git a/webmain/system/cog/rock_cog_set.php b/webmain/system/cog/rock_cog_set.php index efc1814..3f6267a 100644 --- a/webmain/system/cog/rock_cog_set.php +++ b/webmain/system/cog/rock_cog_set.php @@ -257,8 +257,8 @@ $(document).ready(function(){ 鏂囨。鍦ㄧ嚎缂栬緫锛 - - + + diff --git a/webmain/task/api/uploadAction.php b/webmain/task/api/uploadAction.php index b3bcdff..5a283a5 100644 --- a/webmain/task/api/uploadAction.php +++ b/webmain/task/api/uploadAction.php @@ -32,8 +32,13 @@ class uploadClassAction extends apiAction $this->returnjson($arr); } + /** + * 浠庣紪杈戞枃浠朵腑蹇冭幏鍙栨渶鏂扮紪杈戠殑鏂囦欢20250610 + */ public function editfilebAction() { + //鐢ㄩ偅涓紓姝ュ幓鑾峰彇(寰呭紑鍙) + $fileid = (int)$this->get('fileid','0'); $frs = m('file')->getone($fileid); if(!$frs)return 'error'; @@ -58,6 +63,22 @@ class uploadClassAction extends apiAction } } + //鍒ゆ柇鏄惁缂栬緫瀹屾垚 + public function editfilecAction() + { + $fileid = (int)$this->get('fileid','0'); + $erand = $this->get('erand'); + $frs = m('file')->getone($fileid); + if(!$erand || !$frs)return 'error'; + $barr = c('rockedit')->getdata('file','editfilec', array( + 'filekey' => getconfig('xinhukey'), + 'filenum' => $frs['onlynum'], + 'erand' => $erand + )); + if($barr['success'])return $barr['data']; + return 'wait'; + } + /** * 杩欎釜鏄敤鏉ュ湪绾跨紪杈戞枃妗d笂浼犵殑 @@ -378,9 +399,20 @@ class uploadClassAction extends apiAction //缂栬緫 if($type==2){ if(getconfig('officebj')=='1'){ + $erand = rand(1000000,9999999); $data['fileext']= 'rockedit'; - $data['url'] = 'index.php?m=public&a=fileedit&id='.$fileid.''; - $data['editwsinfo'] = c('rockedit')->getwsinfo(); + $data['url'] = 'index.php?m=public&a=fileedit&id='.$fileid.'&erand='.$erand.''; + $data['editwsinfo'] = c('rockedit')->getwsinfo(array( + 'erand' => $erand, + 'fileid'=> $fileid + )); + /* + c('rockqueue')->push('rockoffice,gedit', array( + 'erand' => $erand, + 'cishu' =>1, + 'fileid' =>$fileid, + 'optid' => $this->adminid + ), time() + 10);*/ }else{ if($ismobile==1)return returnerror('绉诲姩绔笉鏀寔鍦ㄧ嚎缂栬緫'); $data['fileext']='rockoffice'; @@ -668,6 +700,7 @@ class uploadClassAction extends apiAction 'optid' => $this->adminid, 'otype' => $otype, 'fileext' => $frs['fileext'], + 'erand' => $this->get('erand'), 'filename' => $this->rock->jm->base64encode($frs['filename']), 'optname' => $this->rock->jm->base64encode($this->adminname), 'face' => $this->rock->jm->base64encode(m('admin')->getface($urs['face'])), diff --git a/webmain/task/api/uploawAction.php b/webmain/task/api/uploawAction.php index f9ce8b4..476abce 100644 --- a/webmain/task/api/uploawAction.php +++ b/webmain/task/api/uploawAction.php @@ -7,11 +7,15 @@ class uploawClassAction extends apiAction } /** - * 涓婁紶鏂囦欢(澶栭儴淇℃伅鏀堕泦浣跨敤鐨) + * 涓婁紶鏂囦欢(澶栭儴淇℃伅鏀堕泦浣跨敤鐨)锛屽純鐢 */ public function upfileAction() { - if(!$_FILES)exit('sorry!'); + return 'error0'; + /* + $mid = (int)$this->get('mid','0'); + $to = m('planm')->rows('`id`='.$mid.' and `type`=2 and `fenlei`=1 and `status`=1'); + if($to==0 || !$_FILES)exit('sorry!'); $upimg = c('upfile'); $maxsize= (int)$this->get('maxsize', $upimg->getmaxzhao());//涓婁紶鏈澶 $uptypes= 'jpg|png|docx|doc|pdf|xlsx|xls|zip|rar'; @@ -21,5 +25,6 @@ class uploawClassAction extends apiAction $arr = c('down')->uploadback($upses); $arr['autoup'] = (getconfig('qcloudCos_autoup') || getconfig('alioss_autoup')) ? 1 : 0; //鏄惁涓婁紶鍏朵粬骞冲彴 return $arr; + */ } } \ No newline at end of file diff --git a/webmain/task/openapi/openmodhetongAction.php b/webmain/task/openapi/openmodhetongAction.php index 0526807..70d211f 100644 --- a/webmain/task/openapi/openmodhetongAction.php +++ b/webmain/task/openapi/openmodhetongAction.php @@ -10,63 +10,7 @@ class openmodhetongClassAction extends openapiAction public function dataAction() { return retuenerror('20240429鏈鏂板凡寮冪敤'); - $mobile = $this->get('mobile'); - $xcytype = $this->get('xcytype'); - $openid = $this->get('openid'); - $nickName = $this->jm->base64decode($this->get('nickName')); - $htdata = array(); - $db = m('wxxcyus'); - $uarr['mobile'] = $mobile; - $uarr['xcytype'] = $xcytype; - $uarr['openid'] = $openid; - $uarr['nickName'] = $nickName; - $uarr['province'] = $this->get('province'); - $uarr['city'] = $this->get('city'); - $uarr['gender'] = $this->get('gender'); - $uarr['dingyue'] = $this->get('dingyue'); - $uarr['avatarUrl'] = $this->jm->base64decode($this->get('avatarUrl')); - $where = "`openid`='$openid'"; - if($db->rows($where)==0){ - $uarr['adddt'] = $this->now; - $where=''; - }else{ - $uarr['optdt'] = $this->now; - } - $db->record($uarr, $where); - $custid = '0'; //瀹㈡埛id - $rows = m('customer')->getall("`mobile`='$mobile' and `status`=1",'id'); - foreach($rows as $k=>$rs)$custid.=','.$rs['id'].''; - if($custid!='0'){ - $htrows = m('custract')->getall('custid in('.$custid.')','custid,custname,id,startdt,enddt,signdt,type,money,num','id desc'); - $dt = $this->rock->date; - foreach($htrows as $k=>$rs){ - - if($rs['startdt']>$dt){ - $statustext='寰呯敓鏁'; - $statuscolor='blue'; - }else if($rs['startdt']<=$dt && $rs['enddt']>=$dt){ - $statustext='鐢熸晥涓'; - $statuscolor='green'; - }else if($rs['enddt']<$dt){ - $statustext='宸茶繃鏈'; - $statuscolor='gray'; - } - - $htdata[] = array( - 'id' => $rs['id'], - 'name' => $rs['custname'], - 'modenum' => 'custract', - 'explain' => '閲戦:'.$rs['money'].',缂栧彿:'.$rs['num'].',鏈夋晥鏈:'.$rs['startdt'].'鈫'.$rs['enddt'].'', - 'statustext'=>$statustext, - 'statuscolor'=>$statuscolor, - ); - } - } - - return returnsuccess(array( - 'htdata' => $htdata, - )); } /** @@ -75,23 +19,6 @@ class openmodhetongClassAction extends openapiAction public function customerAction() { return retuenerror('20240429鏈鏂板凡寮冪敤'); - $mobile = $this->get('mobile'); - $xcytype = $this->get('xcytype'); - $openid = $this->get('openid'); - $sql = "select a.id,a.name,a.unitname,b.name as yewuname from [Q]customer a left join [Q]admin b on a.uid=b.id where a.`mobile`='$mobile' and a.`status`=1"; - $rows = $this->db->getall($sql); - $custdata = array(); - foreach($rows as $k=>$rs){ - $custdata[] = array( - 'id' => $rs['id'], - 'name' => $rs['name'], - 'modenum' => 'customer', - 'explain' => '涓氬姟鍛:'.$rs['yewuname'].'', - ); - } - return returnsuccess(array( - 'custdata' => $custdata, - )); } } \ No newline at end of file diff --git a/webmain/task/openapi/openxiangAction.php b/webmain/task/openapi/openxiangAction.php index 53ac5f5..8c7c649 100644 --- a/webmain/task/openapi/openxiangAction.php +++ b/webmain/task/openapi/openxiangAction.php @@ -10,70 +10,5 @@ class openxiangClassAction extends openapiAction $this->showreturn('', '姝ら〉闈㈠純鐢', 201);//2025-04-09 } - /** - * 璇︽儏 - */ - public function dataAction() - { - $list['hetong'] = 'custract,customer'; //閰嶇疆鍙鍙栨ā鍧 - $num = $this->get('num'); - $xcytype = $this->get('xcytype'); - $mid = (int)$this->get('mid','0'); - if(isempt($num) || !$xcytype || $mid==0)return returnerror('num isempt'); - $kears = arrvalue($list, $xcytype); - if(!$kears)return returnerror('鏃犳晥妯″潡1'); - if(!in_array($num,explode(',', $kears)))return returnerror('鏃犳晥妯″潡2'); - - $flow = m('flow')->initflow($num,$mid, false); - $barr['modename'] = $flow->modename; - $barr['btndata'] = array(); - $barr['xiangdata']= array(); - if(method_exists($flow,'openxiang')){ - $lbarr = $flow->openxiang(); - if(is_array($lbarr))foreach($lbarr as $k=>$v)$barr[$k]=$v; - } - return returnsuccess($barr); - } - /** - * 鎿嶄綔鑿滃崟 - */ - public function optmenuAction() - { - $num = $this->get('num'); - $xcytype = $this->get('xcytype'); - $mid = (int)$this->get('mid','0'); - $menuid = (int)$this->get('menuid','0'); - $sm = c('check')->onlysql($this->jm->base64decode($this->get('sm'))); - if(isempt($num) || !$xcytype || $mid==0)return returnerror('num isempt'); - $flow = m('flow')->initflow($num,$mid, false); - $msg = $flow->optmenu($menuid,1,$sm); - if($msg!='ok')return returnerror($msg); - return returnsuccess($msg); - } - - /** - * 涓嬭浇鏂囦欢 - */ - public function downurlAction() - { - $id = (int)$this->get('id','0'); - $openid = $this->get('openid'); - if(isempt($openid))return; - if(m('wxxcyus')->rows("`openid`='$openid'")==0)return; - m('file')->show($id, true); - } - - /** - * 杩斿洖鏂囦欢璇︽儏 - */ - public function fileinfoAction() - { - $id = (int)$this->get('id','0'); - $openid = $this->get('openid'); - if(isempt($openid))return returnerror('鏃犳晥openid1'); - if(m('wxxcyus')->rows("`openid`='$openid'")==0)return returnerror('鏃犳晥openid'); - $frs = m('file')->getone($id,'id,filename,filesize,fileext,filepath,filepathout'); - return returnsuccess($frs); - } } \ No newline at end of file