Przeglądaj źródła

计量支付附件功能

上传附件接口返回增加参数附件id
NoNZero 8 lat temu
rodzic
commit
21fa202daa

+ 7 - 0
protected/class/profile.php

@@ -35,6 +35,13 @@ class Profile
         return $this->uprofile->getOne(array('where' => 'userid=?', 'param' => array($userid), 'asArray' => TRUE));
     }
 
+    public function getVerifiedMobile($userid = 0)
+    {
+        if (!isset($userid))
+            return FALSE;
+        return $this->uprofile->getOne(array('where' => 'userid=? and isnotice=1', 'param' => array($userid), 'asArray' => TRUE));
+    }
+
     public function setAvatar($userid = 0, $avaurl)
     {
         if (!isset($userid))

+ 1 - 1
protected/config/sms.conf.php

@@ -1,5 +1,5 @@
 <?php
 $config['SMS_URL'] = 'http://sms.haotingyun.com/v2/sms/single_send.json';
 $config['SMS_AUTHKEY'] = 'fb5ef483e44b9556512a9febef376051';
-$config['SMS_TIPS'] = array('AUDIT_NOTICE' => '【纵横通行账号】您的验证码是', 'END_MSG' => ',15分钟内有效。');
+$config['SMS_TIPS'] = array('AUDIT_NOTICE' => '【纵横通行账号】您的验证码是', 'END_MSG' => ',15分钟内有效。', 'AUDIT_NOTICE_AUDITOR' => ',已审批通过,请您继续审批。');
 

+ 47 - 24
protected/controller/ClientController.php

@@ -14,6 +14,8 @@ Doo::loadClass('numofperact');
 Doo::loadClass('measureauditact');
 Doo::loadClass('itemfile');
 Doo::loadModel('users');
+Doo::loadModelAt('aconfig', 'admin');
+Doo::loadClass('sms');
 
 /**
  * MainController
@@ -24,7 +26,7 @@ Doo::loadModel('users');
 class ClientController extends DooController
 {
 
-    private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile;
+    private $data, $client, $auth, $att, $file, $zip, $actmeasure, $contractact, $project, $profile, $numofperact, $measureauditact, $attfile, $users, $itemfile, $aconfig, $sms;
     private $statusArray = array('uncheck' => '1', 'checking' => '2', 'checked' => '3', 'checkno' => '4');
     private $fileTypeArray = array('台帐附件');
 
@@ -44,6 +46,8 @@ class ClientController extends DooController
         $this->measureauditact = new MeasureauditAct();
         $this->users = new Users();
         $this->itemfile = new ItemFile();
+        $this->aconfig = new AConfig();
+        $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
     }
 
     public function ClientSignin()
@@ -740,25 +744,32 @@ class ClientController extends DooController
                     if ($this->measureauditact->setStatusTo($auditArray['maid'], 3, $auditcontent)) {
                         // 更新下一个人的状态
                         $countAudit = count($auditUserArray);
-                        if ($auditArray['last'] == '1') {
+                        if ($auditArray['last'] == '1') {// 根据标志位判断是否为最后一个审核人{ 判断当前审核人是什么角色 } 利用post发送的UID 与 当前期数参与的所有人比较
                             $this->measureauditact->setStatusTo($auditUserArray[0]['maid'], 3);
                             $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checked', $iniTimes);
                             echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
                             die();
-                        } else {
-                            if (($countAudit == 2) && ($auditUserArray[0]['last'] == 1) && ($auditUserArray[1]['maid'] == $auditArray['maid'])) {
+                        } else {// 不是最后一个审核人根据不同审核人数量变更状态 {当前用户不是最后一个审核人}
+                            if (($countAudit == 2) && ($auditUserArray[0]['last'] == 1) && ($auditUserArray[1]['maid'] == $auditArray['maid'])) {// 如果审核人为两个,第一个是最后审核人角色,第二个为当前审核人,设置审核中状态 {就是当前用户POST UID}
                                 $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
                                 $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
                                 echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
                                 die();
                             }
-                            if (($countAudit > 2)) {
+                            if (($countAudit > 2)) {// 审核人总数大于2时,
                                 foreach ($auditUserArray as $k => $v) {
-                                    if ($v['maid'] == $auditArray['maid']) {
+                                    if ($v['maid'] == $auditArray['maid']) {// 找到当前用户
                                         if ($k == ($countAudit - 1)) {//如果是最后一个
                                             $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
                                         } else {
-                                            $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
+                                            $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);//变更下一个状态
+                                            // SMS Start
+                                            $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
+                                            $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k + 1]['pmid']);
+                                            if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {
+                                                $this->__auditNotice($verifyUserArray['mobile'], $pmnameArray["pmname"] . ',' . $verifyUserArray["name"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR"]);
+                                            }
+                                            // SMS End
                                         }
                                         $this->numofperact->updateAuditStatus($_POST['tenderid'], $_POST['phaseno'], 'checking', $iniTimes);
                                         echo json_encode(array('status' => TRUE, 'msg' => ''), JSON_UNESCAPED_UNICODE);
@@ -797,7 +808,7 @@ class ClientController extends DooController
             $MeasureArray = $this->actmeasure->getRowByPmid($this->params['tenderid']);
             if (isset($updateArray['filepath'])) {
                 $pathinfo = pathinfo($updateArray['filepath']);
-                $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']);
+                $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']);
                 echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downfileurl), JSON_UNESCAPED_UNICODE);
                 die();
             } else {
@@ -858,7 +869,7 @@ class ClientController extends DooController
                 $attfileArray = $this->attfile->getLastData($value['stid']);
                 foreach ($attfileArray as $k => $v) {
                     $pathinfo = pathinfo($v['filepath']);
-                    $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $value['stname'], 'MD5_Jl' => $v['filehashcode']);
+                    $retArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . ' / ' . $pathinfo ['filename'] . ' / ProjectFile . rmf', 'proName' => $proArray['pname'], 'stName' => $value['stname'], 'MD5_Jl' => $v['filehashcode']);
                 }
             }
             echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $retArray), JSON_UNESCAPED_UNICODE);
@@ -872,7 +883,7 @@ class ClientController extends DooController
                     $attfileArray = $this->contractact->getRowByStid($attArray['stid']);
                     $pathinfo = pathinfo($attArray['filepath']);
                     if (isset($pathinfo['dirname']))
-                        $newattArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . '/' . $pathinfo ['filename'] . '/ProjectFile.rmf', 'proName' => $proArray['pname'], 'stName' => $attfileArray['stname'], 'MD5_Jl' => $attArray['filehashcode']);
+                        $newattArray[] = array('downurl' => Doo::conf()->APP_URL . $pathinfo ['dirname'] . ' / ' . $pathinfo ['filename'] . ' / ProjectFile . rmf', 'proName' => $proArray['pname'], 'stName' => $attfileArray['stname'], 'MD5_Jl' => $attArray['filehashcode']);
                 }
                 echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $newattArray), JSON_UNESCAPED_UNICODE);
                 die();
@@ -893,7 +904,7 @@ class ClientController extends DooController
     function setCheckno()
     {
         if (isset($this->params['userid']) && isset($this->params['tenderid']) && isset($this->params['phaseno']) && isset($_POST['MD5_JL']) && isset($_POST['MD5_Zip'])) {
-            $auditcontent = iconv('GBK', 'UTF-8', $_POST['CheckerMemo']);
+            $auditcontent = iconv('GBK', 'UTF - 8', $_POST['CheckerMemo']);
             $auditArrayStatus = $this->measureauditact->getLastNewRowInfo($this->params['tenderid'], $this->params['phaseno'], $this->params['userid']);
             if (isset($auditArrayStatus ['mastatus']) && (($auditArrayStatus ['mastatus'] == 'checked') || ($auditArrayStatus ['mastatus'] == 'checkno'))) {
                 echo json_encode(array('status' => FALSE, 'msg' => '该标段已审批完毕。'), JSON_UNESCAPED_UNICODE);
@@ -919,7 +930,7 @@ class ClientController extends DooController
                     }
                     $res = $this->zip->open(Doo::conf()->SITE_PATH . $fp[0]['filepath']);
                     $extPath = pathinfo($fp[0]['filepath']);
-                    $extPathdir = Doo::conf()->SITE_PATH . $extPath ['dirname'] . '/' . $extPath['filename'];
+                    $extPathdir = Doo::conf()->SITE_PATH . $extPath ['dirname'] . ' / ' . $extPath['filename'];
                     if ($res === TRUE) {
                         if (!$this->dir_create($extPathdir)) {
                             return FALSE;
@@ -956,7 +967,7 @@ class ClientController extends DooController
     {
         // 插入上次期数相关审批人员
         // TODO:
-//	error_log(var_export($this->params, TRUE), 3, '/opt/html/jiliang_customedProduct/data/' . time());
+//	error_log(var_export($this->params, TRUE), 3, ' / opt / html / jiliang_customedProduct / data / ' . time());
 //	die;
         if (isset($this->params['tenderid']) && isset($this->params['phaseno'])) {
             $auditArray = $this->numofperact->getChecknoRow($this->params['tenderid'], $this->params['phaseno']);
@@ -984,7 +995,7 @@ class ClientController extends DooController
 //                $downArray = NULL;
 //                $pathinfo = pathinfo($urlinfoArray['filepath']);
 //                if (isset($pathinfo['dirname']))
-//                    $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']);
+//                    $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']);
 //                echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
                 echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
                 die();
@@ -1015,7 +1026,7 @@ class ClientController extends DooController
                 $downArray = NULL;
                 $pathinfo = pathinfo($urlinfoArray['filepath']);
                 if (isset($pathinfo['dirname'])) {
-                    $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']);
+                    $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']);
                     echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
                     die();
                 } else {
@@ -1054,7 +1065,7 @@ class ClientController extends DooController
     public function updateTenderName()
     {
         if (isset($this->params['BidID']) && isset($this->params['BidNewName'])) {
-            if ($this->actmeasure->updateName($this->params['BidID'], iconv('GBK', 'UTF-8', $this->params['BidNewName']))) {
+            if ($this->actmeasure->updateName($this->params['BidID'], iconv('GBK', 'UTF - 8', $this->params['BidNewName']))) {
                 echo json_encode(array('status' => 'TRUE', 'msg' => ''), JSON_UNESCAPED_UNICODE);
                 die();
             } else {
@@ -1081,13 +1092,13 @@ class ClientController extends DooController
             }
             $fileArray = $this->upItemFile('upitem')[0];
             if (isset($fileArray['filepath'])) {
-                $memoStr = iconv('GBK', 'UTF-8', $_POST['Memo']);
-                $fnArray = explode('.', $fileArray['filename']);
-                $filenameStr = iconv('GBK', 'UTF-8', $fnArray[0]);
+                $memoStr = iconv('GBK', 'UTF - 8', $_POST['Memo']);
+                $fnArray = explode(' . ', $fileArray['filename']);
+                $filenameStr = iconv('GBK', 'UTF - 8', $fnArray[0]);
                 $postArray = array('mpid' => $this->params['tenderid'], 'ownerid' => $this->params['uid'], 'itemid' => $_POST['itemid'], 'filename' => $filenameStr, 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'categoryid' => array_search($_POST['Category'], $this->fileTypeArray), 'tips' => $memoStr);
                 if ($this->itemfile->insertItemFileRecord($postArray) > 1) {
                     $extPath = pathinfo($fileArray['filepath']);
-                    $itemArray = array('onlineFileName' => $extPath['filename'] . '.' . $extPath['extension']);
+                    $itemArray = array('onlineFileName' => $extPath['filename'] . ' . ' . $extPath['extension']);
                     $status = array('status' => TRUE, 'msg' => '', 'iteminfo' => $itemArray);
                     echo json_encode($status, JSON_UNESCAPED_UNICODE);
                     die();
@@ -1111,7 +1122,7 @@ class ClientController extends DooController
             if ($key >= 0) {
                 foreach ($itemfileArray as $value) {
                     $profileArray = $this->profile->getProWithUid($value['ownerid']);
-                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . '.' . $value['fileext'], 'fileext' => $value['fileext'], 'ownerName' => $profileArray['name'], 'itemid' => $value['itemid'], 'Category' => $this->fileTypeArray[$value['categoryid']], 'Memo' => $value['tips'], 'ownerid' => $value['ownerid'], 'uptime' => date('Y-m-d H:i', $value['intime']), 'fileid' => $value['iaid']);
+                    $downArray[] = array('downurl' => Doo::conf()->APP_URL . $value['filepath'], 'filename' => $value['filename'] . ' . ' . $value['fileext'], 'fileext' => $value['fileext'], 'ownerName' => $profileArray['name'], 'itemid' => $value['itemid'], 'Category' => $this->fileTypeArray[$value['categoryid']], 'Memo' => $value['tips'], 'ownerid' => $value['ownerid'], 'uptime' => date('Y - m - d H:i', $value['intime']), 'fileid' => $value['iaid']);
                 }
                 echo json_encode(array('status' => TRUE, 'msg' => '', 'info' => $downArray), JSON_UNESCAPED_UNICODE);
                 die();
@@ -1164,6 +1175,18 @@ class ClientController extends DooController
         }
     }
 
+    /**
+     *   。
+     *   标段ID,期号
+     */
+    private function __auditNotice($mobile, $text)
+    {
+        $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
+        if ($smsSwitch > 0)
+            return $this->sms->sendSms($mobile, $text);
+
+    }
+
     function upfile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
     {
         return $this->att->uploadMut($fildname, $param);
@@ -1261,9 +1284,9 @@ class ClientController extends DooController
 
     function dir_path($path)
     {
-        $path = str_replace('\\', '/', $path);
-        if (substr($path, -1) != '/')
-            $path = $path . '/';
+        $path = str_replace('\\', ' / ', $path);
+        if (substr($path, -1) != ' / ')
+            $path = $path . ' / ';
         return $path;
     }