|
@@ -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
|
|
@@ -20,7 +23,7 @@ Doo::loadClass('PasswordHash');
|
|
|
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)
|
|
|
{
|
|
@@ -40,6 +43,7 @@ class UserController extends DooController
|
|
|
|
|
|
public function __construct()
|
|
|
{
|
|
|
+ $this->data['numofchecking'] = null;
|
|
|
$this->auth = new Auth();
|
|
|
$this->attfile = new attFile();
|
|
|
$this->profile = new Profile();
|
|
@@ -49,9 +53,22 @@ 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;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -62,7 +79,7 @@ class UserController extends DooController
|
|
|
{
|
|
|
$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';
|
|
|
}
|
|
@@ -223,28 +240,77 @@ class UserController extends DooController
|
|
|
*/
|
|
|
public function sms()
|
|
|
{
|
|
|
-// $this->data['uprofile'] = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
+ 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';
|
|
|
// }
|
|
|
- $this->render('edit-profile-sms', $this->data, TRUE);
|
|
|
+ die(json_encode(array('mobile' => (int)$this->profile->checkMobile($_POST['mobile']))));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @return type
|
|
|
*/
|
|
|
- public function smsEdit()
|
|
|
+ public function mobileVerify()
|
|
|
{
|
|
|
-// $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'])) {
|
|
|
// $this->profile->upProfile($this->auth->getUid(), $_POST);
|
|
|
// return DOO::conf()->APP_URL . 'user/profile';
|
|
|
// }
|
|
|
- $this->render('edit-profile-sms-edit', $this->data, TRUE);
|
|
|
+ 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)));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -453,9 +519,7 @@ class UserController extends DooController
|
|
|
// closedir($handle);
|
|
|
// }
|
|
|
// $this->data['proArray'] = null;
|
|
|
- $this->render('s-project
|
|
|
-
|
|
|
- ', $this->data);
|
|
|
+ $this->render('s-project', $this->data);
|
|
|
}
|
|
|
|
|
|
// ajax提取密码名称
|