ClientController.php 111 KB

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