Browse Source

计量支付
在线审批终审
禅道973 972

NoNZero 9 years ago
parent
commit
6f8b571475

+ 127 - 110
protected/class/auth.php

@@ -9,140 +9,157 @@ Doo::loadModelAt('ausers', 'admin');
 Doo::loadClass('user');
 Doo::loadModel('uprofile');
 
-class Auth {
+class Auth
+{
 
     private $users, $usession, $user, $uinfo, $ausers, $profile;
 
-    public function __construct() {
-	$this->users = new Users();
-	$this->usession = new Usession();
-	$this->user = new User();
-	$this->ausers = new AUsers();
-	$this->profile = new Uprofile();
+    public function __construct()
+    {
+        $this->users = new Users();
+        $this->usession = new Usession();
+        $this->user = new User();
+        $this->ausers = new AUsers();
+        $this->profile = new Uprofile();
     }
 
-    private function __setcookie($key, $value) {
-	setcookie($this->cookiePre . $key, $value, 0, '/', $this->siteUrl, 0);
+    private function __setcookie($key, $value)
+    {
+        setcookie($this->cookiePre . $key, $value, 0, '/', $this->siteUrl, 0);
     }
 
-    public function login($uname, $upasswd) {
-	$uinfo = $this->checkLogin($uname, $upasswd);
-	if (isset($uinfo['uid'])) {
-	    $this->uinfo = $uinfo;
-	    return TRUE;
-	} else {
-	    return FALSE;
-	}
+    public function login($uname, $upasswd)
+    {
+        $uinfo = $this->checkLogin($uname, $upasswd);
+        if (isset($uinfo['uid'])) {
+            $this->uinfo = $uinfo;
+            return TRUE;
+        } else {
+            return FALSE;
+        }
     }
 
-    public function getUinfo() {
-	return $this->uinfo;
+    public function getUinfo()
+    {
+        return $this->uinfo;
     }
 
-    public function getUid() {
-	if (isset($_SESSION['uid']) && $_SESSION['uid']) {
-	    return $_SESSION['uid'];
-	} else {
-	    return FALSE;
-	}
+    public function getUid()
+    {
+        if (isset($_SESSION['uid']) && $_SESSION['uid']) {
+            return $_SESSION['uid'];
+        } else {
+            return FALSE;
+        }
     }
 
-    public function getUemail() {
-	if (isset($_SESSION['uemail']) && $_SESSION['uemail']) {
-	    return $_SESSION['uemail'];
-	} else {
-	    return 0;
-	}
+    public function getUemail()
+    {
+        if (isset($_SESSION['uemail']) && $_SESSION['uemail']) {
+            return $_SESSION['uemail'];
+        } else {
+            return 0;
+        }
     }
 
-    public function setUid($uid) {
-	return $_SESSION['uid'] = $uid;
+    public function setUid($uid)
+    {
+        return $_SESSION['uid'] = $uid;
     }
 
-    public function setUemail($uemail) {
-	return $_SESSION['uemail'] = $uemail;
+    public function setUemail($uemail)
+    {
+        return $_SESSION['uemail'] = $uemail;
     }
 
-    public function getAvatar($uid) {
+    public function getAvatar($uid)
+    {
 //	$dir1 = ceil($uid / 10000);
 //	$dir2 = ceil($uid % 10000 / 1000);
 //	$url = 'http://sso.smartcost.com.cn/' . 'data/avatar/' . $dir1 . '/' . $dir2 . '/' . $uid . '/';
 //	$avatar = array('180' => $url . '180x180.jpg', '90' => $url . '90x90.jpg', '45' => $url . '45x45.jpg', '30' => $url . '30x30.jpg');
 //	return $avatar;
-	$valArray = $this->profile->getOne(array('where' => 'userid=?', 'param' => array($uid), 'asArray' => TRUE));
-	return Doo::conf()->APP_URL . $valArray['avatar'];
-    }
-
-    public function checkLogin($uemail, $upasswd) {
-	return $this->user->login($uemail, $upasswd);
-    }
-
-    public function logout() {
-	session_destroy();
-	setcookie('token', '-1', 0, '/', 'jl.local', FALSE, TRUE);
-    }
-
-    public function checkauth() {
-	//TODO 启用SESSION变量避免重复查询数据库
-	if (isset($_COOKIE['M0s5Yi_yn_k']) && isset($_COOKIE['M0s5Yi_yn_v'])) {
-	    $uname = $this->decryptCookie($_COOKIE['M0s5Yi_yn_k']);
-	    $passwd = $this->decryptCookie($_COOKIE['M0s5Yi_yn_v']);
-	    if ($uname && $passwd) {
-		return TRUE;
-	    } else {
-		return FALSE;
-	    }
-	} else {
-	    return FALSE;
-	}
-    }
-
-    function isLoggedIn() {
-	if (isset($_SESSION['token']) && isset($_COOKIE['token'])) {
-	    if ($_SESSION['token'] != $_COOKIE['token']) {
-		return TRUE;
-	    }
-	}
-	return FALSE;
-    }
-
-    public function getUname() {
-	//TODO 启用SESSION变量避免重复查询数据库
-	if (isset($_COOKIE['M0s5Yi_yn_k']) && isset($_COOKIE['M0s5Yi_yn_v'])) {
-	    $uname = $this->decryptCookie($_COOKIE['M0s5Yi_yn_k']);
-	    $passwd = $this->decryptCookie($_COOKIE['M0s5Yi_yn_v']);
-	    if ($uname && $passwd) {
-		return $uname;
-	    } else {
-		return FALSE;
-	    }
-	} else {
-	    return FALSE;
-	}
-    }
-
-    private function encryptCookie($value) {
-	if (!$value) {
-	    return false;
-	}
-	$key = '290234lk23jk23djLHSWCs92s';
-	$text = $value;
-	$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
-	$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
-	$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
-	return trim(base64_encode($crypttext)); //encode for cookie
-    }
-
-    private function decryptCookie($value) {
-	if (!$value) {
-	    return false;
-	}
-	$key = '290234lk23jk23djLHSWCs92s';
-	$crypttext = base64_decode($value); //decode cookie
-	$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
-	$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
-	$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv);
-	return trim($decrypttext);
+        $valArray = $this->profile->getOne(array('where' => 'userid=?', 'param' => array($uid), 'asArray' => TRUE));
+        return Doo::conf()->APP_URL . $valArray['avatar'];
+    }
+
+    public function checkLogin($uemail, $upasswd)
+    {
+        return $this->user->login($uemail, $upasswd);
+    }
+
+    public function logout()
+    {
+        session_destroy();
+        setcookie('token', '-1', 0, '/', 'jl.local', FALSE, TRUE);
+    }
+
+    public function checkauth()
+    {
+        //TODO 启用SESSION变量避免重复查询数据库
+        if (isset($_COOKIE['M0s5Yi_yn_k']) && isset($_COOKIE['M0s5Yi_yn_v'])) {
+            $uname = $this->decryptCookie($_COOKIE['M0s5Yi_yn_k']);
+            $passwd = $this->decryptCookie($_COOKIE['M0s5Yi_yn_v']);
+            if ($uname && $passwd) {
+                return TRUE;
+            } else {
+                return FALSE;
+            }
+        } else {
+            return FALSE;
+        }
+    }
+
+    function isLoggedIn()
+    {
+        if (isset($_SESSION['token']) && isset($_COOKIE['token'])) {
+            if ($_SESSION['token'] != $_COOKIE['token']) {
+                return TRUE;
+            }
+        }
+        return FALSE;
+    }
+
+    public function getUname()
+    {
+        //TODO 启用SESSION变量避免重复查询数据库
+        if (isset($_COOKIE['M0s5Yi_yn_k']) && isset($_COOKIE['M0s5Yi_yn_v'])) {
+            $uname = $this->decryptCookie($_COOKIE['M0s5Yi_yn_k']);
+            $passwd = $this->decryptCookie($_COOKIE['M0s5Yi_yn_v']);
+            if ($uname && $passwd) {
+                return $uname;
+            } else {
+                return FALSE;
+            }
+        } else {
+            return FALSE;
+        }
+    }
+
+    private function encryptCookie($value)
+    {
+        if (!$value) {
+            return false;
+        }
+        $key = '290234lk23jk23djLHSWCs92s';
+        $text = $value;
+        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
+        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
+        $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
+        return trim(base64_encode($crypttext)); //encode for cookie
+    }
+
+    private function decryptCookie($value)
+    {
+        if (!$value) {
+            return false;
+        }
+        $key = '290234lk23jk23djLHSWCs92s';
+        $crypttext = base64_decode($value); //decode cookie
+        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
+        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
+        $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv);
+        return trim($decrypttext);
     }
 
 }

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

@@ -19,7 +19,7 @@ $route['*']['/project/:pid/section/:pmid/detail'] = array('ProjectController', '
 $route['*']['/rproject/index'] = array('RProjectController', 'index');
 $route['*']['/rproject/:pid/section'] = array('RProjectController', 'proSection');
 $route['*']['/rproject/:pid/section/:mpid/measure'] = array('RProjectController', 'proSectionMeasure');
-$route['*']['/rproject/:pid/section/:pmid/detail/:mpid'] = array('RProjectController', 'proDetail');
+$route['*']['/rproject/:pid/section/:pmid/detail'] = array('RProjectController', 'proDetail');
 $route['*']['/rproject/:pmid/measure/detail'] = array('RProjectController', 'proMeasure');
 $route['*']['/rproject/:pid/section/:pmid/report/:mpid'] = array('RProjectController', 'proReport');
 // S

+ 11 - 6
protected/controller/RProjectController.php

@@ -141,7 +141,10 @@ class RProjectController extends DooController
                         $dispstopnowtotal = $pstopnowtotal . '%';
                         $pnowtotal = 100 - $pcurrdone - $pstopnowtotal;
                         $dispnowtotal = $pnowtotal . '%';
-                        $countNum = $this->numofperact->getCountTotalnum($v['pmid']);
+                        $countNum = $this->numofperact->getLastNew2($v['pmid'])['numpname'];
+                        if (!isset($countNum)) {
+                            $countNum = 0;
+                        }
                         $numStatusArray = $this->numofperact->getLastStatus($this->params['pid'], $v['pmid']);
                         if (!isset($numStatusArray['currstatus'])) {
                             $numStatusArray['currstatus'] = 'uncheck';
@@ -153,7 +156,7 @@ class RProjectController extends DooController
                             $buttonhtml = '(<span class="colOrange">' . $this->statusArray[$numStatusArray['currstatus']] . '</span>)';
                         }
                         $html .= '<tr>
-                                    <td><a href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/detail/' . $numStatusArray['mpid'] . '">' . $v['pmname'] . '</a></td>
+                                    <td><a href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/detail">' . $v['pmname'] . '</a></td>
                                     <td class="">第 ' . $countNum . ' 期 ' . $buttonhtml . '</td>
                                     <td class="taR">¥' . number_format($v['contracttotal'], 2, '.', ',') . '</td>
                                     <td>
@@ -270,6 +273,7 @@ class RProjectController extends DooController
 
     public function proDetail()
     {
+        $numStatusArray = $this->numofperact->getLastStatus($this->params['pid'], $this->params['pmid']);
         // 项目名称
         $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
         foreach ($mpidArray as $k1 => $v1) {
@@ -289,7 +293,7 @@ class RProjectController extends DooController
         }
         $this->data['pmid'] = $this->params['pmid'];
         $this->data['pid'] = $this->params['pid'];
-        $this->data['mpid'] = $this->params['mpid'];
+        $this->data['mpid'] = $numStatusArray['mpid'];
         $this->render('r-project-section-detail', $this->data, TRUE);
     }
 
@@ -378,6 +382,7 @@ class RProjectController extends DooController
         $this->data['times'] = $lastRowArray['times'];
         $this->data['pid'] = $this->params['pid'];
         foreach ($auditUserArray as $key => $value) {
+            $strAvatar = $this->auth->getAvatar($value['auditoruid']);
             $i = $key + 1;
             if ($value['auditoruid'] == $this->auth->getUid()) {
                 $this->data['mastatus'] = $value['mastatus'];
@@ -391,17 +396,17 @@ class RProjectController extends DooController
             if ($value['mastatus'] == 'checking') {
                 $statuStr = '<h4 class="colOrange">审核中</h4>';
                 $statucolorStr = 'colOrange';
-                $statushtml = '<li title="审批中" class="wait"><span data-icon="k" aria-hidden="true"></span> <img src="' . Doo::conf()->APP_URL . 'global/images/avtra.png"></li>';
+                $statushtml = '<li title="审批中" class="wait"><span data-icon="k" aria-hidden="true"></span> <img src="' . $strAvatar . '"></li>';
             }
             if ($value['mastatus'] == 'checked') {
                 $statuStr = '<h4 class="colGreen">审批完成(' . date('Y-m-d', $value['audittime']) . ')</h4>';
                 $statucolorStr = 'colGreen';
-                $statushtml = '<li title="审批通过" class="pass"><span data-icon="d" aria-hidden="true"></span><img src="' . Doo::conf()->APP_URL . 'global/images/avtra.png"></li>';
+                $statushtml = '<li title="审批通过" class="pass"><span data-icon="d" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
             }
             if ($value['mastatus'] == 'checkno') {
                 $statuStr = '<h4 class="colRed">审批不通过(' . date('Y-m-d', $value['audittime']) . ')</h4>';
                 $statucolorStr = 'colRed';
-                $statushtml = '<li title="审批不通过" class="notpass"><span data-icon="e" aria-hidden="true"></span><img src="' . Doo::conf()->APP_URL . 'global/images/avtra.png"></li>';
+                $statushtml = '<li title="审批不通过" class="notpass"><span data-icon="e" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
             }
             $auditUserArray[$key]['statuStr'] = $statuStr;
             $auditUserArray[$key]['statucolorStr'] = $statucolorStr;

+ 2 - 0
protected/view/r-project-section-detail.html

@@ -72,9 +72,11 @@
             <!--<li>-->
                 <!--<a href="/rproject/{{pid}}/section/{{pmid}}/measure">审批</a>-->
             <!--</li>-->
+                <!-- if {{mpid}}>0 -->
 			<li>
                 <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/report/{{mpid}}">审批</a>
             </li>
+                <!-- endif -->
 		    </ul>
 		    <!--导航-->
 		    <div class="project">

+ 1 - 1
protected/view/r-project-section-report.html

@@ -38,7 +38,7 @@
      <!--导航-->
      <ul class="nav nav-tabs">
          <li>
-             <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail/{{mpid}}">标段概况</a>
+             <a href="{{rootUrl}}rproject/{{pid}}/section/{{pmid}}/detail">标段概况</a>
          </li>
          <!--<li>-->
          <!--<a href="/rproject/{{pid}}/section/{{pmid}}/measure">审批</a>-->