ClientController.php 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035
  1. <?php
  2. Doo::loadCore('auth/DooAuth');
  3. Doo::loadClass('PasswordHash');
  4. Doo::loadClass('client');
  5. Doo::loadClass('auth');
  6. Doo::loadClass('attachment');
  7. Doo::loadClass('attfile');
  8. Doo::loadClass('actmeasure');
  9. Doo::loadClass('contractact');
  10. Doo::loadClass('project');
  11. Doo::loadClass('profile');
  12. Doo::loadClass('numofperact');
  13. Doo::loadClass('measureauditact');
  14. Doo::loadClass('itemfile');
  15. Doo::loadModel('users');
  16. Doo::loadClass('itemmeasurenum');
  17. Doo::loadModelAt('aconfig', 'admin');
  18. Doo::loadClass('sms');
  19. Doo::loadClass('sign');
  20. Doo::loadClass('measureconcerner');
  21. //
  22. // _oo0oo_
  23. // o8888888o
  24. // 88" . "88
  25. // (| -_- |)
  26. // 0\ = /0
  27. // ___/`---'\___
  28. // .' \| |// '.
  29. // / \||| : |||// \
  30. // / _||||| -:- |||||- \
  31. // | | \ - /// | |
  32. // | \_| ''\---/'' |_/ |
  33. // \ .-\__ '-' ___/-. /
  34. // ___'. .' /--.--\ `. .'___
  35. // ."" '< `.___\_<|>_/___.' >' "".
  36. // | | : `- \`.;`\ _ /`;.`/ - ` : | |
  37. // \ \ `_. \_ __\ /__ _/ .-` / /
  38. // =====`-.____`.___ \_____/___.-`___.-'=====
  39. // `=---='
  40. //
  41. //
  42. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. //
  44. // 佛祖保佑 永无BUG
  45. //
  46. /**
  47. * MainController
  48. * Feel free to delete the methods and replace them with your own code.
  49. *
  50. * @author NoNZero
  51. */
  52. class ClientController extends DooController
  53. {
  54. private $data, $sign, $concern, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $modelconfig, $aconfig, $sms, $itemMeasureNum;
  55. private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
  56. private $fileTypeArray = array('台帐附件');
  57. public function __construct()
  58. {
  59. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  60. $this->client = new client();
  61. $this->auth = new Auth();
  62. $this->att = new attachment();
  63. $this->attfile = new attFile();
  64. $this->zip = new ZipArchive();
  65. $this->actmeasure = new actMeasure();
  66. $this->contractact = new Contractact();
  67. $this->project = new Project();
  68. $this->profile = new Profile();
  69. $this->numofperact = new NumofperAct();
  70. $this->measureauditact = new MeasureauditAct();
  71. $this->users = new Users();
  72. $this->itemfile = new ItemFile();
  73. $this->modelconfig = new AConfig();
  74. $this->itemMeasureNum = new ItemMeasureNumpofper();
  75. $this->aconfig = new AConfig();
  76. $this->sign = new signn();
  77. $this->concern = new MeasureConcerner();
  78. $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
  79. }
  80. public function ClientSignin()
  81. {
  82. if (isset($_POST['zhname']) && isset($_POST['zhpass'])) {
  83. echo json_encode(array('status' => FALSE, 'msg' => '登录失败,请更新软件。'), JSON_UNESCAPED_UNICODE);
  84. die;
  85. }
  86. if (isset($_POST['uname']) && isset($_POST['upass'])) {
  87. echo json_encode(array('status' => FALSE, 'msg' => '登录失败,请更新软件。'), JSON_UNESCAPED_UNICODE);
  88. die;
  89. }
  90. if (isset($_POST['v3name']) && isset($_POST['v3name'])) {
  91. echo json_encode(array('status' => FALSE, 'msg' => '登录失败,请更新软件。'), JSON_UNESCAPED_UNICODE);
  92. die;
  93. }
  94. if (!empty($_POST['version'])) {
  95. try {
  96. if ($this->modelconfig->getOne(array('select' => 'onoff', 'asArray' => TRUE))['onoff'] != 1) {
  97. $versionTotal = implode("",explode('.', $_POST['version']));
  98. $StrJson = ($this->modelconfig->getOne(array('select' => 'upgradeinfo', 'asArray' => TRUE))['upgradeinfo']);
  99. $jsonObj = json_decode($StrJson, true);
  100. if ($jsonObj) {
  101. $versionTotalUp = implode("",explode('.', $jsonObj['version']));
  102. $strJson = json_encode(array('status' => 'upgrade', 'msg' => '您的客户端需要升级,请点击确定按钮,下载新版本,并且覆盖安装。', 'url' => $jsonObj['download']), JSON_UNESCAPED_UNICODE);
  103. if ($jsonObj['condition'] == 1) {
  104. if ($versionTotalUp != $versionTotal) {
  105. echo $strJson;
  106. die;
  107. }
  108. }
  109. if ($jsonObj['condition'] == 2) {
  110. if ($versionTotalUp > $versionTotal) {
  111. echo $strJson;
  112. die;
  113. }
  114. }
  115. }
  116. if(isset($_POST['v4name']) && isset($_POST['v4pass'])){
  117. if ($this->auth->login($_POST['v4name'], $_POST['v4pass'])) {
  118. $uinfo = $this->auth->getUinfo();
  119. if (isset($uinfo['isstop']) && $uinfo['isstop'] > 0) {
  120. echo json_encode(array('status' => 'false', 'msg' => '帐号不存在或者密码错误'), JSON_UNESCAPED_UNICODE);
  121. die;
  122. }
  123. if (isset($uinfo['uid'])) {
  124. $userArray = $this->profile->getProWithUid($uinfo['uid']);
  125. $avatarStr = $userArray['avatar'];
  126. if (isset($userArray['userid'])) {
  127. $msgArray = array('uid' => $uinfo['uid'], 'name' => $userArray['name'], 'email' => $uinfo['uemail'], 'ucompany' => $userArray['company'], 'jobtitle' => $userArray['jobs'], 'avatar' => Doo::conf()->APP_URL . $avatarStr);
  128. echo json_encode(array('status' => 'true', 'msg' => '', 'userinfo' => $msgArray), JSON_UNESCAPED_UNICODE);
  129. die;
  130. }
  131. }
  132. } else {
  133. echo json_encode(array('status' => 'false', 'msg' => '帐号不存在或者密码错误'), JSON_UNESCAPED_UNICODE);
  134. die;
  135. }
  136. }else{
  137. echo json_encode(array('status' => 'false', 'msg' => '参数错误'), JSON_UNESCAPED_UNICODE);
  138. die;
  139. }
  140. } else {
  141. echo json_encode(array('status' => 'false', 'msg' => '该计量支付已关闭,请联系相关管理人员。'), JSON_UNESCAPED_UNICODE);
  142. die;
  143. }
  144. } catch (Exception $exc) {
  145. }
  146. } else {
  147. echo json_encode(array('status' => 'false', 'msg' => '参数错误'), JSON_UNESCAPED_UNICODE);
  148. die;
  149. }
  150. }
  151. // 创建标段
  152. // 参数:用户ID,创建名称,KEY
  153. function ClientCreatmeasure()
  154. {
  155. if (isset($this->params['uid']) && $this->params['uid'] && isset($this->params['bname']) && $this->params['bname'] && $this->params['ckey'] && isset($this->params['ckey'])) {
  156. $retval = $this->contractact->getPidWithKey($this->params['ckey']);
  157. if (isset($retval['pid'])) {
  158. $pArray = $this->project->getRowByPid($retval['pid']);
  159. if (isset($this->params['uid']) && ($this->params['uid'] == $pArray['uid'])) {
  160. $status = array('status' => FALSE, 'msg' => '业主不能作为编制人新建标段!');
  161. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  162. die();
  163. }
  164. $id = $this->actmeasure->insertMeasure(intval($this->params['uid']), $retval['pid'], $retval['stid'], iconv('GBK', 'UTF-8', $this->params['bname']));
  165. $this->measureauditact->insertMeasureAudit($pArray['pid'], 0, $pArray['uid'], 0, $id, $retval['stid'], 1, 'uncheck', 1); //加入业主
  166. $uArray = $this->profile->getProWithUid($retval['uid']);
  167. $strAvatar = $this->auth->getAvatar($uArray['userid']);
  168. $createArray = array('catid' => $id, 'name' => $uArray['name'], 'avatar' => $strAvatar, 'jobs' => $uArray['jobs'], 'company' => $uArray['company'], 'coninfo' => array('phone' => $uArray['phone'], 'mobile' => $uArray['mobile'], 'qq' => $uArray['qq']), 'pname' => $pArray['pname'], 'ptype' => $retval['stname'], 'ownuid' => $pArray['uid'], 'pnameid' => $pArray['pid'], 'ptypeid' => $retval['stid']);
  169. $status = array('status' => TRUE, 'msg' => '', 'createinfo' => $createArray);
  170. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  171. die();
  172. } else {
  173. $status = array('status' => FALSE, 'msg' => 'The key is error');
  174. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  175. die();
  176. }
  177. } else {
  178. $status = array('status' => FALSE, 'msg' => 'error_create');
  179. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  180. die();
  181. }
  182. }
  183. // 编制人审批第一期时 开始审批第一期时候调用ll
  184. public function ClientPeriod()
  185. {
  186. // TODO:上报数据
  187. // TODO:每期更新数据时候和上传时候要查询当前进行期数的第几次一并写入数据库
  188. if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
  189. $fp = $this->upfile('upfile');
  190. if (isset($fp[0]['filepath'])) {
  191. /**
  192. * 增加上传压缩包md5检测机制
  193. */
  194. $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  195. if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
  196. $status = array('status' => 'FALSE', 'msg' => '期数数据上传失败,请重新上传');
  197. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  198. die();
  199. }
  200. $res = $this->zip->open(Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  201. $extPath = pathinfo($fp[0]['filepath']);
  202. $extPathdir = Doo::conf()->SITE_PATH . $extPath['dirname'] . '/' . $extPath['filename'];
  203. if ($res === TRUE) {
  204. if (!$this->dir_create($extPathdir)) {
  205. $status = array('status' => 'FALSE', 'msg' => '期数数据上传失败');
  206. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  207. die();
  208. }
  209. $this->zip->extractTo($extPathdir);
  210. $this->zip->close();
  211. }
  212. $countArray = json_decode(file_get_contents($extPathdir . '/' . 'JsonFile_Common.json'), TRUE, JSON_UNESCAPED_UNICODE);
  213. if (!isset($countArray)) {
  214. $status = array('status' => 'FALSE', 'msg' => '期数汇总数据上传失败');
  215. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  216. die();
  217. }
  218. $this->actmeasure->updateCon($this->params['tenderid'], $countArray['TotalPrice']);
  219. $pmArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  220. if (isset($pmArray['pmid'])) {
  221. // 由于不通过功能数据表记录重复写入时要考虑当前是第几次审批
  222. $intMaxTimes = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
  223. if (isset($intMaxTimes['times']) && ($intMaxTimes['times'] >= 0)) {
  224. $iniTimes = $intMaxTimes['times'] + 1;
  225. } else {
  226. $iniTimes = 0;
  227. }
  228. // 写入第一期
  229. $mpid = $this->numofperact->insert($pmArray['pid'], $this->params['userid'], $this->params['tenderid'], $pmArray['stid'], $this->params['phaseno'], $countArray['BQHTJL'], $countArray['BQSLBGJL'], $countArray['JZSQLJWC'], $countArray['BQWCJL'], $countArray['LJWCJL'], $iniTimes);
  230. // 更新审批人MPID
  231. $this->measureauditact->updateAuditorMPID($mpid, $this->params['tenderid'], $this->params['phaseno'], $iniTimes);
  232. // 设置审批人状态
  233. $firstAuditor = $this->measureauditact->getFirstAuditor($this->params['tenderid'], $this->params['phaseno'], $iniTimes);
  234. if (isset($firstAuditor)) {
  235. if ($firstAuditor['mastatus'] == 'uncheck') {
  236. $retVal = $this->measureauditact->updateMastatus($firstAuditor['maid']);
  237. if ($retVal > 0) {
  238. // SMS Start
  239. $verifyUserArray = $this->profile->getVerifiedMobile($firstAuditor['auditoruid']);
  240. $pmnameArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  241. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
  242. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  243. }
  244. // SMS End
  245. }
  246. }
  247. }
  248. }
  249. if ($mpid > 0) {
  250. if ($this->attfile->insertFile($pmArray['pid'], $pmArray['stid'], $mpid, $this->params['tenderid'], $this->params['phaseno'], $this->params['userid'], $fp[0]['filepath'], 0, $_POST['MD5_JL'], $iniTimes, 2)) {
  251. $infostatus = 0;
  252. $pmArray = $this->numofperact->getRowTender($this->params['tenderid']);
  253. if ($pmArray) {
  254. $countTotal = count($pmArray);
  255. $ownerStatusArray = $this->measureauditact->getStatusTender($pmArray[0]['pmid'], $pmArray[0]['numpname']);
  256. if ($ownerStatusArray) {
  257. $infostatus = $this->statusArray[$ownerStatusArray['mastatus']];
  258. }
  259. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('curr' => $pmArray[0]['numpname'], 'infostatus' => $infostatus, 'total' => $countTotal)), JSON_UNESCAPED_UNICODE);
  260. die();
  261. } else {
  262. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('curr' => 1, 'infostatus' => 1, 'total' => 1)), JSON_UNESCAPED_UNICODE);
  263. die();
  264. }
  265. } else {
  266. $status = array('status' => 'FALSE', 'msg' => '期数上传失败');
  267. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  268. die();
  269. }
  270. } else {
  271. $status = array('status' => 'FALSE', 'msg' => '期数上传失败');
  272. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  273. die();
  274. }
  275. } else {
  276. $status = array('status' => 'FALSE', 'msg' => '文件上传失败,请重试');
  277. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  278. die();
  279. }
  280. } else {
  281. $status = array('status' => 'FALSE', 'msg' => '上传参数错误');
  282. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  283. die();
  284. }
  285. }
  286. /**
  287. * 获取标段状态信息(由于加入了)
  288. * 每个标段只有一期在进行中 group by?
  289. *
  290. * 查询标段的审批状态可以根据业主的审批依据来查询
  291. * 如果除业主意外的人审批状态为未通过怎么处理
  292. */
  293. public function getMAStatus()
  294. {
  295. // curr:当前期数,status:当前状态,total:总期数
  296. // 参数catid
  297. if (isset($this->params['tenderid'])) {
  298. $pmArray = $this->numofperact->getRowTenderCurr($this->params['tenderid']);
  299. $countTotal = count($pmArray);
  300. $ownerStatus = NULL;
  301. $isUnCheck = TRUE;
  302. $ownerStatusArray = $this->measureauditact->getStatusTen($pmArray[0]['pmid'], $pmArray[0]['numpname']);
  303. // if (isset($ownerStatusArray))
  304. // if (($ownerStatusArray[0]['last'] == 1) && ($ownerStatusArray[0]['mastatus'] == 'checked')) {
  305. // $ownerStatus = 'checked';
  306. // } else {
  307. // $ownerStatus = 'checking';
  308. // }
  309. $statusArray = $this->numofperact->getMaxRowStatus($pmArray[0]['pmid'], $pmArray[0]['numpname']);
  310. $ownerStatus = $statusArray['currstatus'];
  311. // foreach ($ownerStatusArray as $kk => $vv) {
  312. // if (($vv['last'] == 1) && ($vv['mastatus'] == 'checked')) {
  313. // $ownerStatus = 'checked';
  314. // } else {
  315. // $ownerStatus = 'checking';
  316. // }
  317. // }
  318. $projectArray = $this->project->getRowByPid($ownerStatusArray[0]['pid']);
  319. $stArray = $this->contractact->getRowByStid($ownerStatusArray[0]['stid']);
  320. $profileArray = $this->profile->getProWithUid($projectArray['uid']);
  321. $auditArray = $this->measureauditact->getAuditUserRedo($pmArray[0]['pmid'], $pmArray[0]['numpname']);
  322. if (isset($auditArray[0]['auditoruid'])) {
  323. foreach ($auditArray as $key => $value) {
  324. $userArray = $this->profile->getProWithUid($value['auditoruid']);
  325. $auditcontent = !empty($value['auditcontent']) ? $value['auditcontent'] : '';
  326. // $finalStatus = $value['mastatus'];
  327. if ($value['mastatus'] != 'uncheck') {
  328. $isUnCheck = FALSE;
  329. }
  330. if ($value['audittime'] > 0) {
  331. $value['audittime'] = date('Y-m-d', $value['audittime']);
  332. }
  333. $auditInfo[] = array('uid' => $userArray['userid'], 'name' => $userArray['name'], 'company' => $userArray['company'], 'jobs' => $userArray['jobs'], 'avatar' => $this->auth->getAvatar($value['auditoruid']), 'mastatus' => $this->statusArray[$value['mastatus']], 'CheckerMemo' => $auditcontent, 'onlineaudit' => $value['onlineaudit'], 'audittime' => $value['audittime']);
  334. }
  335. }
  336. if ($ownerStatusArray) {
  337. if ($isUnCheck) {
  338. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('curr' => $pmArray[0]['numpname'], 'infostatus' => $this->statusArray['uncheck'], 'total' => "$countTotal", 'proName' => $projectArray['pname'], 'stName' => $stArray['stname'], 'name' => $profileArray['name'], 'company' => $profileArray['company'], 'jobs' => $profileArray['jobs']), 'auditinfo' => $auditInfo), JSON_UNESCAPED_UNICODE);
  339. } else {
  340. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('curr' => $pmArray[0]['numpname'], 'infostatus' => $this->statusArray[$ownerStatus], 'total' => "$countTotal", 'proName' => $projectArray['pname'], 'stName' => $stArray['stname'], 'name' => $profileArray['name'], 'company' => $profileArray['company'], 'jobs' => $profileArray['jobs']), 'auditinfo' => $auditInfo), JSON_UNESCAPED_UNICODE);
  341. }
  342. die();
  343. } else {
  344. echo json_encode(array('status' => 'FALSE', 'msg' => '标段状态查询不存在'), JSON_UNESCAPED_UNICODE);
  345. die();
  346. }
  347. } else {
  348. echo json_encode(array('status' => 'FALSE', 'msg' => '标段状态查询参数错误'), JSON_UNESCAPED_UNICODE);
  349. die();
  350. }
  351. }
  352. public function getUserSearch()
  353. {
  354. if (isset($_POST['uemail'])) {
  355. $retval = $this->users->getOne(array('where' => 'uemail=?', 'param' => array($_POST['uemail']), 'asArray' => TRUE));
  356. if (isset($retval['uid'])) {
  357. $proArray = $this->profile->getProWithUid($retval['uid']);
  358. if (isset($proArray['userid'])) {
  359. $strAvatar = $this->auth->getAvatar($proArray['userid']);
  360. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('uid' => $proArray['userid'], 'avatar' => $strAvatar, 'name' => $proArray['name'], 'jobs' => $proArray['jobs'], 'company' => $proArray['company'])), JSON_UNESCAPED_UNICODE);
  361. die();
  362. } else {
  363. echo json_encode(array('status' => 'FALSE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  364. die();
  365. }
  366. } else {
  367. echo json_encode(array('status' => 'FALSE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  368. die();
  369. }
  370. } else {
  371. echo json_encode(array('status' => 'FALSE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  372. die();
  373. }
  374. }
  375. /**
  376. * 获取指定标段指定期数{默认提取重做后最新一期的}
  377. * 单击获取项目相关审批人员和状态
  378. * sectionid:标段ID periodid:期数
  379. * TODO:如果审批人的期数或者次数与标段期数或者次数存在不对应情况的处理
  380. */
  381. public function getAlluserMeasure()
  382. {
  383. if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
  384. // error_log(var_export($this->params, TRUE), 3, '/opt/html/jlzftest/data/' . time());
  385. // 先判断是否存在期数问题
  386. // 然后再判断是否存在次数不匹配
  387. // $intNum = $this->numofperact->getCountNumpname($this->params['tenderid'], $this->params['phaseno']);
  388. // // 如果期数是第一期期数必须大于一,否则减一为无效数据 ,为0表示这期为做上报没有产生记录
  389. // if (( $this->params['phaseno'] > 1) && ($intNum == 0)) {// 提取上一期的数据
  390. // // 提取期数减一
  391. // $intLastTimes = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno'] - 1)['times'];
  392. // $uinfoTmpArray = $this->measureauditact->getAllAudit($this->params['tenderid'], $this->params['phaseno'] - 1, $intLastTimes);
  393. // } else {
  394. // $IntMaxRedoTimes = $this->measureauditact->getMaxTimes($this->params['tenderid'], $this->params['phaseno'])['maxtimes'];
  395. // $intTimes = $this->numofperact->getCountTimes($this->params['tenderid'], $this->params['phaseno'], $IntMaxRedoTimes);
  396. // if (($intTimes == 0) && ($IntMaxRedoTimes > 0)) {
  397. // $lastTimes = $IntMaxRedoTimes - 1;
  398. // $uinfoTmpArray = $this->measureauditact->getAllAudit($this->params['tenderid'], $this->params['phaseno'], $lastTimes);
  399. // } else {
  400. // $uinfoTmpArray = $this->measureauditact->getAllAudit($this->params['tenderid'], $this->params['phaseno'], $IntMaxRedoTimes);
  401. // }
  402. // }
  403. $uinfoTmpArray = $this->measureauditact->getAlluserMeasureAudit($this->params['tenderid'], $this->params['phaseno']);
  404. if ($uinfoTmpArray) {
  405. foreach ($uinfoTmpArray as $key => $value) {
  406. $uArray = $this->profile->getProWithUid($value['auditoruid']);
  407. $uinfoArray[$key]['name'] = $uArray['name'];
  408. $uinfoArray[$key]['company'] = $uArray['company'];
  409. $uinfoArray[$key]['jobs'] = $uArray['jobs'];
  410. $uinfoArray[$key]['mastatus'] = $this->statusArray[$value['mastatus']];
  411. $uinfoArray[$key]['uid'] = $value['auditoruid'];
  412. $uinfoArray[$key]['avatar'] = $this->auth->getAvatar($value['auditoruid']);
  413. $uinfoArray[$key]['CheckerMemo'] = !empty($value['auditcontent']) ? $value['auditcontent'] : '';
  414. $uinfoArray[$key]['onlineaudit'] = $value['onlineaudit'];
  415. if ($value['audittime'] > 0) {
  416. $uinfoArray[$key]['audittime'] = date('Y-m-d', $value['audittime']);
  417. } else {
  418. $uinfoArray[$key]['audittime'] = '0';
  419. }
  420. }
  421. } else {
  422. echo json_encode(array('status' => FALSE, 'msg' => '用户列表不存在'), JSON_UNESCAPED_UNICODE);
  423. die();
  424. }
  425. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $uinfoArray), JSON_UNESCAPED_UNICODE);
  426. die();
  427. } else {
  428. echo json_encode(array('status' => FALSE, 'msg' => '错误'), JSON_UNESCAPED_UNICODE);
  429. die();
  430. }
  431. }
  432. //
  433. //
  434. // 配置审批人时候还没有创建标段所以没有MPID存在
  435. function addAuditMeasure()
  436. {
  437. // 必须检查期数是否存在
  438. // 标段ID 当前登录 审批人ID
  439. // 检测是否重复写入 && ($_POST['creatoruid'] > 0)
  440. // TODO: 增加多次审批人变更需求,调整审批人增加、删除接口
  441. // 当前操作的是否为最新一期还是最新一期加一(项目进行中时,不能编辑审批人,所以直接加一)
  442. // 大于一次重做的时候,自动复制编制人和所有审批人次数加一
  443. if (isset($_POST['pmid']) && isset($_POST['creatoruid']) && isset($_POST['auditoruid']) && isset($_POST['numpname'])) {
  444. $IntMaxTimes = $this->measureauditact->getMaxTimesInt($_POST['pmid'], $_POST['numpname']); // 根据标段PMID,期数numpname,获取目前重做次数
  445. if ($IntMaxTimes > 0) {
  446. $inTimes = $IntMaxTimes;
  447. } else {
  448. $inTimes = 0;
  449. }
  450. $pmArray = $this->actmeasure->getRowByPmid($_POST['pmid']);
  451. try {
  452. if ($this->measureauditact->insertMeasureAudit($pmArray['pid'], $_POST['creatoruid'], $_POST['auditoruid'], 0, $_POST['pmid'], $pmArray['stid'], $_POST['numpname'], 'uncheck', 2, $inTimes) > 0) {
  453. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => ''), JSON_UNESCAPED_UNICODE);
  454. die();
  455. }
  456. } catch (PDOException $e) {// 判断异常类型,提示不同错误信息
  457. echo json_encode(array('status' => FALSE, 'msg' => '配置审批人错误'), JSON_UNESCAPED_UNICODE);
  458. }
  459. } else {
  460. echo json_encode(array('status' => FALSE, 'msg' => '配置审批人参数错误'), JSON_UNESCAPED_UNICODE);
  461. die();
  462. }
  463. }
  464. /**
  465. * 删除审批用户
  466. */
  467. function delAuditMeasure()
  468. {
  469. if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
  470. // 判断当前标段期数审批状态,决定是否继续执行
  471. $IntMaxTimes = $this->measureauditact->getMaxTimesInt($this->params['tenderid'], $this->params['phaseno']); // 根据标段PMID,期数numpname,获取目前重做次数
  472. if ($IntMaxTimes > 0) {
  473. $inTimes = $IntMaxTimes;
  474. $intHasCount = $this->numofperact->hasTheTimesRow($this->params['tenderid'], $this->params['phaseno'], $inTimes);
  475. if (isset($intHasCount) && ($intHasCount > 0)) {
  476. echo json_encode(array('status' => FALSE, 'msg' => '此标段状态,禁止删除审批人员'), JSON_UNESCAPED_UNICODE);
  477. die();
  478. }
  479. } else {
  480. $inTimes = 0;
  481. }
  482. try {
  483. $this->measureauditact->delAuditUserTimes($this->params['tenderid'], $this->params['phaseno'], $this->params['userid'], $inTimes);
  484. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  485. die();
  486. } catch (PDOException $e) {// 判断异常类型,提示不同错误信息
  487. echo json_encode(array('status' => FALSE, 'msg' => '删除审批人错误'), JSON_UNESCAPED_UNICODE);
  488. }
  489. } else {
  490. echo json_encode(array('status' => FALSE, 'msg' => '删除审批人员参数错误'), JSON_UNESCAPED_UNICODE);
  491. die();
  492. }
  493. }
  494. // 查询状态变更为审批中,已审批中为查询依据
  495. function checkMeasureStatus()
  496. {
  497. if (isset($_POST['sectionid']) && isset($_POST['periodid'])) {
  498. $mpArray = $this->numofperact->getRow($_POST['sectionid'], $_POST['periodid']);
  499. $maArray = $this->measureauditact->getAlluserMeasureAudit($_POST['sectionid'], $_POST['periodid']);
  500. foreach ($maArray as $key => $value) {
  501. if ($value['mastatus'] == 'uncheck') {
  502. $mastatus = $this->statusArray[$value['mastatus']];
  503. }
  504. }
  505. if (isset($mpArray['mpid'])) {
  506. echo json_encode(array('status' => TRUE, 'msg' => '', 'isexist' => TRUE, 'checkstatus' => $mastatus), JSON_UNESCAPED_UNICODE);
  507. die();
  508. } else {
  509. echo json_encode(array('status' => TRUE, 'msg' => '', 'isexist' => FALSE), JSON_UNESCAPED_UNICODE);
  510. die();
  511. }
  512. } else {
  513. echo json_encode(array('status' => FALSE, 'msg' => '标段信息不正确'), JSON_UNESCAPED_UNICODE);
  514. die();
  515. }
  516. }
  517. // 根据用户查询参与的标段信息
  518. // 参数为1时,当提交的附件中有重做记录时,提取记录未经过排重处理,出现重复结果。
  519. // api/client/user/get/15/allproject 此接口也有同样问题
  520. function getAuditProject()
  521. {
  522. // TODO:可以通过SQL直接查询出来
  523. if (isset($_POST['audituid']) && isset($_POST['RequestType'])) {
  524. $downfileurl = NULL;
  525. /**
  526. * 只查询审批中状态的记录
  527. * 然后根据每天记录所在的标段、期数、创建人查询所有此次所有审批人记录、为了判断
  528. * 判断此用户是第几个审批的人
  529. * 直接提取状态为未审批、审批中的
  530. * 未审批(没有到该审批人)
  531. * 审批中(出现在第一个)
  532. * 上传审批时候先遍历所有审批提交文件的状态并设置为旧文件状态
  533. * 然后写入新审批的文件路径等信息
  534. * 审批同时上传审批文件并设置审批表的状态做更改
  535. *
  536. */
  537. if ($_POST['RequestType'] == 1) {
  538. /**
  539. * 功能描述:
  540. * 参数1功能为,取得与当前用户相关的待审批状态的所有进行中的标段期数、最新一次的记录
  541. * 根据用户ID查询编制人和审批人参与的正在进行中的项目,进行中的项目状态为uncheck,checking
  542. * 由于·uncheck状态不能准确反映出其他用户操作对所属标段操作产生的的状态{比如:其他用户操作标段状态为(未通过【打回重做】)}、要排除这种情况
  543. * 还有一种情况为编制人编制项目时,审批人列表已经添加审批人,但是项目没有提交,没有项目文件,此时应根据有没有项目文件进行过滤。
  544. *
  545. * ??此ID为编制人或者为审批人时
  546. */
  547. // 第一步:根据用户ID,查询此用户参与的所有标段{根据最大期数【由于期数是递进关系只获取最大值】、最大次数【由于次数是递进关系只获取最大值】作为条件参数进行查询记录}
  548. $mpArray = $this->measureauditact->getCheckedRowbyUID2($_POST['audituid']); // 通过pmid,numpname分组获取参与的记录
  549. if (isset($mpArray)) {
  550. $statusArray = array('uncheck', 'checking');
  551. foreach ($mpArray as $key => $value) {
  552. /**
  553. * 根据审批ID查询所在标段期数
  554. * 然后去附件表根据标段ID 期数 是否新标志字段去查询最新的文件
  555. * 项目名称 项目类型
  556. *
  557. *
  558. * 此处现在是以创建者ID和审批人ID做关联来做判断
  559. * 判断上一个人的审批状态来提取记录
  560. *
  561. * 变更为一个用户添加所有人
  562. *
  563. */
  564. // $maxtimes = $this->attfile->getMaxTimes2($value['pmid'], $value['numpname']);
  565. $numStatusArray = $this->numofperact->getRow($value['pmid'], $value['numpname'], $value['times']);
  566. if (in_array($numStatusArray['currstatus'], $statusArray)) {
  567. $newfileArray = $this->attfile->getNewLast($value['pmid'], $value['numpname'], $value['times']);
  568. if (isset($newfileArray['filepath'])) {
  569. $projectArray = $this->project->getRowByPid($newfileArray['pid']);
  570. $pmidArray = $this->actmeasure->getRowByPmid($value['pmid']);
  571. $stArray = $this->contractact->getRowByStid($newfileArray['stid']);
  572. // $auditArray = $this->measureauditact->getLastNewRowInfo($value['pmid'], $value['numpname'], $_POST['audituid']);
  573. $pathinfo = pathinfo($newfileArray['filepath']);
  574. $downfileurl[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $projectArray['pname'], 'stName' => $stArray['stname'], 'MD5_Jl' => $newfileArray['filehashcode'], 'tenderstatus' => $this->statusArray[$value['mastatus']], 'tenderid' => $value['pmid'], 'pnameid' => $projectArray['pid'], 'ptypeid' => $stArray['stid'], 'audituidstatus' => $this->statusArray[$value['mastatus']], 'bianzhirenuid' => $pmidArray['uid'], 'tenderName' => $pmidArray['pmname']);
  575. }
  576. }
  577. }
  578. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downfileurl), JSON_UNESCAPED_UNICODE);
  579. die();
  580. } else {
  581. echo json_encode(array('status' => FALSE, 'msg' => '暂时无审批信息'), JSON_UNESCAPED_UNICODE);
  582. die();
  583. }
  584. }
  585. if ($_POST['RequestType'] == 2) {
  586. /**
  587. * {
  588. * "downurl": "http://d.jl.smartcost.com.cn/data/2015/0608/20150608043245691/ProjectFile.rmf", 最新一期最新一次的文件
  589. * "proName": "巫溪县前进桥", 项目名称
  590. * "stName": "巫溪县 前进桥(终)", 合同段名称
  591. * "MD5_Jl": "7cf05dccc6ad45b2d78f476a3388c3b2", 最新一期最新一次的文件hash code
  592. * "tenderstatus": "2", 标段状态
  593. * "tenderid": "234", 标段ID
  594. * "pnameid": "79", 项目ID
  595. * "ptypeid": "96", 合同段ID
  596. * "audituidstatus": "2", 当前用户审批状态
  597. * "bianzhirenuid": "59", 编制人UID
  598. * "tenderName": "巫溪县 前进桥 终" 标段名称
  599. * }
  600. */
  601. // TODO::不同角色提取条件不同是否使用audituid 作为当前用户提取条件,容易产生冲突
  602. if (!isset($_POST['audituid']) || !($_POST['audituid'] > 0)) {
  603. echo json_encode(array('status' => FALSE, 'msg' => '返回指定用户参与的所有项目参数错误'), JSON_UNESCAPED_UNICODE);
  604. die();
  605. }
  606. // 三个角色数据合并返回
  607. // 返回最新一期的项目文件
  608. // 业主
  609. // 业主查询参与的项目时
  610. // TODO::业主是否参与审批?如果参与提取哪个参与者的审批状态?
  611. $userproArray = $this->project->getRowUid($_POST['audituid']);
  612. $newattArray = $retArray = $hashArray = NULL;
  613. foreach ($userproArray as $upk => $upv) {
  614. $attArray = $this->attfile->getPmidGroup($upv['pid']);
  615. $attaArray = NULL;
  616. foreach ($attArray as $akey => $avalue) {
  617. $attaArray[] = $this->attfile->getLastNumTimes($avalue['pmid']);
  618. }
  619. foreach ($attaArray as $attk => $attv) {
  620. $attfileArray = $this->contractact->getRowByStid($attv['stid']);
  621. $pmidArray = $this->actmeasure->getRowByPmid($attv['pmid']);
  622. $numArray = $this->numofperact->getRow($attv['pmid'], $attv['numpname'], $attv['times']);
  623. $auditArray = $this->measureauditact->getLastNewRowInfo($attv['pmid'], $attv['numpname'], $_POST['audituid']);
  624. $pathinfo = pathinfo($attv['filepath']);
  625. if (isset($pathinfo['dirname'])) {
  626. $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $upv['pname'], 'stName' => $attfileArray['stname'], 'MD5_Jl' => $attv['filehashcode'], 'tenderstatus' => $this->statusArray[$numArray['currstatus']], 'tenderid' => $attv['pmid'], 'pnameid' => $upv['pid'], 'ptypeid' => $attfileArray['stid'], 'audituidstatus' => $this->statusArray[$auditArray['mastatus']], 'bianzhirenuid' => $pmidArray['uid'], 'tenderName' => $pmidArray['pmname']);
  627. $hashArray[] = md5(Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf' . $upv['pname'] . $attfileArray['stname'] . $attv['filehashcode'] . $this->statusArray[$numArray['currstatus']] . $attv['pmid'] . $upv['pid'] . $attfileArray['stid'] . $this->statusArray[$auditArray['mastatus']] . $pmidArray['uid'] . $pmidArray['pmname']);
  628. }
  629. }
  630. }
  631. // 施工
  632. $measureArray = $this->actmeasure->getPmidRow($_POST['audituid']);
  633. if (isset($measureArray) && $measureArray) {
  634. $attfileArray = $stidArray = NULL;
  635. foreach ($measureArray as $key => $value) {
  636. $proArray = $this->project->getRowByPid($value['pid']);
  637. $conArray = $this->contractact->getRowByStid($value['stid']);
  638. $attfileArray = $this->attfile->getLastNewProfile2($value['pmid']);
  639. $pmidArray = $this->actmeasure->getRowByPmid($value['pmid']);
  640. $statusArray = $this->numofperact->getMaxRowStatus($attfileArray['pmid'], $attfileArray['numpname']);
  641. $auditArray = $this->measureauditact->getLastNewRowInfo($attfileArray['pmid'], $attfileArray['numpname'], $_POST['audituid']);
  642. $pathinfo = pathinfo($attfileArray['filepath']);
  643. if (!$auditArray['mastatus'])
  644. $auditStr = 'uncheck';
  645. else
  646. $auditStr = $auditArray['mastatus'];
  647. if (isset($pathinfo['dirname'])) {
  648. $hashstr = md5(Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf' . $proArray['pname'] . $conArray['stname'] . $attfileArray['filehashcode'] . $this->statusArray[$statusArray['currstatus']] . $value['pmid'] . $proArray['pid'] . $conArray['stid'] . $this->statusArray[$auditStr] . $pmidArray['uid'] . $pmidArray['pmname']);
  649. if (!in_array($hashstr, $hashArray)) {
  650. $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $conArray['stname'], 'MD5_Jl' => $attfileArray['filehashcode'], 'tenderstatus' => $this->statusArray[$statusArray['currstatus']], 'tenderid' => $value['pmid'], 'pnameid' => $proArray['pid'], 'ptypeid' => $conArray['stid'], 'audituidstatus' => $this->statusArray[$auditStr], 'bianzhirenuid' => $pmidArray['uid'], 'tenderName' => $pmidArray['pmname']);
  651. $hashArray[] = $hashstr;
  652. }
  653. }
  654. }
  655. }
  656. // 审批 是否只提取最新一期?
  657. $pmidGroupArray = $this->measureauditact->getPmidGroup($_POST['audituid']);
  658. /**
  659. * 从审批人列表中提取记录时,如果项目进行到新开一次或者一期数据,但是上报人并未上报数据,(犹豫逻辑上机制导致,先创建审批人再通过上报人上报数据才能产生新一期)
  660. * 这时,上报人查询到的数据就为空。
  661. * 如果没有最新一次上报数据(可否提取2期上报数据?即便是能下载也不能打开,因为上一期数据的审批人数或者状态,可能与最新一期的审批人状态不同,然后软件报错)
  662. */
  663. $retval = null;
  664. foreach ($pmidGroupArray as $gkey => $gvalue) {
  665. $retval[] = $this->measureauditact->getLastNumTimes($gvalue['pmid'], $_POST['audituid']);
  666. }
  667. foreach ($retval as $spkey => $spvalue) {
  668. $pathinfo = null;
  669. $proArray = $this->project->getRowByPid($spvalue['pid']);
  670. $conArray = $this->contractact->getRowByStid($spvalue['stid']);
  671. $pmidArray = $this->actmeasure->getRowByPmid($spvalue['pmid']);
  672. /**
  673. * 两种情况 一种情况是 新建一期 还有一种是审批未通过重做 这两种未提交
  674. */
  675. $intNum = $this->numofperact->getCountNumpname($spvalue['pmid'], $spvalue['numpname']);
  676. // 如果期数是第一期期数必须大于一,否则减一为无效数据 ,为0表示这期为做上报没有产生记录
  677. if (($spvalue['numpname'] > 1) && ($intNum == 0)) {// 提取上一期的数据
  678. // 提取期数减一
  679. $intLastTimes = $this->numofperact->getMaxTimes($spvalue['pmid'], $spvalue['numpname'] - 1)['times'];
  680. $numstatusArray = $this->numofperact->getRow($spvalue['pmid'], $spvalue['numpname'] - 1, $intLastTimes); //获取上一期最新一次的状态
  681. } else {
  682. $intTimes = $this->numofperact->getCountTimes($spvalue['pmid'], $spvalue['numpname'], $spvalue['times']);
  683. if (($intTimes == '0') && $spvalue['times'] > 0) {
  684. $numstatusArray = $this->numofperact->getRow($spvalue['pmid'], $spvalue['numpname'], $spvalue['times'] - 1);
  685. } else {// 当创建第一次的时候也会为空,所以下方加了判断
  686. $numstatusArray = $this->numofperact->getRow($spvalue['pmid'], $spvalue['numpname'], $spvalue['times']);
  687. }
  688. }
  689. $afArray = $this->attfile->getLastNewProfile2($spvalue['pmid']); // 由于始终提取最新一期所以不用放入判断情况中
  690. $auditArray = $this->measureauditact->getLastNewRowInfo($spvalue['pmid'], $spvalue['numpname'], $_POST['audituid']);
  691. $pathinfo = pathinfo($afArray['filepath']);
  692. if ($numstatusArray && $auditArray) { // 如果重做审批人有变更,根据审批状态判断是否存在该审批人,不存在则不显示此条记录
  693. $hashstr = md5(Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf' . $proArray['pname'] . $conArray['stname'] . $afArray['filehashcode'] . $this->statusArray[$numstatusArray['currstatus']] . $spvalue['pmid'] . $proArray['pid'] . $conArray['stid'] . $this->statusArray[$auditArray['mastatus']] . $pmidArray['uid'] . $pmidArray['pmname']);
  694. if (!in_array($hashstr, $hashArray)) {
  695. $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $conArray['stname'], 'MD5_Jl' => $afArray['filehashcode'], 'tenderstatus' => $this->statusArray[$numstatusArray['currstatus']], 'tenderid' => $spvalue['pmid'], 'pnameid' => $proArray['pid'], 'ptypeid' => $conArray['stid'], 'audituidstatus' => $this->statusArray[$auditArray['mastatus']], 'bianzhirenuid' => $pmidArray['uid'], 'tenderName' => $pmidArray['pmname']);
  696. $hashArray[] = $hashstr;
  697. }
  698. }
  699. }
  700. //标段关注人
  701. $concernArray = $this->concern->getRowbyUid($_POST['audituid']);
  702. if (isset($concernArray) && !empty($concernArray)) {
  703. $attfileArray = $stidArray = NULL;
  704. foreach ($concernArray as $key => $value) {
  705. $proArray = $this->project->getRowByPid($value['pid']);
  706. $conArray = $this->contractact->getRowByStid($value['stid']);
  707. $attfileArray = $this->attfile->getLastNewProfile2($value['pmid']);
  708. $pmidArray = $this->actmeasure->getRowByPmid($value['pmid']);
  709. $statusArray = $this->numofperact->getMaxRowStatus($attfileArray['pmid'], $attfileArray['numpname']);
  710. $auditArray = $this->measureauditact->getLastNewRowInfo($attfileArray['pmid'], $attfileArray['numpname'], $_POST['audituid']);
  711. $pathinfo = pathinfo($attfileArray['filepath']);
  712. if (!$auditArray['mastatus'])
  713. $auditStr = 'uncheck';
  714. else
  715. $auditStr = $auditArray['mastatus'];
  716. if (isset($pathinfo['dirname'])) {
  717. $hashstr = md5(Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf' . $proArray['pname'] . $conArray['stname'] . $attfileArray['filehashcode'] . $this->statusArray[$statusArray['currstatus']] . $value['pmid'] . $proArray['pid'] . $conArray['stid'] . $this->statusArray[$auditStr] . $pmidArray['uid'] . $pmidArray['pmname']);
  718. if (!in_array($hashstr, $hashArray)) {
  719. $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $conArray['stname'], 'MD5_Jl' => $attfileArray['filehashcode'], 'tenderstatus' => $this->statusArray[$statusArray['currstatus']], 'tenderid' => $value['pmid'], 'pnameid' => $proArray['pid'], 'ptypeid' => $conArray['stid'], 'audituidstatus' => $this->statusArray[$auditStr], 'bianzhirenuid' => $pmidArray['uid'], 'tenderName' => $pmidArray['pmname']);
  720. $hashArray[] = $hashstr;
  721. }
  722. }
  723. }
  724. }
  725. // $dd = NULL;
  726. // if (isset($retArray))
  727. // $dd = $this->array_unique_fb($retArray);
  728. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $retArray), JSON_UNESCAPED_UNICODE);
  729. }
  730. }
  731. }
  732. //二维数组去掉重复值 并保留键值
  733. function array_unique_fb($array2D)
  734. {
  735. $key = array();
  736. foreach ($array2D as $k => $v) {
  737. if (empty($key))
  738. $key = array_keys($v); //记录数组的KEY
  739. $v = join(",", $v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
  740. $temp[$k] = $v;
  741. }
  742. $temp = array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
  743. foreach ($temp as $k => $v) {
  744. $array = explode(",", $v); //再将拆开的数组重新组装
  745. foreach ($array as $i => $t) {
  746. $temp2[$k] = !empty($temp2[$k]) ? array_merge($temp2[$k], array("{
  747. $key[$i]}" => $t)) : array("{
  748. $key[$i]}" => $t); //依次添加到新的数组中去
  749. }
  750. }
  751. return $temp2;
  752. }
  753. function unique_arr($array2D, $stkeep = false, $ndformat = true)
  754. {
  755. // 判断是否保留一级数组键 (一级数组键可以为非数字)
  756. if ($stkeep)
  757. $stArr = array_keys($array2D);
  758. // 判断是否保留二级数组键 (所有二级数组键必须相同)
  759. if ($ndformat)
  760. $ndArr = array_keys(end($array2D));
  761. //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
  762. foreach ($array2D as $v) {
  763. $v = join(",", $v);
  764. $temp[] = $v;
  765. }
  766. //去掉重复的字符串,也就是重复的一维数组
  767. $temp = array_unique($temp);
  768. //再将拆开的数组重新组装
  769. foreach ($temp as $k => $v) {
  770. if ($stkeep)
  771. $k = $stArr[$k];
  772. if ($ndformat) {
  773. $tempArr = explode(",", $v);
  774. foreach ($tempArr as $ndkey => $ndval) {
  775. $output[$k][$ndArr[$ndkey]] = $ndval;
  776. }
  777. } else {
  778. $output[$k] = explode(",", $v);
  779. }
  780. }
  781. return $output;
  782. }
  783. // 标段期审批接口
  784. function auditMeasure()
  785. {
  786. if (isset($_POST['userid']) && isset($_POST['tenderid']) && isset($_POST['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
  787. $auditcontent = iconv('GBK', 'UTF-8', $_POST['CheckerMemo']);
  788. $auditArray = $this->measureauditact->getLastNewRowInfo($_POST['tenderid'], $_POST['phaseno'], $_POST['userid']);
  789. if (isset($auditArray ['mastatus']) && (($auditArray ['mastatus'] == 'checked') || ($auditArray ['mastatus'] == 'checkno'))) {
  790. echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
  791. die();
  792. }
  793. $auditUserArray = $this->measureauditact->getUserAuditLast($_POST['tenderid'], $_POST['phaseno']);
  794. $fp = $this->upfile('upfile');
  795. if (isset($fp[0]['filepath'])) {
  796. $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  797. if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
  798. $status = array('status' => 'FALSE', 'msg' => '审批期数数据上传失败,请重新上传');
  799. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  800. die();
  801. }
  802. $res = $this->zip->open(Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  803. $extPath = pathinfo($fp[0]['filepath']);
  804. $extPathdir = Doo::conf()->SITE_PATH . $extPath ['dirname'] . '/' . $extPath['filename'];
  805. if ($res === TRUE) {
  806. if (!$this->dir_create($extPathdir)) {
  807. return FALSE;
  808. }
  809. $this->zip->extractTo($extPathdir);
  810. $this->zip->close();
  811. }
  812. // 更新五项最新数据
  813. $countArray = json_decode(file_get_contents($extPathdir . '/' . 'JsonFile_Common.json'), TRUE, JSON_UNESCAPED_UNICODE);
  814. if (!isset($countArray)) {
  815. $status = array('status' => FALSE, 'msg' => '期数汇总数据上传失败');
  816. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  817. die();
  818. }
  819. $iniTimes = 0;
  820. $intMaxTimes = $this->numofperact->getMaxTimes($_POST['tenderid'], $_POST['phaseno']);
  821. if (isset($intMaxTimes['times']) && ($intMaxTimes['times'] > 0)) {
  822. $iniTimes = $intMaxTimes['times'];
  823. }
  824. $this->actmeasure->updateCon($_POST['tenderid'], $countArray['TotalPrice']);
  825. $this->numofperact->updateNumofper($_POST['tenderid'], $_POST['phaseno'], $countArray, $iniTimes);
  826. $numArray = $this->numofperact->getRow($_POST['tenderid'], $_POST['phaseno'], $iniTimes);
  827. if (isset($auditArray['pid'])) {
  828. // 插入附件表之前要更新所有次标段期数的提交的数据状态为旧标志
  829. $this->attfile->setOldfileFlag($_POST['tenderid'], $_POST['phaseno'], $iniTimes);
  830. // 插入此次提交的文件路径数据并设置为新状态
  831. // 写入此时是第几次重做
  832. $this->attfile->insertFile($auditArray['pid'], $auditArray['stid'], $numArray['mpid'], $_POST['tenderid'], $_POST['phaseno'], $_POST['userid'], $fp[0]['filepath'], 0, $_POST['MD5_JL'], $iniTimes);
  833. // 更新审批表审批人的标段期数审批状态
  834. if ($this->measureauditact->setStatusTo($auditArray['maid'], 3, $auditcontent)) {
  835. // 更新下一个人的状态
  836. $countAudit = count($auditUserArray);
  837. if ($auditArray['last'] == '1') {// 根据标志位判断是否为最后一个审核人{ 判断当前审核人是什么角色 } 利用post发送的UID 与 当前期数参与的所有人比较
  838. $this->measureauditact->setStatusTo($auditUserArray[0]['maid'], 3);
  839. $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checked', $iniTimes);
  840. // SMS Start
  841. $TenderArray = $this->actmeasure->getRowByPmid($_POST['tenderid']);
  842. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  843. if (isset($userProArray) && ($userProArray['mobile'])) {
  844. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR3"]);
  845. }
  846. // SMS End
  847. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  848. die();
  849. } else {// 不是最后一个审核人根据不同审核人数量变更状态 {当前用户不是最后一个审核人}
  850. if (($countAudit == 2) && ($auditUserArray[0]['last'] == 1) && ($auditUserArray[1]['maid'] == $auditArray['maid'])) {// 如果审核人为两个,第一个是最后审核人角色,第二个为当前审核人,设置审核中状态 {就是当前用户POST UID}
  851. $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
  852. $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
  853. // SMS Start
  854. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
  855. $pmnameArray = $this->actmeasure->getRowByPmid($_POST['tenderid']);
  856. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
  857. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  858. }
  859. // SMS End
  860. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  861. die();
  862. }
  863. if (($countAudit > 2)) {// 审核人总数大于2时,
  864. foreach ($auditUserArray as $k => $v) {
  865. if ($v['maid'] == $auditArray['maid']) {// 找到当前用户
  866. if ($k == ($countAudit - 1)) {//如果是最后一个
  867. $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
  868. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
  869. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
  870. } else {
  871. $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);//变更下一个状态
  872. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
  873. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k]['pmid']);
  874. }
  875. // SMS Start
  876. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
  877. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  878. }
  879. // SMS End
  880. $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
  881. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  882. die();
  883. }
  884. }
  885. // 我是第几个审批的
  886. // 如果是最后一个就把业主审批状态更改为审批中
  887. // 如果是第一个就把后一个设置为审批中
  888. }
  889. }
  890. } else {
  891. echo json_encode(array('status' => FALSE, 'msg' => '审批文件提交失败1'), JSON_UNESCAPED_UNICODE);
  892. die();
  893. }
  894. }
  895. } else {
  896. echo json_encode(array('status' => FALSE, 'msg' => '审批文件提交失败'), JSON_UNESCAPED_UNICODE);
  897. die();
  898. }
  899. } else {
  900. echo json_encode(array('status' => FALSE, 'msg' => '审批参数错误'), JSON_UNESCAPED_UNICODE);
  901. die();
  902. }
  903. }
  904. /**
  905. * 根据标段ID查询是否需要更新
  906. */
  907. function checkTenderUpdate()
  908. {
  909. if (isset($this->params ['tenderid']) && $this->params['tenderid']) {
  910. $updateArray = $this->attfile->getFileUpdate($this->params['tenderid']);
  911. $projectArray = $this->project->getRowByPid($updateArray['pid']);
  912. $stArray = $this->contractact->getRowByStid($updateArray['stid']);
  913. $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  914. if (isset($updateArray['filepath'])) {
  915. $pathinfo = pathinfo($updateArray['filepath']);
  916. $downfileurl[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'MD5_Jl' => $updateArray['filehashcode'], 'proName' => $projectArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $projectArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
  917. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downfileurl), JSON_UNESCAPED_UNICODE);
  918. die();
  919. } else {
  920. echo json_encode(array('status' => TRUE, 'msg' => '暂无更新数据'), JSON_UNESCAPED_UNICODE);
  921. die();
  922. }
  923. } else {
  924. echo json_encode(array('status' => FALSE, 'msg' => '更新查询参数错误'), JSON_UNESCAPED_UNICODE);
  925. die();
  926. }
  927. }
  928. /**
  929. * 手动创建第二期的审批人
  930. */
  931. function creatTenderNumPnameUser()
  932. {
  933. if (isset($_POST['tenderid']) && isset($_POST['phaseno']) && ($_POST['phaseno'] > 1)) {
  934. $allMeasureUser = $this->measureauditact->getUserAudit($_POST['tenderid'], $_POST['phaseno'] - 1);
  935. if (isset($allMeasureUser)) {
  936. foreach ($allMeasureUser as $key => $value) {
  937. // if ($key == 1) {
  938. // $status = 'checking';
  939. // } else {
  940. $status = 'uncheck';
  941. // }
  942. try {
  943. $this->measureauditact->insertMeasureAudit($value['pid'], $value['creatoruid'], $value['auditoruid'], $value['mpid'], $value['pmid'], $value['stid'], $_POST['phaseno'], $status, $value['last']);
  944. } catch (Exception $exc) {
  945. }
  946. }
  947. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  948. die();
  949. } else {
  950. echo json_encode(array('status' => FALSE, 'msg' => '审批人员列表不存在'), JSON_UNESCAPED_UNICODE);
  951. die();
  952. }
  953. } else {
  954. echo json_encode(array('status' => FALSE, 'msg' => '创建审批人员列表参数错误'), JSON_UNESCAPED_UNICODE);
  955. die();
  956. }
  957. }
  958. /**
  959. * 返回指定用户参与的所有项目
  960. */
  961. function getUserALLProject()
  962. {
  963. if (!isset($this->params['userid']) || !($this->params['userid'] > 0)) {
  964. echo json_encode(array('status' => FALSE, 'msg' => '返回指定用户参与的所有项目参数错误'), JSON_UNESCAPED_UNICODE);
  965. die();
  966. }
  967. $conArray = $this->contractact->getUserRow($this->params['userid']);
  968. if (isset($conArray) && $conArray) {
  969. foreach ($conArray as $key => $value) {
  970. $proArray = $this->project->getRowByPid($value['pid']);
  971. $attfileArray = $this->attfile->getLastData($value['stid']);
  972. foreach ($attfileArray as $k => $v) {
  973. $pathinfo = pathinfo($v['filepath']);
  974. $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $value['stname'], 'MD5_Jl' => $v['filehashcode']);
  975. }
  976. }
  977. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $retArray), JSON_UNESCAPED_UNICODE);
  978. die();
  979. } else {
  980. $userproArray = $this->measureauditact->getProject($this->params['userid']);
  981. if (isset($userproArray) && $userproArray) {
  982. foreach ($userproArray as $upk => $upv) {
  983. $attArray = $this->attfile->getMeasureLastNew($upv['pmid'], $upv['numpname']);
  984. $proArray = $this->project->getRowByPid($attArray['pid']);
  985. $attfileArray = $this->contractact->getRowByStid($attArray['stid']);
  986. $pathinfo = pathinfo($attArray['filepath']);
  987. if (isset($pathinfo['dirname']))
  988. $newattArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $attfileArray['stname'], 'MD5_Jl' => $attArray['filehashcode']);
  989. }
  990. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $newattArray), JSON_UNESCAPED_UNICODE);
  991. die();
  992. }
  993. }
  994. }
  995. /**
  996. * 设置审批未通过操作
  997. * 第一步设置未通过操作,操作相关期数。 同步状态。
  998. * 第二步设置项目查询接口未通过审批的查询返回未锁定的
  999. * 第三步前台相关状态更新
  1000. *
  1001. * TODO: 更新附件标志位未加入次数标志做更新 ok
  1002. * TODO: 不通过两次未通过时候操作期数状态为错误位同步状态位 ok
  1003. * TODO: MPID未通过操作不争取 ok
  1004. */
  1005. function setCheckno()
  1006. {
  1007. if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
  1008. $auditcontent = iconv('GBK', 'UTF - 8', $_POST['CheckerMemo']);
  1009. $auditArrayStatus = $this->measureauditact->getLastNewRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
  1010. if (isset($auditArrayStatus ['mastatus']) && (($auditArrayStatus ['mastatus'] == 'checked') || ($auditArrayStatus ['mastatus'] == 'checkno'))) {
  1011. echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
  1012. die();
  1013. }
  1014. $auditArray = $this->measureauditact->getRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
  1015. if (isset($auditArray['maid'])) {
  1016. $intMaxTimes = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
  1017. if (isset($intMaxTimes['times'])) {
  1018. $iniTimes = $intMaxTimes['times'];
  1019. }
  1020. $this->measureauditact->setCheckno($auditArray['maid'], $auditcontent);
  1021. $this->numofperact->updateAuditStatus($this->params['tenderid'], $this->params['phaseno'], 'checkno', $iniTimes);
  1022. $fp = $this->upfile('upfile');
  1023. if (isset($fp[0]['filepath'])) {
  1024. // 解压缩文件等待以后直接使用
  1025. // TODO:根据校验码校验包的完整性
  1026. $localmd5HashString = hash_file("md5", Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  1027. if ($localmd5HashString != trim($_POST['MD5_Zip'])) {
  1028. $status = array('status' => 'FALSE', 'msg' => '未通过期数数据上传失败,请重新上传');
  1029. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1030. die();
  1031. }
  1032. $res = $this->zip->open(Doo::conf()->SITE_PATH . $fp[0]['filepath']);
  1033. $extPath = pathinfo($fp[0]['filepath']);
  1034. $extPathdir = Doo::conf()->SITE_PATH . $extPath ['dirname'] . '/' . $extPath['filename'];
  1035. if ($res === TRUE) {
  1036. if (!$this->dir_create($extPathdir)) {
  1037. return FALSE;
  1038. }
  1039. $this->zip->extractTo($extPathdir);
  1040. $this->zip->close();
  1041. }
  1042. $numArray = $this->numofperact->getRow($this->params['tenderid'], $this->params['phaseno'], $iniTimes);
  1043. // 插入附件表之前要更新所有次标段期数的提交的数据状态为旧标志
  1044. $this->attfile->setOldfileFlag($this->params['tenderid'], $this->params['phaseno'], $iniTimes);
  1045. // 插入此次提交的文件路径数据并设置为新状态
  1046. $this->attfile->insertFile($auditArray['pid'], $auditArray['stid'], $auditArray['mpid'], $this->params['tenderid'], $this->params['phaseno'], $this->params['userid'], $fp[0]['filepath'], 0, $_POST['MD5_JL'], $iniTimes);
  1047. // SMS Start
  1048. $TenderArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  1049. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  1050. if (isset($userProArray) && ($userProArray['mobile'])) {
  1051. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  1052. }
  1053. // SMS End
  1054. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1055. die();
  1056. } else {
  1057. echo json_encode(array('status' => FALSE, 'msg' => '文件上传故障'), JSON_UNESCAPED_UNICODE);
  1058. die();
  1059. }
  1060. } else {
  1061. echo json_encode(array('status' => FALSE, 'msg' => '审批期数不存在'), JSON_UNESCAPED_UNICODE);
  1062. die();
  1063. }
  1064. } else {
  1065. echo json_encode(array('status' => FALSE, 'msg' => '审批未通过参数错误'), JSON_UNESCAPED_UNICODE);
  1066. die();
  1067. }
  1068. }
  1069. /**
  1070. * 创建未通过的新一期
  1071. *
  1072. */
  1073. function createNewAudit()
  1074. {
  1075. // 插入上次期数相关审批人员
  1076. // TODO:
  1077. // error_log(var_export($this->params, TRUE), 3, ' / opt / html / jiliang_customedProduct / data / ' . time());
  1078. // die;
  1079. if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
  1080. $auditArray = $this->numofperact->getChecknoRow($this->params['tenderid'], $this->params['phaseno']);
  1081. if (isset($auditArray['currstatus']) && ($auditArray['currstatus'] == 'checkno')) {
  1082. $isCreate = false;
  1083. $auditUserArray = $this->measureauditact->getUserAuditLast($this->params['tenderid'], $this->params['phaseno']);
  1084. foreach ($auditUserArray as $key => $value) {
  1085. if ($value['mastatus'] != 'uncheck') {
  1086. $isCreate = true;
  1087. }
  1088. }
  1089. if ($auditUserArray && $isCreate) {
  1090. foreach ($auditUserArray as $key => $value) {
  1091. $this->measureauditact->insertMeasureAudit($value['pid'], $value['creatoruid'], $value['auditoruid'], $value['mpid'], $value['pmid'], $value['stid'], $value['numpname'], $status = 'uncheck', $value['last'], $auditArray['times'] + 1);
  1092. }
  1093. } else {
  1094. echo json_encode(array('status' => FALSE, 'msg' => '无效操作重复创建审批人'), JSON_UNESCAPED_UNICODE);
  1095. die();
  1096. }
  1097. //// $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
  1098. // $urlinfoArray = $this->attfile->getLastNewProfileUnlock2($this->params['tenderid'], $this->params['phaseno']);
  1099. // $proArray = $this->project->getRowByPid($urlinfoArray['pid']);
  1100. // $stArray = $this->contractact->getRowByStid($urlinfoArray['stid']);
  1101. // $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  1102. // $downArray = NULL;
  1103. // $pathinfo = pathinfo($urlinfoArray['filepath']);
  1104. // if (isset($pathinfo['dirname']))
  1105. // $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . ' / ' . $pathinfo['filename'] . ' / ProjectFile . rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
  1106. // echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
  1107. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1108. die();
  1109. } else {
  1110. echo json_encode(array('status' => FALSE, 'msg' => '审批状态无效'), JSON_UNESCAPED_UNICODE);
  1111. die();
  1112. }
  1113. } else {
  1114. echo json_encode(array('status' => FALSE, 'msg' => '创建未通过的新一期参数错误'), JSON_UNESCAPED_UNICODE);
  1115. die();
  1116. }
  1117. }
  1118. /**
  1119. * 重做新一期获取原报上报文件
  1120. *
  1121. */
  1122. function getReportFile()
  1123. {
  1124. if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
  1125. $auditArray = $this->numofperact->getChecknoRow($this->params['tenderid'], $this->params['phaseno']);
  1126. if (isset($auditArray['currstatus']) && ($auditArray['currstatus'] == 'checkno')) {
  1127. $timesArray = $this->numofperact->getMaxTimes($this->params['tenderid'], $this->params['phaseno']);
  1128. $urlinfoArray = $this->attfile->getReportFile($this->params['tenderid'], $this->params['phaseno'], $timesArray['times']);
  1129. $proArray = $this->project->getRowByPid($urlinfoArray['pid']);
  1130. $stArray = $this->contractact->getRowByStid($urlinfoArray['stid']);
  1131. $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  1132. $downArray = NULL;
  1133. $pathinfo = pathinfo($urlinfoArray['filepath']);
  1134. if (isset($pathinfo['dirname'])) {
  1135. $downArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '/ProjectFile.rmf', 'MD5_Jl' => $urlinfoArray['filehashcode'], 'proName' => $proArray['pname'], 'stName' => $stArray['stname'], 'pnameid' => $proArray['pid'], 'ptypeid' => $stArray['stid'], 'BidName' => $MeasureArray['pmname']);
  1136. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
  1137. die();
  1138. } else {
  1139. echo json_encode(array('status' => FALSE, 'msg' => '上报文件不存在'), JSON_UNESCAPED_UNICODE);
  1140. die();
  1141. }
  1142. } else {
  1143. echo json_encode(array('status' => FALSE, 'msg' => '审批状态无效'), JSON_UNESCAPED_UNICODE);
  1144. die();
  1145. }
  1146. } else {
  1147. echo json_encode(array('status' => FALSE, 'msg' => '创建未通过的新一期参数错误'), JSON_UNESCAPED_UNICODE);
  1148. die();
  1149. }
  1150. }
  1151. public function getUserInfo()
  1152. {
  1153. if (isset($this->params['userid']) && ($this->params['userid'] > 0)) {
  1154. $proArray = $this->profile->getProWithUid($this->params['userid']);
  1155. if (isset($proArray['userid'])) {
  1156. $strAvatar = $this->auth->getAvatar($proArray['userid']);
  1157. echo json_encode(array('status' => 'TRUE', 'msg' => '', 'info' => array('avatar' => $strAvatar, 'name' => $proArray['name'], 'jobs' => $proArray['jobs'], 'company' => $proArray['company'])), JSON_UNESCAPED_UNICODE);
  1158. die();
  1159. } else {
  1160. echo json_encode(array('status' => 'FALSE', 'msg' => '此用户不存在'), JSON_UNESCAPED_UNICODE);
  1161. die();
  1162. }
  1163. } else {
  1164. echo json_encode(array('status' => 'FALSE', 'msg' => '用户查询参数无效'), JSON_UNESCAPED_UNICODE);
  1165. die();
  1166. }
  1167. }
  1168. public function updateTenderName()
  1169. {
  1170. if (isset($this->params['BidID']) && isset($this->params['BidNewName'])) {
  1171. if ($this->actmeasure->updateName($this->params['BidID'], iconv('GBK', 'UTF - 8', $this->params['BidNewName']))) {
  1172. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1173. die();
  1174. } else {
  1175. echo json_encode(array('status' => 'FALSE', 'msg' => '标段名称更新错误'), JSON_UNESCAPED_UNICODE);
  1176. die();
  1177. }
  1178. } else {
  1179. echo json_encode(array('status' => 'FALSE', 'msg' => '标段名称更新参数无效'), JSON_UNESCAPED_UNICODE);
  1180. die();
  1181. }
  1182. }
  1183. /**
  1184. * 清单附件上传,单文件上传
  1185. * @param int $tenderid 标段ID
  1186. * @param int $uid 上传人ID
  1187. * @param int $itemid 本地清单ID
  1188. */
  1189. public function uploadItemFile()
  1190. {
  1191. if (isset($this->params['tenderid']) && isset($this->params['uid'])) {
  1192. if (!isset($_FILES['upitem']) && !isset($_POST['itemid']) && !isset($_POST['category']) && !isset($_POST['phase'])) {
  1193. $this->msg(0, '上传参数错误');
  1194. }
  1195. $fileArray = $this->upItemFile('upitem')[0];
  1196. if (isset($fileArray['filepath'])) {
  1197. $pidArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
  1198. $memoStr = iconv('GBK', 'UTF-8', $_POST['Memo']);
  1199. $pathinfo_dirname = pathinfo($fileArray['filepath'], PATHINFO_DIRNAME);
  1200. $filenameStr2 = iconv('GBK', 'UTF-8', $fileArray['filename']);
  1201. $url = $pathinfo_dirname . '/' . $filenameStr2;
  1202. setlocale(LC_ALL, 'zh_CN.UTF-8');
  1203. $fname = pathinfo($url);
  1204. $filenameStr = $fname['filename'];
  1205. $postArray = array('ownerid' => $this->params['uid'], 'pid' => $pidArray['pid'], 'pmid' => $this->params['tenderid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath']);
  1206. $iaid = $this->itemfile->insertItemFileRecord($postArray);
  1207. if ($iaid > 1) {
  1208. $itemMeasureNumArray = array('iaid' => $iaid, 'pid' => $pidArray['pid'], 'pmid' => $this->params['tenderid'], 'numpname' => $_POST['phase'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'categoryid' => array_search($_POST['category'], $this->fileTypeArray), 'tips' => $memoStr);
  1209. if (($imnid = $this->itemMeasureNum->insert($itemMeasureNumArray)) > 0) {
  1210. $extPath = pathinfo($fileArray['filepath']);
  1211. $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension'], 'imnid' => $imnid, 'fileurl' => Doo::conf()->APP_URL . $fileArray['filepath']);
  1212. $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
  1213. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1214. die();
  1215. } else {
  1216. $this->msg(0, '附件上传失败,请重新上传.');
  1217. }
  1218. }
  1219. } else {
  1220. $this->msg(0, '附件上传失败,请重新上传');
  1221. }
  1222. } else {
  1223. $this->msg(0, '上传参数错误');
  1224. }
  1225. }
  1226. /**
  1227. * 获得清单附件列表
  1228. */
  1229. public function getItemFileList()
  1230. {
  1231. if (isset($this->params['tenderid'])) {
  1232. $itemfileArray = $this->itemMeasureNum->getItemMeasureNum($this->params['tenderid']);
  1233. foreach ($itemfileArray as $value) {
  1234. $profileArray = $this->profile->getProWithUid($value['ownerid']);
  1235. $attFileArray = $this->itemfile->getItemFile($value['iaid']);
  1236. if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
  1237. $downArray[] = array('downurl' => Doo::conf()->APP_URL . $attFileArray['filepath'], 'filename' => $attFileArray['filename'] . '.' . $attFileArray['fileext'], 'fileext' => $attFileArray['fileext'], 'ownerName' => $profileArray['name'], 'itemid' => $value['softwareitemid'], 'Category' => $value['categoryid'], 'Memo' => $value['tips'], 'ownerid' => $value['ownerid'], 'uptime' => date('Y-m-d H:i', $value['intime']), 'fileid' => $value['imnid'], 'phase' => $value['numpname']);
  1238. }
  1239. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
  1240. die();
  1241. } else {
  1242. $this->msg(0, '获取附件列表参数错误');
  1243. }
  1244. }
  1245. /**
  1246. * 编辑清单附件描述 文件名?
  1247. */
  1248. public function updateItemFileDesc()
  1249. {
  1250. if (isset($this->params['fileid']) && isset($_POST['FileName']) && isset($_POST['Memo'])) {
  1251. // $memoStr = iconv('GB18030', 'UTF-8', $_POST['Memo']);
  1252. $memoStr = $_POST['Memo'];
  1253. // $filenameStr = iconv('GB18030', 'UTF-8', $_POST['FileName']);
  1254. $filenameStr = $_POST['FileName'];
  1255. $imnidArray = $this->itemMeasureNum->getRowData($this->params['fileid']);
  1256. // if ($this->itemMeasureNum->updateItemFields($this->params['fileid'], $memoStr) > 0) {
  1257. $this->itemMeasureNum->updateItemFields($this->params['fileid'], $memoStr);
  1258. $this->itemfile->updateItemFields($imnidArray['iaid'], $filenameStr);
  1259. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1260. die();
  1261. // } else {
  1262. // echo json_encode(array('status' => 'FALSE', 'msg' => '附件更新接口参数错误'), JSON_UNESCAPED_UNICODE);
  1263. // die();
  1264. // }
  1265. } else {
  1266. $this->msg(0, '附件更新接口参数错误');
  1267. }
  1268. }
  1269. /**
  1270. * 删除清单附件
  1271. */
  1272. public function delItemFile()
  1273. {
  1274. if (isset($this->params['fileid'])) {
  1275. $this->itemMeasureNum->delItemFields($this->params['fileid']);
  1276. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1277. die();
  1278. } else {
  1279. $this->msg(0, '关联删除接口参数错误');
  1280. }
  1281. }
  1282. /**
  1283. * @return attachment
  1284. */
  1285. public function getAttaFilesAll()
  1286. {
  1287. if (isset($this->params['tenderid'])) {
  1288. $itemfileArray = $this->itemfile->getFilesAll($this->params['tenderid']);
  1289. foreach ($itemfileArray as $value) {
  1290. // $profileArray = $this->profile->getProWithUid($value['ownerid']);
  1291. // $attFileArray = $this->itemfile->getItemFile($value['iaid']);
  1292. // if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
  1293. $filesArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'fileid' => $value['iaid']);
  1294. }
  1295. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $filesArray), JSON_UNESCAPED_UNICODE);
  1296. die();
  1297. } else {
  1298. $this->msg(0, '获取附件列表参数错误');
  1299. }
  1300. }
  1301. /**
  1302. * @return attachment
  1303. */
  1304. public function createAttWithTender()
  1305. {
  1306. if (isset($this->params['tenderid'])) {
  1307. $itemfileArray = $this->itemfile->getFilesAll($this->params['tenderid']);
  1308. foreach ($itemfileArray as $value) {
  1309. // $profileArray = $this->profile->getProWithUid($value['ownerid']);
  1310. // $attFileArray = $this->itemfile->getItemFile($value['iaid']);
  1311. // if (isset($attFileArray) && $attFileArray && isset($profileArray) && $profileArray)
  1312. $filesArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'fileid' => $value['iaid']);
  1313. }
  1314. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $filesArray), JSON_UNESCAPED_UNICODE);
  1315. die();
  1316. } else {
  1317. $this->msg(0, '获取附件列表参数错误');
  1318. }
  1319. }
  1320. /**
  1321. * 查询指定项目的指定期的全部审批意见。
  1322. * 标段ID,期号
  1323. */
  1324. public function getAuditOpinion()
  1325. {
  1326. if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
  1327. $retval = $this->measureauditact->getAuditOpinion($this->params['tenderid'], $this->params['phaseno']);
  1328. $iterator = new ArrayIterator($retval);
  1329. if (iterator_count($iterator) > 0) {
  1330. foreach ($retval as $value) {
  1331. $proArray = $this->profile->getProWithUid($value['auditoruid']);
  1332. $auditcontent = !empty($value['auditcontent']) ? $value['auditcontent'] : '';
  1333. $uArray[] = array('realname' => $proArray['name'], 'jobs' => $proArray['jobs'], 'acontent' => $auditcontent);
  1334. }
  1335. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $uArray), JSON_UNESCAPED_UNICODE);
  1336. die();
  1337. } else {
  1338. echo json_encode(array('status' => 'FALSE', 'msg' => '查询指定项目的指定期的全部审批意见参数错误'), JSON_UNESCAPED_UNICODE);
  1339. die();
  1340. }
  1341. } else {
  1342. $this->msg(0, '查询指定项目的指定期的全部审批意见接口参数错误');
  1343. }
  1344. }
  1345. /**
  1346. * 。
  1347. * 标段ID,期号
  1348. */
  1349. private function __auditNotice($mobile, $text)
  1350. {
  1351. $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
  1352. if ($smsSwitch > 0)
  1353. return $this->sms->sendSms($mobile, $text);
  1354. }
  1355. function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  1356. {
  1357. return $this->att->uploadMut($fildname, $param);
  1358. }
  1359. function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  1360. {
  1361. $this->att->setUploadDir();
  1362. return $this->att->uploadMut($fildname, $param);
  1363. }
  1364. /**
  1365. * 根据标段ID获取标段是否已经被删除的提示
  1366. * 标段ID
  1367. */
  1368. public function getCountPmid()
  1369. {
  1370. if (isset($this->params['tenderid'])) {
  1371. $isexist = $this->actmeasure->getCountPmid($this->params['tenderid']);
  1372. if ($isexist > 0) {
  1373. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => null), JSON_UNESCAPED_UNICODE);
  1374. die();
  1375. } else {
  1376. echo json_encode(array('status' => 'FALSE', 'msg' => '该项目[XXX]在云端已被删除,点击“确定”后,可手动删除该项目'), JSON_UNESCAPED_UNICODE);
  1377. die();
  1378. }
  1379. } else {
  1380. $this->msg(0, '获取标段是否存在参数错误');
  1381. }
  1382. }
  1383. function getFileupErrorNo()
  1384. {
  1385. return $this->att->error();
  1386. }
  1387. function Signout()
  1388. {
  1389. session_destroy();
  1390. }
  1391. function isLoggedIn()
  1392. {
  1393. return isset($_SESSION['user_id']);
  1394. }
  1395. function generateFormHash($salt)
  1396. {
  1397. $hash = md5(mt_rand(1, 1000000) . $salt);
  1398. $_SESSION['csrf_hash'] = $hash;
  1399. return $hash;
  1400. }
  1401. function isValidFormHash($hash)
  1402. {
  1403. return $_SESSION['csrf_hash'] === $hash;
  1404. }
  1405. /**
  1406. * 随机字符串函数
  1407. * @param $password 密码
  1408. * @param $random 随机数
  1409. */
  1410. function random($length, $chars = '0123456789')
  1411. {
  1412. $hash = '';
  1413. $max = strlen($chars) - 1;
  1414. for ($i = 0; $i < $length; $i++) {
  1415. $hash .= $chars[mt_rand(0, $max)];
  1416. }
  1417. return $hash;
  1418. }
  1419. /**
  1420. * 生成随机字符串
  1421. * @param string $lenth 长度
  1422. * @return string 字符串
  1423. */
  1424. function create_randomstr($lenth = 6)
  1425. {
  1426. return $this->random($lenth, '123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ');
  1427. }
  1428. function dir_create($path, $mode = 0777)
  1429. {
  1430. if (is_dir($path))
  1431. return TRUE;
  1432. $path = $this->dir_path($path);
  1433. $parent = dirname($path);
  1434. if (!is_dir($parent))
  1435. @mkdir($parent, 0777, true);
  1436. @mkdir($path, 0777, true);
  1437. return is_dir($path);
  1438. }
  1439. function dir_create2($path, $mode = 0777)
  1440. {
  1441. if (is_dir($path))
  1442. return TRUE;
  1443. $path = $this->dir_path($path);
  1444. $parent = dirname($path);
  1445. if (!is_dir($parent)){
  1446. @mkdir($parent, 0777);
  1447. @chmod($parent, 0777);
  1448. }
  1449. @mkdir($path, 0777);
  1450. @chmod($path, 0777);
  1451. return is_dir($path);
  1452. }
  1453. function dir_path($path)
  1454. {
  1455. $path = str_replace('\\', '/', $path);
  1456. if (substr($path, -1) != '/')
  1457. $path = $path . '/';
  1458. return $path;
  1459. }
  1460. function msg($isTrue = 0, $msg = null, $retmsg = null)
  1461. {
  1462. if ($isTrue > 0) {
  1463. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  1464. die();
  1465. } else {
  1466. echo json_encode(array('status' => 'FALSE', 'msg' => $msg), JSON_UNESCAPED_UNICODE);
  1467. die();
  1468. }
  1469. }
  1470. // function checkVersion($version)
  1471. // {
  1472. // preg_match();
  1473. // }
  1474. //在线签署的接口
  1475. public function getSignCreate(){
  1476. // TODO:上报数据
  1477. if (!empty($_FILES['upspdf']['name']) && !empty($_FILES['upfile']['name']) && isset($_POST['project']) && isset($_POST['tender']) && isset($_POST['phaseno']) && isset($_POST['name']) && isset($_POST['ownuid']) && isset($_POST['widhei'])) {
  1478. //解压压缩包并把图片存到文件夹中
  1479. @$_POST['name'] = iconv('GBK', 'UTF-8', $_POST['name']);
  1480. $upfilename = pathinfo($_FILES['upfile']['name']);
  1481. if($upfilename['extension'] != 'zip'){
  1482. $status = array('status' => 'FALSE', 'msg' => '上传的文件格式有误');
  1483. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1484. die();
  1485. }
  1486. $res = $this->zip->open($_FILES['upfile']['tmp_name']);
  1487. if ($res === TRUE) {
  1488. $samesignname = $this->sign->getSignbyName($_POST['name']);
  1489. if(!empty($samesignname)){
  1490. $status = array('status' => 'FALSE', 'msg' => '存在同名报表');
  1491. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1492. die();
  1493. }
  1494. //添加到签署报表中
  1495. $intime = time();
  1496. $signid = $this->sign->insertSign($_POST['project'], $_POST['tender'], $_POST['phaseno'], $_POST['name'], $_POST['ownuid'],$intime,$_POST['widhei']);
  1497. $extPathdir = Doo::conf()->SITE_PATH . 'signs/' . $signid;
  1498. if ($res === TRUE) {
  1499. if (!$this->dir_create2($extPathdir)) {
  1500. $status = array('status' => 'FALSE', 'msg' => '期数数据上传失败');
  1501. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1502. die();
  1503. }
  1504. $this->zip->extractTo($extPathdir);
  1505. $this->zip->close();
  1506. $fileanddir = $this->deepScanDir($extPathdir);
  1507. sort($fileanddir['file2']);
  1508. $sum = 0;
  1509. foreach($fileanddir['file2'] as $k =>$v){
  1510. $sum++;
  1511. $signatt = new signn();
  1512. $path = 'signs/'.$signid.'/' . $v . '.jpg';
  1513. @chmod(Doo::conf()->SITE_PATH.$path,0777);
  1514. $signatt->insertSignAtt($signid,$v,$path);
  1515. // $this->compressed_image(Doo::conf()->SITE_PATH.$path,Doo::conf()->SITE_PATH.$path);
  1516. }
  1517. $sign2 = new signn();
  1518. $sign2->updateSignPageNum($signid,$sum);
  1519. $upspdfname = pathinfo($_FILES['upspdf']['name']);
  1520. if($upspdfname['extension'] != 'pdf'){
  1521. $status = array('status' => 'FALSE', 'msg' => '上传的文件格式有误');
  1522. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1523. die();
  1524. }
  1525. //上传pdf文件
  1526. if(!empty($_FILES["upspdf"]['name'])){
  1527. $pdf_name = $intime.'.pdf';
  1528. $upload_pdf = $extPathdir.'/'.$pdf_name;
  1529. $k = move_uploaded_file($_FILES["upspdf"]["tmp_name"], $upload_pdf);
  1530. if($k){
  1531. $status = array('status' => 'TRUE');
  1532. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1533. die();
  1534. }
  1535. }
  1536. }
  1537. }
  1538. $status = array('status' => 'FALSE', 'msg' => '文件上传失败,请重试');
  1539. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1540. die();
  1541. } else {
  1542. $status = array('status' => 'FALSE', 'msg' => '上传参数错误');
  1543. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1544. die();
  1545. }
  1546. }
  1547. public function getSignList(){
  1548. $wheresql = ' 1';
  1549. if(isset($_POST['project']) && is_numeric($_POST['project'])){
  1550. $wheresql .= ' and project='.$_POST['project'];
  1551. }
  1552. if(isset($_POST['tender']) && is_numeric($_POST['tender'])) {
  1553. $wheresql .= ' and tender='.$_POST['tender'];
  1554. }
  1555. if(isset($_POST['phaseno']) && is_numeric($_POST['phaseno'])){
  1556. $wheresql .= ' and phaseno='.$_POST['phaseno'];
  1557. }
  1558. $signlist = $this->sign->getSignListbyClient($wheresql);
  1559. if(!empty($signlist)){
  1560. $interMediatelist = array();
  1561. foreach($signlist as $k => $v){
  1562. $interMediatelist[$k]['signid'] = $v['sid'];
  1563. $interMediatelist[$k]['md5_sign'] = md5(Doo::conf()->SITE_PATH . 'signs/' . $v['sid']);
  1564. $interMediatelist[$k]['project'] = $v['project'];
  1565. $interMediatelist[$k]['tender'] = $v['tender'];
  1566. $interMediatelist[$k]['phaseno'] = $v['phaseno'];
  1567. $interMediatelist[$k]['name'] = $v['name'];
  1568. $interMediatelist[$k]['ownuid'] = $v['ownuid'];
  1569. $interMediatelist[$k]['status'] = $v['isinter'];
  1570. $interMediatelist[$k]['currnum'] = $v['pagenum'];
  1571. $interMediatelist[$k]['totalnum'] = $v['internum'];
  1572. }
  1573. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $interMediatelist), JSON_UNESCAPED_UNICODE);
  1574. die();
  1575. }else{
  1576. $status = array('status' => TRUE, 'msg' => '当前没有签署报表','info' => '');
  1577. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1578. die();
  1579. }
  1580. }
  1581. //中间计量表的接口
  1582. public function getInterMediateCreate(){
  1583. // TODO:上报数据
  1584. if (isset($_POST['project']) && isset($_POST['tender']) && isset($_POST['phaseno']) && isset($_POST['name']) && isset($_POST['ownuid']) && isset($_POST['widhei']) && isset($_POST['totalnum'])) {
  1585. //解压压缩包并把图片存到文件夹中
  1586. @$_POST['name'] = iconv('GBK', 'UTF-8', $_POST['name']);
  1587. $samesignname = $this->sign->getSignbyName($_POST['tender'], $_POST['phaseno'], $_POST['name']);
  1588. if(!empty($samesignname)){
  1589. $status = array('status' => 'FALSE', 'msg' => '存在同名中间计量表');
  1590. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1591. die();
  1592. }
  1593. //添加到签署报表中
  1594. $intime = time();
  1595. $signid = $this->sign->insertSign($_POST['project'], $_POST['tender'], $_POST['phaseno'], $_POST['name'], $_POST['ownuid'],$intime,$_POST['widhei'],1,$_POST['totalnum']);
  1596. $extPathdir = Doo::conf()->SITE_PATH . 'signs/' . $signid;
  1597. if (!$this->dir_create2($extPathdir)) {
  1598. $status = array('status' => 'FALSE', 'msg' => '文件夹创建失败');
  1599. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1600. die();
  1601. }
  1602. $status = array('status' => 'TRUE','msg' => '', 'info' => array('signid' => $signid, 'md5_sign' => md5($extPathdir)));
  1603. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1604. die();
  1605. } else {
  1606. $status = array('status' => 'FALSE', 'msg' => '上传参数错误');
  1607. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1608. die();
  1609. }
  1610. }
  1611. public function getInterMediateUpload(){
  1612. if(isset($_POST['signid']) && isset($_POST['md5_sign']) && !empty($_FILES['imediate']['name'])){
  1613. $extPathdir = Doo::conf()->SITE_PATH . 'signs/' . $_POST['signid'];
  1614. if($_POST['md5_sign'] != md5($extPathdir)){
  1615. $status = array('status' => 'FALSE', 'msg' => '上传的图表不对应');
  1616. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1617. die();
  1618. }
  1619. $path = $extPathdir .'/' . $_FILES['imediate']['name'];
  1620. @chmod(Doo::conf()->SITE_PATH.$path,0777);
  1621. $k = move_uploaded_file($_FILES['imediate']["tmp_name"], $path);
  1622. if($k){
  1623. $signatt = new signn();
  1624. $result = $signatt->insertSignAtt($_POST['signid'],basename($_FILES['imediate']['name'],".jpg"),'signs/' . $_POST['signid'].'/'.$_FILES['imediate']['name']);
  1625. if(!empty($result)){
  1626. $sign2 = new signn();
  1627. $signArray = $sign2->getOneSignbysid($_POST['signid']);
  1628. $sign2->updateSignPageNum($_POST['signid'],$signArray['pagenum']+1);
  1629. if($signArray['pagenum']+1 == $signArray['internum']){
  1630. $sign2->updateInterMediateStatus($_POST['signid'],2);
  1631. }
  1632. $status = array('status' => 'TRUE');
  1633. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1634. die();
  1635. }else{
  1636. $status = array('status' => 'FALSE', 'msg' => '图片保存出错');
  1637. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1638. die();
  1639. }
  1640. }else{
  1641. $status = array('status' => 'FALSE', 'msg' => '上传图片失败');
  1642. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1643. die();
  1644. }
  1645. }else{
  1646. $status = array('status' => 'FALSE', 'msg' => '上传参数错误');
  1647. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1648. die();
  1649. }
  1650. }
  1651. public function getInterMediateList(){
  1652. $wheresql = 'isinter!=0';
  1653. if(isset($_POST['project']) && is_numeric($_POST['project'])){
  1654. $wheresql .= ' and project='.$_POST['project'];
  1655. }
  1656. if(isset($_POST['tender']) && is_numeric($_POST['tender'])) {
  1657. $wheresql .= ' and tender='.$_POST['tender'];
  1658. }
  1659. if(isset($_POST['phaseno']) && is_numeric($_POST['phaseno'])){
  1660. $wheresql .= ' and phaseno='.$_POST['phaseno'];
  1661. }
  1662. $signlist = $this->sign->getSignListbyClient($wheresql);
  1663. if(!empty($signlist)){
  1664. $interMediatelist = array();
  1665. foreach($signlist as $k => $v){
  1666. $interMediatelist[$k]['signid'] = $v['sid'];
  1667. $interMediatelist[$k]['md5_sign'] = md5(Doo::conf()->SITE_PATH . 'signs/' . $v['sid']);
  1668. $interMediatelist[$k]['phaseno'] = $v['phaseno'];
  1669. $interMediatelist[$k]['name'] = $v['name'];
  1670. $interMediatelist[$k]['ownuid'] = $v['ownuid'];
  1671. $interMediatelist[$k]['status'] = $v['isinter'];
  1672. $interMediatelist[$k]['currnum'] = $v['pagenum'];
  1673. $interMediatelist[$k]['totalnum'] = $v['internum'];
  1674. }
  1675. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $interMediatelist), JSON_UNESCAPED_UNICODE);
  1676. die();
  1677. }else{
  1678. $status = array('status' => TRUE, 'msg' => '当前没有中间计量表','info' => '');
  1679. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  1680. die();
  1681. }
  1682. }
  1683. // public function testzip(){
  1684. // $this->render('testzip', $this->data);
  1685. // }
  1686. function deepScanDir($dir) {
  1687. $fileArr = array ();
  1688. $fileArr2 = array ();
  1689. $dirArr = array ();
  1690. $dir = rtrim($dir, '//');
  1691. if (is_dir($dir)) {
  1692. $dirHandle = opendir($dir);
  1693. while (false !== ($fileName = readdir($dirHandle))) {
  1694. $subFile = $dir . DIRECTORY_SEPARATOR . $fileName;
  1695. if (is_file($subFile)) {
  1696. $fileArr[] = $subFile;
  1697. $fileArr2[] = basename($subFile,'.jpg');
  1698. }
  1699. elseif (is_dir($subFile) && str_replace('.', '', $fileName) != '') {
  1700. $dirArr[] = $subFile;
  1701. $arr = $this->deepScanDir($subFile);
  1702. $dirArr = array_merge($dirArr, $arr['dir']);
  1703. $fileArr = array_merge($fileArr, $arr['file']);
  1704. $fileArr2 = array_merge($fileArr2, $arr['file2']);
  1705. }
  1706. }
  1707. closedir($dirHandle);
  1708. }
  1709. return array (
  1710. 'dir' => $dirArr,
  1711. 'file' => $fileArr,
  1712. 'file2' => $fileArr2
  1713. );
  1714. }
  1715. /**
  1716. * desription 判断是否gif动画
  1717. * @param sting $image_file图片路径
  1718. * @return boolean t 是 f 否
  1719. */
  1720. function check_gifcartoon($image_file){
  1721. $fp = fopen($image_file,'rb');
  1722. $image_head = fread($fp,1024);
  1723. fclose($fp);
  1724. return preg_match("/".chr(0x21).chr(0xff).chr(0x0b).'NETSCAPE2.0'."/",$image_head)?false:true;
  1725. }
  1726. /**
  1727. * desription 压缩图片
  1728. * @param sting $imgsrc 图片路径
  1729. * @param string $imgdst 压缩后保存路径
  1730. */
  1731. function compressed_image($imgsrc,$imgdst){
  1732. list($width,$height,$type)=getimagesize($imgsrc);
  1733. $new_width = $width;
  1734. $new_height = $height;
  1735. switch($type){
  1736. case 1:
  1737. $giftype=$this->check_gifcartoon($imgsrc);
  1738. if($giftype){
  1739. // header('Content-Type:image/gif');
  1740. $image_wp=imagecreatetruecolor($new_width, $new_height);
  1741. $image = imagecreatefromgif($imgsrc);
  1742. imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  1743. //75代表的是质量、压缩图片容量大小
  1744. imagejpeg($image_wp, $imgdst,100);
  1745. imagedestroy($image_wp);
  1746. }
  1747. break;
  1748. case 2:
  1749. // header('Content-Type:image/jpeg');
  1750. $image_wp=imagecreatetruecolor($new_width, $new_height);
  1751. $image = imagecreatefromjpeg($imgsrc);
  1752. imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  1753. //75代表的是质量、压缩图片容量大小
  1754. imagejpeg($image_wp, $imgdst,100);
  1755. imagedestroy($image_wp);
  1756. break;
  1757. case 3:
  1758. // header('Content-Type:image/png');
  1759. $image_wp=imagecreatetruecolor($new_width, $new_height);
  1760. $image = imagecreatefrompng($imgsrc);
  1761. imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  1762. //75代表的是质量、压缩图片容量大小
  1763. imagejpeg($image_wp, $imgdst,100);
  1764. imagedestroy($image_wp);
  1765. break;
  1766. case 6:
  1767. // header('Content-Type:image/x-ms-bmp');
  1768. $image_wp=imagecreatetruecolor($new_width, $new_height);
  1769. $image = $this->imagecreatefrombmp($imgsrc);
  1770. imagecopyresampled($image_wp, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  1771. //75代表的是质量、压缩图片容量大小
  1772. imagejpeg($image_wp, $imgdst,100);
  1773. imagedestroy($image_wp);
  1774. break;
  1775. }
  1776. }
  1777. //bmp 转jpg
  1778. function imagecreatefrombmp( $filename ){
  1779. if ( !$f1 = fopen( $filename, "rb" ) )
  1780. return FALSE;
  1781. $FILE = unpack( "vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread( $f1, 14 ) );
  1782. if ( $FILE['file_type'] != 19778 )
  1783. return FALSE;
  1784. $BMP = unpack( 'Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel' . '/Vcompression/Vsize_bitmap/Vhoriz_resolution' . '/Vvert_resolution/Vcolors_used/Vcolors_important', fread( $f1, 40 ) );
  1785. $BMP['colors'] = pow( 2, $BMP['bits_per_pixel'] );
  1786. if ( $BMP['size_bitmap'] == 0 )
  1787. $BMP['size_bitmap'] = $FILE['file_size'] - $FILE['bitmap_offset'];
  1788. $BMP['bytes_per_pixel'] = $BMP['bits_per_pixel'] / 8;
  1789. $BMP['bytes_per_pixel2'] = ceil( $BMP['bytes_per_pixel'] );
  1790. $BMP['decal'] = ($BMP['width'] * $BMP['bytes_per_pixel'] / 4);
  1791. $BMP['decal'] -= floor( $BMP['width'] * $BMP['bytes_per_pixel'] / 4 );
  1792. $BMP['decal'] = 4 - (4 * $BMP['decal']);
  1793. if ( $BMP['decal'] == 4 )
  1794. $BMP['decal'] = 0;
  1795. $PALETTE = array();
  1796. if ( $BMP['colors'] < 16777216 ){
  1797. $PALETTE = unpack( 'V' . $BMP['colors'], fread( $f1, $BMP['colors'] * 4 ) );
  1798. }
  1799. $IMG = fread( $f1, $BMP['size_bitmap'] );
  1800. $VIDE = chr( 0 );
  1801. $res = imagecreatetruecolor( $BMP['width'], $BMP['height'] );
  1802. $P = 0;
  1803. $Y = $BMP['height'] - 1;
  1804. while( $Y >= 0 ){
  1805. $X = 0;
  1806. while( $X < $BMP['width'] ){
  1807. if ( $BMP['bits_per_pixel'] == 32 ){
  1808. $COLOR = unpack( "V", substr( $IMG, $P, 4 ) );
  1809. $B = ord(substr($IMG, $P,1));
  1810. $G = ord(substr($IMG, $P+1,1));
  1811. $R = ord(substr($IMG, $P+2,1));
  1812. $color = imagecolorexact( $res, $R, $G, $B );
  1813. if ( $color == -1 )
  1814. $color = imagecolorallocate( $res, $R, $G, $B );
  1815. $COLOR[0] = $R*256*256+$G*256+$B;
  1816. $COLOR[1] = $color;
  1817. }elseif ( $BMP['bits_per_pixel'] == 24 )
  1818. $COLOR = unpack( "V", substr( $IMG, $P, 3 ) . $VIDE );
  1819. elseif ( $BMP['bits_per_pixel'] == 16 ){
  1820. $COLOR = unpack( "n", substr( $IMG, $P, 2 ) );
  1821. $COLOR[1] = $PALETTE[$COLOR[1] + 1];
  1822. }elseif ( $BMP['bits_per_pixel'] == 8 ){
  1823. $COLOR = unpack( "n", $VIDE . substr( $IMG, $P, 1 ) );
  1824. $COLOR[1] = $PALETTE[$COLOR[1] + 1];
  1825. }elseif ( $BMP['bits_per_pixel'] == 4 ){
  1826. $COLOR = unpack( "n", $VIDE . substr( $IMG, floor( $P ), 1 ) );
  1827. if ( ($P * 2) % 2 == 0 )
  1828. $COLOR[1] = ($COLOR[1] >> 4);
  1829. else
  1830. $COLOR[1] = ($COLOR[1] & 0x0F);
  1831. $COLOR[1] = $PALETTE[$COLOR[1] + 1];
  1832. }elseif ( $BMP['bits_per_pixel'] == 1 ){
  1833. $COLOR = unpack( "n", $VIDE . substr( $IMG, floor( $P ), 1 ) );
  1834. if ( ($P * 8) % 8 == 0 )
  1835. $COLOR[1] = $COLOR[1] >> 7;
  1836. elseif ( ($P * 8) % 8 == 1 )
  1837. $COLOR[1] = ($COLOR[1] & 0x40) >> 6;
  1838. elseif ( ($P * 8) % 8 == 2 )
  1839. $COLOR[1] = ($COLOR[1] & 0x20) >> 5;
  1840. elseif ( ($P * 8) % 8 == 3 )
  1841. $COLOR[1] = ($COLOR[1] & 0x10) >> 4;
  1842. elseif ( ($P * 8) % 8 == 4 )
  1843. $COLOR[1] = ($COLOR[1] & 0x8) >> 3;
  1844. elseif ( ($P * 8) % 8 == 5 )
  1845. $COLOR[1] = ($COLOR[1] & 0x4) >> 2;
  1846. elseif ( ($P * 8) % 8 == 6 )
  1847. $COLOR[1] = ($COLOR[1] & 0x2) >> 1;
  1848. elseif ( ($P * 8) % 8 == 7 )
  1849. $COLOR[1] = ($COLOR[1] & 0x1);
  1850. $COLOR[1] = $PALETTE[$COLOR[1] + 1];
  1851. }else
  1852. return FALSE;
  1853. imagesetpixel( $res, $X, $Y, $COLOR[1] );
  1854. $X++;
  1855. $P += $BMP['bytes_per_pixel'];
  1856. }
  1857. $Y--;
  1858. $P += $BMP['decal'];
  1859. }
  1860. fclose( $f1 );
  1861. return $res;
  1862. }
  1863. /**
  1864. * 查询标段关注人信息列表
  1865. */
  1866. public function getConcernAuditList(){
  1867. if(isset($this->params['tenderid']) && is_numeric($this->params['tenderid'])){
  1868. $concernArray = $this->concern->getMeasureConcernList($this->params['tenderid']);
  1869. if(!empty($concernArray)){
  1870. $userArray = array();
  1871. foreach($concernArray as $k => $v){
  1872. $userArray[$k]['uid'] = $v['uid'];
  1873. $userArray[$k]['name'] = $this->auth->getName($v['uid']);
  1874. $userArray[$k]['uemail'] = $this->auth->getEmail($v['uid']);
  1875. }
  1876. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $userArray), JSON_UNESCAPED_UNICODE);
  1877. die();
  1878. }else{
  1879. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => null), JSON_UNESCAPED_UNICODE);
  1880. die();
  1881. }
  1882. } else {
  1883. echo json_encode(array('status' => 'FALSE', 'msg' => '标段参数无效'), JSON_UNESCAPED_UNICODE);
  1884. die();
  1885. }
  1886. }
  1887. /**
  1888. * 添加关注标段
  1889. */
  1890. public function addConcernAudit(){
  1891. if(isset($_POST['tenderid']) && is_numeric($_POST['tenderid']) && isset($_POST['uid']) && is_numeric($_POST['uid'])){
  1892. $tendermsg = $this->actmeasure->getRowByPmid($_POST['tenderid']);
  1893. if(!empty($tendermsg)){
  1894. $result = $this->concern->insertMeasureConcern($tendermsg['pid'], $tendermsg['stid'], $tendermsg['pmid'], $_POST['uid']);
  1895. if($result){
  1896. echo json_encode(array('status' => TRUE, 'msg' => '成功添加关注'), JSON_UNESCAPED_UNICODE);
  1897. die();
  1898. }else{
  1899. echo json_encode(array('status' => 'FALSE', 'msg' => '添加标段关注人失败'), JSON_UNESCAPED_UNICODE);
  1900. die();
  1901. }
  1902. }else{
  1903. echo json_encode(array('status' => 'FALSE', 'msg' => '标段不存在'), JSON_UNESCAPED_UNICODE);
  1904. die();
  1905. }
  1906. }else{
  1907. echo json_encode(array('status' => 'FALSE', 'msg' => '标段或关注人参数无效'), JSON_UNESCAPED_UNICODE);
  1908. die();
  1909. }
  1910. }
  1911. /**
  1912. * 取消关注标段
  1913. */
  1914. public function delConcernAudit(){
  1915. if(isset($_POST['tenderid']) && is_numeric($_POST['tenderid']) && isset($_POST['uid']) && is_numeric($_POST['uid'])){
  1916. $tendermsg = $this->actmeasure->getRowByPmid($_POST['tenderid']);
  1917. if(!empty($tendermsg)){
  1918. $result = $this->concern->delMeasureConcern($tendermsg['pmid'], $_POST['uid']);
  1919. echo json_encode(array('status' => TRUE, 'msg' => '成功取消关注'), JSON_UNESCAPED_UNICODE);
  1920. die();
  1921. }else{
  1922. echo json_encode(array('status' => 'FALSE', 'msg' => '标段不存在'), JSON_UNESCAPED_UNICODE);
  1923. die();
  1924. }
  1925. }else{
  1926. echo json_encode(array('status' => 'FALSE', 'msg' => '标段或关注人参数无效'), JSON_UNESCAPED_UNICODE);
  1927. die();
  1928. }
  1929. }
  1930. /**
  1931. * 软件生成报表开关
  1932. */
  1933. public function signSwitch(){
  1934. $reportSwitch = $this->aconfig->getOne(array('select' => 'reportswitch', 'asArray' => TRUE))['reportswitch'];
  1935. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $reportSwitch), JSON_UNESCAPED_UNICODE);
  1936. die();
  1937. }
  1938. /**
  1939. * 中间计量表添加草图功能开关
  1940. */
  1941. public function interMediateSwitch(){
  1942. $imediateswitch = $this->aconfig->getOne(array('select' => 'imediateswitch', 'asArray' => TRUE))['imediateswitch'];
  1943. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $imediateswitch), JSON_UNESCAPED_UNICODE);
  1944. die();
  1945. }
  1946. }
  1947. ?>