AppController.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. /**
  20. * MainController
  21. * Feel free to delete the methods and replace them with your own code.
  22. *
  23. * @author EllisRan
  24. */
  25. class AppController extends DooController {
  26. private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $modelconfig, $aconfig, $sms, $itemMeasureNum;
  27. private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
  28. private $fileTypeArray = array('台帐附件');
  29. public function __construct()
  30. {
  31. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  32. $this->client = new client();
  33. $this->auth = new Auth();
  34. $this->att = new attachment();
  35. $this->attfile = new attFile();
  36. // $this->zip = new ZipArchive();
  37. $this->actmeasure = new actMeasure();
  38. $this->contractact = new Contractact();
  39. $this->project = new Project();
  40. $this->profile = new Profile();
  41. $this->numofperact = new NumofperAct();
  42. $this->measureauditact = new MeasureauditAct();
  43. $this->users = new Users();
  44. $this->itemfile = new ItemFile();
  45. $this->modelconfig = new AConfig();
  46. $this->itemMeasureNum = new ItemMeasureNumpofper();
  47. $this->aconfig = new AConfig();
  48. $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
  49. }
  50. public function ServerLogin() {
  51. if(isset($_POST['sname']) && !empty($_POST['sname'])){
  52. $allserver = array($_SERVER['HTTP_HOST']);
  53. if(in_array(trim($_POST['sname']), $allserver)){
  54. echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
  55. die;
  56. }else{
  57. echo json_encode(array('status' => FALSE, 'msg' => '服务器不存在。'), JSON_UNESCAPED_UNICODE);
  58. die;
  59. }
  60. }else{
  61. echo json_encode(array('status' => FALSE, 'msg' => '请输入服务器名称。'), JSON_UNESCAPED_UNICODE);
  62. die;
  63. }
  64. }
  65. public function AppSignin() {
  66. if(!isset($_POST['username']) || empty($_POST['username'])){
  67. echo json_encode(array('status' => FALSE, 'msg' => '请输入邮箱'), JSON_UNESCAPED_UNICODE);
  68. die;
  69. }
  70. if(!isset($_POST['userpwd']) || empty($_POST['userpwd'])){
  71. echo json_encode(array('status' => FALSE, 'msg' => '请输入密码'), JSON_UNESCAPED_UNICODE);
  72. die;
  73. }
  74. if ($this->auth->login($_POST['username'], $_POST['userpwd'])) {
  75. $uinfo = $this->auth->getUinfo();
  76. if (isset($uinfo['isstop']) && $uinfo['isstop'] > 0) {
  77. echo json_encode(array('status' => FALSE, 'msg' => '邮箱不存在或者密码错误'), JSON_UNESCAPED_UNICODE);
  78. die;
  79. }
  80. if (isset($uinfo['uid'])) {
  81. $userArray = $this->profile->getProWithUid($uinfo['uid']);
  82. $avatarStr = $userArray['avatar'];
  83. if (isset($userArray['userid'])) {
  84. // $this->auth->setUid($uinfo['uid']);
  85. $msgArray = array('uid' => $uinfo['uid'], 'name' => $userArray['name'], 'email' => $uinfo['uemail'], 'ucompany' => $userArray['company'], 'jobtitle' => $userArray['jobs'], 'avatar' => Doo::conf()->APP_URL . $avatarStr);
  86. echo json_encode(array('status' => TRUE, 'msg' => '', 'userinfo' => $msgArray), JSON_UNESCAPED_UNICODE);
  87. die;
  88. }
  89. }
  90. } else {
  91. echo json_encode(array('status' => FALSE, 'msg' => '邮箱不存在或者密码错误'), JSON_UNESCAPED_UNICODE);
  92. die;
  93. }
  94. }
  95. // 获取待审批标段名
  96. public function UnSectionList(){
  97. if(isset($_POST['uid']) && !empty($_POST['uid']) && is_numeric($_POST['uid'])){
  98. $unsectionlist = $this->measureauditact->getCheckedRowbyUID6($_POST['uid']);
  99. $unslist = array();
  100. if(!empty($unsectionlist)){
  101. foreach($unsectionlist as $k => $v){
  102. $unslist[$k]['pname'] = $this->project->getRowByPid($v['pid'])['pname'];
  103. $unslist[$k]['sectionlist'] = array();
  104. $sectionlist = $this->measureauditact->getCheckedRowbyUID7($_POST['uid'],$v['pid']);
  105. if(!empty($sectionlist)){
  106. foreach($sectionlist as $sk => $sv){
  107. $name = $this->actmeasure->getRowByPmid($sv['pmid']);
  108. $unslist[$k]['sectionlist'][$sk]['pmname'] = !empty($name) ? $name['pmname'] : '';
  109. $countNum = $this->numofperact->getLastNew2($sv['pmid'])['numpname'];
  110. $unslist[$k]['sectionlist'][$sk]['countNum'] = !empty($countNum) ? $countNum : 0;
  111. $unslist[$k]['sectionlist'][$sk]['audittime'] = !empty($sv['audittime']) ? date('Y-m-d',$sv['audittime']) : '';
  112. $unslist[$k]['sectionlist'][$sk]['url'] = '/app/rproject/' . $sv['pid'] . '/section/' . $sv['pmid'] . '/detail';
  113. $stname = $this->contractact->getRowByStid($sv['stid']);
  114. $unslist[$k]['sectionlist'][$sk]['stname'] = !empty($stname) ? $stname['stname'] : '';
  115. }
  116. }
  117. }
  118. }
  119. echo json_encode(array('status' => TRUE, 'msg' => '', 'unsectionlist' => $unslist), JSON_UNESCAPED_UNICODE);
  120. die();
  121. }else{
  122. $status = array('status' => FALSE, 'msg' => '获取待审批标段列表出错');
  123. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  124. die();
  125. }
  126. }
  127. //获取已审核项目名
  128. public function ItemCkeckedList(){
  129. if(isset($_POST['uid']) && !empty($_POST['uid']) && is_numeric($_POST['uid'])){
  130. $Itemlist = $this->measureauditact->getCheckedRowbyUID3($_POST['uid']);
  131. $Itemcheckedlist = array();
  132. if(!empty($Itemlist)){
  133. foreach($Itemlist as $k => $v){
  134. $name = $this->project->getRowByPid($v['pid']);
  135. $Itemcheckedlist[$k]['pid'] = $v['pid'];
  136. $Itemcheckedlist[$k]['pname'] = $name['pname'];
  137. }
  138. }
  139. echo json_encode(array('status' => TRUE, 'msg' => '', 'Itemlist' => $Itemcheckedlist), JSON_UNESCAPED_UNICODE);
  140. die();
  141. }else{
  142. $status = array('status' => FALSE, 'msg' => '获取已审核项目列表出错');
  143. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  144. die();
  145. }
  146. }
  147. //获取已审核项目中已审核标段的信息
  148. public function SectionCheckedList(){
  149. if(isset($_POST['uid']) && is_numeric($_POST['uid']) && isset($this->params['pid']) && is_numeric($this->params['pid'])){
  150. //先获取标段类型列表
  151. $stlist = $this->measureauditact->getCheckedRowbyUID4($_POST['uid'], $this->params['pid']);
  152. $sectioncheckedlist = array();
  153. if(!empty($stlist)){
  154. $i = 0;
  155. foreach($stlist as $k => $v){
  156. //再获取标段名信息
  157. $sectionlist = $this->measureauditact->getCheckedRowbyUID5($_POST['uid'], $this->params['pid'],$v['stid']);
  158. $sectioncheckedlistarray = array();
  159. if(!empty($sectionlist)){
  160. $j = 0;
  161. foreach($sectionlist as $key => $value){
  162. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $value['pmid']);
  163. if (!isset($numStatusArray['currstatus'])) {
  164. $numStatusArray['currstatus'] = 'uncheck';
  165. }
  166. $datatmp = $this->measureauditact->getMyAuditStatus2($numStatusArray['pmid'], $numStatusArray['numpname'], $numStatusArray['times'], $_POST['uid']);
  167. if ($datatmp && ($datatmp['mastatus'] == 'checked' || $datatmp['mastatus'] == 'checkno') ) {
  168. $pmname = $this->actmeasure->getRowByPmid($value['pmid']);
  169. $sectioncheckedlistarray[$j]['pmname'] = !empty($pmname) ? $pmname['pmname'] : '';
  170. $sectioncheckedlistarray[$j]['countNum'] = !empty($datatmp['numpname']) ? $datatmp['numpname'] : 0;
  171. $sectioncheckedlistarray[$j]['audittime'] = !empty($datatmp['audittime']) ? date('Y-m-d',$datatmp['audittime']) : '';
  172. $sectioncheckedlistarray[$j]['url'] = '/app/rproject/' . $this->params['pid'] . '/section/' . $value['pmid'] . '/detail';
  173. $j++;
  174. }
  175. }
  176. }
  177. if(!empty($sectioncheckedlistarray)){
  178. $stname = $this->contractact->getRowByStid($v['stid']);
  179. $sectioncheckedlist[$i]['stname'] = !empty($stname['stname']) ? $stname['stname'] : '';
  180. $sectioncheckedlist[$i]['stlist'] = $sectioncheckedlistarray;
  181. }
  182. $i++;
  183. }
  184. }
  185. echo json_encode(array('status' => TRUE, 'msg' => '', 'sectionlist' => $sectioncheckedlist), JSON_UNESCAPED_UNICODE);
  186. die();
  187. }else{
  188. $status = array('status' => FALSE, 'msg' => '获取已审核标段列表出错');
  189. echo json_encode($status, JSON_UNESCAPED_UNICODE);
  190. die();
  191. }
  192. }
  193. //内嵌app页
  194. public function proDetail() {
  195. if(isset($_GET['uid']) && is_numeric($_GET['uid'])) {
  196. if(isset($_GET['approval'])){
  197. $this->data['approval'] = 1;
  198. }
  199. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $this->params['pmid']);
  200. if (!isset($numStatusArray['currstatus'])) {
  201. $numStatusArray['currstatus'] = 'uncheck';
  202. }
  203. // 项目名称
  204. $mpidArray = $this->measureauditact->getAuditProject2($_GET['uid']);
  205. foreach ($mpidArray as $k1 => $v1) {
  206. if ($v1['pid'] != $this->params['pid'])
  207. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  208. }
  209. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  210. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  211. $this->data['MeasureArray3'] = array_reverse($this->data['MeasureArray']);
  212. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  213. foreach ($this->data['MeasureArray'] as $key => $value) {
  214. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  215. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  216. } else {
  217. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  218. }
  219. }
  220. // 期数列表
  221. $tmpArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  222. foreach ($tmpArray as $k => $v) {
  223. $intTime = $this->numofperact->getMaxTimes($v['pmid'], $v['numpname'])['times'];
  224. $nfArray[] = $this->numofperact->getRow($v['pmid'], $v['numpname'], $intTime);
  225. }
  226. foreach ($nfArray as $k => $v) {
  227. if ($v['mpid'] == $numStatusArray['mpid']) {
  228. $this->data['mpid'] = $v['mpid'];
  229. $this->data['MeasureArray2'][] = $v;
  230. $this->data['currnum'] = $v['numpname'];
  231. } else {
  232. $this->data['numArray'][] = $v;
  233. }
  234. }
  235. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  236. foreach ($this->data['MeasureArray2'] as $key => $value) {
  237. if ($value['mpid'] == $numStatusArray['mpid']) {
  238. $this->data['MeasureArray2'][$key]['currstatus'] = $this->statusArray[$value['currstatus']];
  239. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  240. $this->data['MeasureArray2'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  241. } else {
  242. $this->data['MeasureArray2'][$key]['lessTotal'] = 0;
  243. }
  244. }
  245. }
  246. $lastRowArray = $this->numofperact->getLastNew2($this->params['pmid']);
  247. $maxTimes = $this->numofperact->getMaxTimes($lastRowArray['pmid'], $lastRowArray['numpname']);
  248. // $auditUserArray = $this->measureauditact->getAllAudit($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  249. $maxtimez = $this->measureauditact->getRowGroupByTimes($numStatusArray['mpid']);
  250. $auditUserArray = $this->measureauditact->getRowByMpidTimes($numStatusArray['mpid'], $maxtimez['times']);
  251. $auditArray = $this->measureauditact->getLastNewRowInfo($lastRowArray['pmid'], $lastRowArray['numpname'], $_GET['uid']);
  252. if (isset($_POST['act'])) {
  253. $auditStatusArray = array('checkno', 'checked');
  254. $myAuditStatus = $this->measureauditact->getMyAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times'], $_GET['uid']);
  255. if (in_array($myAuditStatus['mastatus'], $auditStatusArray)) {
  256. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  257. die();
  258. }
  259. }
  260. if ($_POST['act'] == 'p') {
  261. if ($this->measureauditact->setMyAuditPass($auditArray['maid'], $_POST['content'], 1, $_GET['uid'])) {
  262. $countAudit = count($auditUserArray);
  263. $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  264. if ($auditArray['last'] == 1) {
  265. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checked', $maxTimes['times']);
  266. // SMS Start
  267. $TenderArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  268. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  269. if (isset($userProArray) && ($userProArray['mobile'])) {
  270. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR3"]);
  271. }
  272. // SMS End
  273. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  274. die();
  275. } else {
  276. if (($countAudit == 2) && ($auditUserArray[1]['last'] == 1) && ($auditUserArray[0]['maid'] == $auditArray['maid'])) {
  277. $this->measureauditact->updateMastatus($auditUserArray[1]['maid']);
  278. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
  279. // SMS Start
  280. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[1]['auditoruid']);
  281. $pmnameArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  282. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
  283. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  284. }
  285. // SMS End
  286. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  287. die();
  288. }
  289. if (($countAudit > 2)) {
  290. foreach ($auditUserArray as $k => $v) {
  291. if ($v['maid'] == $auditArray['maid']) {
  292. if ($k == ($countAudit - 1)) {//如果是最后一个
  293. $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
  294. // SMS Start
  295. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
  296. // var_dump($verifyUserArray);
  297. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
  298. // var_dump($pmnameArray);
  299. // SMS End
  300. } else {
  301. $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
  302. // SMS Start
  303. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
  304. // var_dump($verifyUserArray);
  305. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k + 1]['pmid']);
  306. // var_dump($pmnameArray);
  307. // SMS End
  308. }
  309. // SMS Start
  310. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
  311. // $retval = $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  312. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  313. // var_dump($pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  314. // var_dump($retval);
  315. // var_dump($this->sms->getErrors());
  316. }
  317. // SMS End
  318. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
  319. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  320. die();
  321. }
  322. }
  323. }
  324. }
  325. }
  326. }
  327. if ($_POST['act'] == 'np') {
  328. $this->measureauditact->setCheckno($auditArray['maid'], $_POST['content'], 1);
  329. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checkno', $maxTimes['times']);
  330. $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  331. // SMS Start
  332. $TenderArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  333. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  334. if (isset($userProArray) && ($userProArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
  335. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  336. // var_dump($retval);
  337. // var_dump($this->sms->getErrors());
  338. // $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  339. }
  340. // SMS End
  341. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  342. die();
  343. }
  344. $this->data['pmid'] = $lastRowArray['pmid'];
  345. $this->data['numpname'] = $lastRowArray['numpname'];
  346. $this->data['times'] = $lastRowArray['times'];
  347. foreach ($auditUserArray as $key => $value) {
  348. $strAvatar = $this->auth->getAvatar($value['auditoruid']);
  349. if ($value['auditoruid'] == $_GET['uid']) {
  350. $this->data['mastatus'] = $value['mastatus'];
  351. $this->data['maid'] = $value['maid'];
  352. $name = $this->profile->getProWithUid($value['auditoruid'])['name'].'(我)';
  353. }else{
  354. $name = $this->profile->getProWithUid($value['auditoruid'])['name'];
  355. }
  356. if ($value['mastatus'] == 'uncheck') {
  357. $statushtml = '<div class="approvalImg"><img class="pa2ss" src="'. $strAvatar .'">'.$name.'<b class="colGray fR">待审</b></div>';
  358. }
  359. if ($value['mastatus'] == 'checking') {
  360. $statushtml = '<div class="approvalImg"><img class="wait" src="'. $strAvatar .'">'.$name.'<b class="colOrange fR">审批中</b></div>';
  361. }
  362. if ($value['mastatus'] == 'checked') {
  363. $statushtml = '<div class="approvalImg"><img class="pass" src="'. $strAvatar .'">'.$name.'<b class="colGreen fR">审批完成(' . date('Y-m-d', $value['audittime']) . ')</b></div>';
  364. }
  365. if ($value['mastatus'] == 'checkno') {
  366. $statushtml = '<div class="approvalImg"><img class="unpass" src="'. $strAvatar .'">'.$name.'<b class="colRed fR">审批不通过(' . date('Y-m-d', $value['audittime']) . ')</b></div>';
  367. }
  368. $auditUserArray[$key]['statushtml'] = $statushtml;
  369. }
  370. $strAvatar = $this->auth->getAvatar($measureArray['uid']);
  371. $orginArrayname = $this->profile->getProWithUid($measureArray['uid'])['name'];
  372. $attfileArray = $this->attfile->getFirstFile($lastRowArray['pmid'], $lastRowArray['numpname'], $lastRowArray['times']);
  373. $orginArray['time'] = date('Y-m-d', $attfileArray['intime']);
  374. $orginArray['statushtml'] = '<div class="approvalImg"><img class="pass" src="'. $strAvatar .'">'.$orginArrayname.'<b class="colGreen fR">原报上报(' . $orginArray['time'] . ')</b></div>';
  375. $this->data['auditArray'] = $auditUserArray;
  376. $this->data['orginArray'] = $orginArray;
  377. $this->data['uid'] = $_GET['uid'];
  378. $this->data['pmid'] = $this->params['pmid'];
  379. $this->data['pid'] = $this->params['pid'];
  380. $this->data['mpid'] = $numStatusArray['mpid'];
  381. $this->render('r-project-section-detail-APP', $this->data, TRUE);
  382. }else{
  383. exit('error:无参数无法访问本页');
  384. }
  385. }
  386. //二维数组去掉重复值 并保留键值
  387. function array_unique_fb($array2D)
  388. {
  389. $key = array();
  390. foreach ($array2D as $k => $v) {
  391. if (empty($key))
  392. $key = array_keys($v); //记录数组的KEY
  393. $v = join(",", $v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
  394. $temp[$k] = $v;
  395. }
  396. $temp = array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
  397. foreach ($temp as $k => $v) {
  398. $array = explode(",", $v); //再将拆开的数组重新组装
  399. foreach ($array as $i => $t) {
  400. $temp2[$k] = !empty($temp2[$k]) ? array_merge($temp2[$k], array("{
  401. $key[$i]}" => $t)) : array("{
  402. $key[$i]}" => $t); //依次添加到新的数组中去
  403. }
  404. }
  405. return $temp2;
  406. }
  407. function unique_arr($array2D, $stkeep = false, $ndformat = true)
  408. {
  409. // 判断是否保留一级数组键 (一级数组键可以为非数字)
  410. if ($stkeep)
  411. $stArr = array_keys($array2D);
  412. // 判断是否保留二级数组键 (所有二级数组键必须相同)
  413. if ($ndformat)
  414. $ndArr = array_keys(end($array2D));
  415. //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
  416. foreach ($array2D as $v) {
  417. $v = join(",", $v);
  418. $temp[] = $v;
  419. }
  420. //去掉重复的字符串,也就是重复的一维数组
  421. $temp = array_unique($temp);
  422. //再将拆开的数组重新组装
  423. foreach ($temp as $k => $v) {
  424. if ($stkeep)
  425. $k = $stArr[$k];
  426. if ($ndformat) {
  427. $tempArr = explode(",", $v);
  428. foreach ($tempArr as $ndkey => $ndval) {
  429. $output[$k][$ndArr[$ndkey]] = $ndval;
  430. }
  431. } else {
  432. $output[$k] = explode(",", $v);
  433. }
  434. }
  435. return $output;
  436. }
  437. /**
  438. * 。
  439. * 标段ID,期号
  440. */
  441. private function __auditNotice($mobile, $text)
  442. {
  443. $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
  444. if ($smsSwitch > 0)
  445. return $this->sms->sendSms($mobile, $text);
  446. }
  447. function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  448. {
  449. return $this->att->uploadMut($fildname, $param);
  450. }
  451. function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  452. {
  453. $this->att->setUploadDir();
  454. return $this->att->uploadMut($fildname, $param);
  455. }
  456. /**
  457. * 根据标段ID获取标段是否已经被删除的提示
  458. * 标段ID
  459. */
  460. public function getCountPmid()
  461. {
  462. if (isset($this->params['tenderid'])) {
  463. $isexist = $this->actmeasure->getCountPmid($this->params['tenderid']);
  464. if ($isexist > 0) {
  465. echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => null), JSON_UNESCAPED_UNICODE);
  466. die();
  467. } else {
  468. echo json_encode(array('status' => 'FALSE', 'msg' => '该项目[XXX]在云端已被删除,点击“确定”后,可手动删除该项目'), JSON_UNESCAPED_UNICODE);
  469. die();
  470. }
  471. } else {
  472. $this->msg(0, '获取标段是否存在参数错误');
  473. }
  474. }
  475. function getFileupErrorNo()
  476. {
  477. return $this->att->error();
  478. }
  479. function Signout()
  480. {
  481. session_destroy();
  482. }
  483. function isLoggedIn()
  484. {
  485. return isset($_SESSION['user_id']);
  486. }
  487. function generateFormHash($salt)
  488. {
  489. $hash = md5(mt_rand(1, 1000000) . $salt);
  490. $_SESSION['csrf_hash'] = $hash;
  491. return $hash;
  492. }
  493. function isValidFormHash($hash)
  494. {
  495. return $_SESSION['csrf_hash'] === $hash;
  496. }
  497. /**
  498. * 随机字符串函数
  499. * @param $password 密码
  500. * @param $random 随机数
  501. */
  502. function random($length, $chars = '0123456789')
  503. {
  504. $hash = '';
  505. $max = strlen($chars) - 1;
  506. for ($i = 0; $i < $length; $i++) {
  507. $hash .= $chars[mt_rand(0, $max)];
  508. }
  509. return $hash;
  510. }
  511. /**
  512. * 生成随机字符串
  513. * @param string $lenth 长度
  514. * @return string 字符串
  515. */
  516. function create_randomstr($lenth = 6)
  517. {
  518. return $this->random($lenth, '123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ');
  519. }
  520. function dir_create($path, $mode = 0777)
  521. {
  522. if (is_dir($path))
  523. return TRUE;
  524. $path = $this->dir_path($path);
  525. $parent = dirname($path);
  526. if (!is_dir($parent))
  527. @mkdir($parent, 0777, true);
  528. @mkdir($path, 0777, true);
  529. return is_dir($path);
  530. }
  531. function dir_path($path)
  532. {
  533. $path = str_replace('\\', '/', $path);
  534. if (substr($path, -1) != '/')
  535. $path = $path . '/';
  536. return $path;
  537. }
  538. function msg($isTrue = 0, $msg = null, $retmsg = null)
  539. {
  540. if ($isTrue > 0) {
  541. echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
  542. die();
  543. } else {
  544. echo json_encode(array('status' => 'FALSE', 'msg' => $msg), JSON_UNESCAPED_UNICODE);
  545. die();
  546. }
  547. }
  548. // function checkVersion($version)
  549. // {
  550. // preg_match();
  551. // }
  552. }
  553. ?>