|
@@ -1,5 +1,5 @@
|
|
|
<?php
|
|
|
-
|
|
|
+ini_set('display_errors', 1);
|
|
|
Doo::loadClass('auth');
|
|
|
Doo::loadClass('attfile');
|
|
|
Doo::loadClass('profile');
|
|
@@ -9,6 +9,9 @@ Doo::loadClass('actmeasure');
|
|
|
Doo::loadClass('numofperact');
|
|
|
Doo::loadClass('user');
|
|
|
Doo::loadClass('PasswordHash');
|
|
|
+Doo::loadClass('sms');
|
|
|
+Doo::loadModelAt('aconfig', 'admin');
|
|
|
+Doo::loadClass('measureauditact');
|
|
|
|
|
|
/* * proDetail
|
|
|
* MainController
|
|
@@ -17,11 +20,13 @@ Doo::loadClass('PasswordHash');
|
|
|
* @author darkredz
|
|
|
*/
|
|
|
|
|
|
-class UserController extends DooController {
|
|
|
+class UserController extends DooController
|
|
|
+{
|
|
|
|
|
|
- private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $user, $ph;
|
|
|
+ private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $numofperact, $user, $ph, $sms, $aconfig;
|
|
|
|
|
|
- public function beforeRun($resource, $action) {
|
|
|
+ public function beforeRun($resource, $action)
|
|
|
+ {
|
|
|
// $uGroups = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
// $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
|
|
|
// if (!$falg)
|
|
@@ -31,12 +36,14 @@ class UserController extends DooController {
|
|
|
$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
|
|
|
if (!$falg)
|
|
|
return Doo::acl()->defaultFailedRoute;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return Doo::acl()->defaultFailedRoute;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function __construct() {
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this->data['numofchecking'] = null;
|
|
|
$this->auth = new Auth();
|
|
|
$this->attfile = new attFile();
|
|
|
$this->profile = new Profile();
|
|
@@ -46,26 +53,41 @@ class UserController extends DooController {
|
|
|
$this->numofperact = new NumofperAct();
|
|
|
$this->user = new User();
|
|
|
$this->ph = new PasswordHash(8, FALSE);
|
|
|
+ $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
|
|
|
+ $this->aconfig = new AConfig();
|
|
|
+ $this->measureauditact = new MeasureauditAct();
|
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
|
$this->data['currChannle'] = 'p';
|
|
|
$this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
+ $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
|
|
|
+ if (isset($mpidArray[0]['pid'])) {
|
|
|
+ foreach ($mpidArray as $key => $value) {
|
|
|
+ // 审批操作按照时间排序多标段
|
|
|
+ $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($this->data['numofchecking'] == 0) {
|
|
|
+ $this->data['numofchecking'] = null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @return type
|
|
|
*/
|
|
|
- public function index() {
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
$this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
$this->data['uprofile']['email'] = $this->auth->getUemail();
|
|
|
- if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
|
|
|
+ if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone'])) {
|
|
|
$this->profile->upProfile($this->auth->getUid(), $_POST);
|
|
|
return DOO::conf()->APP_URL . 'user/profile';
|
|
|
}
|
|
|
$this->render('edit-profile', $this->data, TRUE);
|
|
|
}
|
|
|
|
|
|
- public function avatar() {
|
|
|
+ public function avatar()
|
|
|
+ {
|
|
|
// TODO:加入目录可否写入判断
|
|
|
if (count($_FILES) == 3) {
|
|
|
$result = array();
|
|
@@ -114,16 +136,18 @@ class UserController extends DooController {
|
|
|
* @access public
|
|
|
* ************************************************************ */
|
|
|
|
|
|
- function createRandomCode($length) {
|
|
|
+ function createRandomCode($length)
|
|
|
+ {
|
|
|
$randomCode = "";
|
|
|
$randomChars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
for ($i = 0; $i < $length; $i++) {
|
|
|
- $randomCode .= $randomChars { mt_rand(0, 35) };
|
|
|
+ $randomCode .= $randomChars{mt_rand(0, 35)};
|
|
|
}
|
|
|
return $randomCode;
|
|
|
}
|
|
|
|
|
|
- public function proSection() {
|
|
|
+ public function proSection()
|
|
|
+ {
|
|
|
/**
|
|
|
* 计量期数
|
|
|
* 完成进度
|
|
@@ -156,7 +180,7 @@ class UserController extends DooController {
|
|
|
}
|
|
|
$biaoduantotalmoney += $value['contracttotal'];
|
|
|
$totalmoney = number_format($value['contracttotal'], 2, '.', ',');
|
|
|
- $bdhtmlstr .='
|
|
|
+ $bdhtmlstr .= '
|
|
|
<thead>
|
|
|
<tr><th class="taC" width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止本期累计完成/本期完成/未完成</th></tr></thead>
|
|
|
<tbody>
|
|
@@ -210,7 +234,88 @@ class UserController extends DooController {
|
|
|
$this->render('w-project-section', $this->data, TRUE);
|
|
|
}
|
|
|
|
|
|
- Function fNumber($number) {
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function sms()
|
|
|
+ {
|
|
|
+ if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
|
|
|
+ $vmArray = $this->auth->getVerifyMobile();
|
|
|
+ if (isset($vmArray) && $vmArray) {
|
|
|
+ if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
|
|
|
+ $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
|
|
|
+ return Doo::conf()->APP_URL . 'user/profile/sms';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
+ $this->data['smsNoticeSwitch'] = $this->aconfig->getOne(array('select' => 'smsswitch', 'asArray' => TRUE))['smsswitch'];
|
|
|
+ $this->render('edit-profile-sms', $this->data, TRUE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function smsEdit()
|
|
|
+ {
|
|
|
+ if (isset($_POST['mobile']) && isset($_POST['verifycode'])) {
|
|
|
+ $vmArray = $this->auth->getVerifyMobile();
|
|
|
+ if (isset($vmArray) && $vmArray) {
|
|
|
+ if (md5($_POST['mobile'] . $_POST['verifycode']) == md5($vmArray['mobile'] . $vmArray['code'])) {
|
|
|
+ $this->profile->updateMobile($this->auth->getUid(), $vmArray['mobile']);
|
|
|
+ return Doo::conf()->APP_URL . 'user/profile/sms/edit';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
+ $this->render('edit-profile-sms-edit', $this->data, TRUE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function checkMobile()
|
|
|
+ {
|
|
|
+// $this->data['uprofile']['email'] = $this->auth->getUemail();
|
|
|
+// if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
|
|
|
+// $this->profile->upProfile($this->auth->getUid(), $_POST);
|
|
|
+// return DOO::conf()->APP_URL . 'user/profile';
|
|
|
+// }
|
|
|
+ die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function mobileVerify()
|
|
|
+ {
|
|
|
+// $this->data['uprofile']['email'] = $this->auth->getUemail();
|
|
|
+// if (isset($_POST['name']) && isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
|
|
|
+// $this->profile->upProfile($this->auth->getUid(), $_POST);
|
|
|
+// return DOO::conf()->APP_URL . 'user/profile';
|
|
|
+// }
|
|
|
+ die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function smsSend()
|
|
|
+ {
|
|
|
+ $randNum = rand(1000, 9999);
|
|
|
+ $this->auth->setVerifyMobile(array('mobile' => $_POST['mobile'], 'code' => $randNum));
|
|
|
+ $res = $this->sms->sendSms($_POST['mobile'], Doo::conf()->SMS_TIPS['AUDIT_NOTICE'] . $randNum . Doo::conf()->SMS_TIPS['END_MSG']);
|
|
|
+ die(json_encode(array('verify' => $res)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Function fNumber($number)
|
|
|
+ {
|
|
|
if ($number == '')
|
|
|
Return "-";
|
|
|
$nlen = strlen($number);
|
|
@@ -226,7 +331,8 @@ class UserController extends DooController {
|
|
|
Return $fNumber;
|
|
|
}
|
|
|
|
|
|
- private function getFav() {
|
|
|
+ private function getFav()
|
|
|
+ {
|
|
|
$proArray = $this->project->getAll();
|
|
|
$this->data['othrPro'] = [];
|
|
|
foreach ($proArray as $key => $value) {
|
|
@@ -239,7 +345,8 @@ class UserController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function proSectionMeasure() {
|
|
|
+ public function proSectionMeasure()
|
|
|
+ {
|
|
|
//此处未做更改,JSON文件已经固定名称
|
|
|
$jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
|
|
|
if (isset($jsonpath['dirname'])) {
|
|
@@ -254,7 +361,7 @@ class UserController extends DooController {
|
|
|
closedir($handle);
|
|
|
}
|
|
|
$this->data['proArray'] = $proArray['Bills'];
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
$this->data['proArray'] = [];
|
|
|
}
|
|
|
$this->data['mpid'] = $this->params['mpid'];
|
|
@@ -262,7 +369,8 @@ class UserController extends DooController {
|
|
|
$this->render('w-project-section-measure', $this->data, TRUE);
|
|
|
}
|
|
|
|
|
|
- public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0) {
|
|
|
+ public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
|
|
|
+ {
|
|
|
$count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
|
|
|
if (!$count) {
|
|
|
return $string;
|
|
@@ -281,12 +389,13 @@ class UserController extends DooController {
|
|
|
} else {
|
|
|
$returnString .= $tmpString;
|
|
|
}
|
|
|
- $i ++;
|
|
|
+ $i++;
|
|
|
}
|
|
|
return $returnString;
|
|
|
}
|
|
|
|
|
|
- function unicode_encode($name) {//to Unicode
|
|
|
+ function unicode_encode($name)
|
|
|
+ {//to Unicode
|
|
|
$name = iconv('UTF-8', 'UCS-2', $name);
|
|
|
$len = strlen($name);
|
|
|
$str = '';
|
|
@@ -303,7 +412,8 @@ class UserController extends DooController {
|
|
|
return $str;
|
|
|
}
|
|
|
|
|
|
- function unicode_decode($name) {//Unicode to
|
|
|
+ function unicode_decode($name)
|
|
|
+ {//Unicode to
|
|
|
$pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
|
|
|
preg_match_all($pattern, $name, $matches);
|
|
|
if (!empty($matches)) {
|
|
@@ -324,7 +434,8 @@ class UserController extends DooController {
|
|
|
return $name;
|
|
|
}
|
|
|
|
|
|
- public function proDetail() {
|
|
|
+ public function proDetail()
|
|
|
+ {
|
|
|
// 面包屑导航项目
|
|
|
$this->data['currproArray'] = $this->data['allproArray'] = NULL;
|
|
|
$allproArray = $this->project->getAll();
|
|
@@ -377,7 +488,8 @@ class UserController extends DooController {
|
|
|
$this->render('w-project-section-detail', $this->data, TRUE);
|
|
|
}
|
|
|
|
|
|
- public function welcome() {
|
|
|
+ public function welcome()
|
|
|
+ {
|
|
|
// if (!$this->auth->isLoggedIn())
|
|
|
// return Doo::conf()->APP_URL;
|
|
|
if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
|
|
@@ -391,7 +503,8 @@ class UserController extends DooController {
|
|
|
$this->render('welcome', $this->data);
|
|
|
}
|
|
|
|
|
|
- public function prolist() {
|
|
|
+ public function prolist()
|
|
|
+ {
|
|
|
// if (!$this->auth->isLoggedIn())
|
|
|
// return Doo::conf()->APP_URL;
|
|
|
// $proArray = new stdClass();
|
|
@@ -406,19 +519,19 @@ class UserController extends DooController {
|
|
|
// closedir($handle);
|
|
|
// }
|
|
|
// $this->data['proArray'] = null;
|
|
|
- $this->render('s-project
|
|
|
-
|
|
|
- ', $this->data);
|
|
|
+ $this->render('s-project', $this->data);
|
|
|
}
|
|
|
|
|
|
// ajax提取密码名称
|
|
|
- public function getAjaxSection() {
|
|
|
+ public function getAjaxSection()
|
|
|
+ {
|
|
|
if (!$this->isAjax())
|
|
|
return;
|
|
|
echo json_encode($_POST);
|
|
|
}
|
|
|
|
|
|
- public function repasswd() {
|
|
|
+ public function repasswd()
|
|
|
+ {
|
|
|
if (isset($_POST['oldpasswd']) && isset($_POST['newpasswd']) && isset($_POST['renewpasswd']) && ($_POST['newpasswd'] == $_POST['renewpasswd'])) {
|
|
|
$userArray = $this->user->getRowUser($this->auth->getUid());
|
|
|
if ($this->ph->CheckPassword($_POST['oldpasswd'], $userArray['upass'])) {
|