예제 #1
0
 /**
  * 发送注册验证码
  */
 public function SendVerifyCode()
 {
     $this->LogInfo("Send verify code...");
     $obj = $this->GetReqObj();
     //判断公司是否冻结
     $companyCondition['company_id'] = $obj->app_id;
     $companyDao = MispDaoContext::Company();
     $companyStatus = $companyDao->where($companyCondition)->getField('company_status');
     if (CompanyEnum::STATUS_FREEZE == $companyStatus) {
         $this->LogWarn("Send verify code failed. The company is freezed, company id is " . $obj->app_id);
         $this->errorCode = MispErrorCode::COMPANY_SERVICE_STOP;
         $this->ReturnJson();
         return;
     }
     //发送验证码
     $phoneNum = $obj->phone_num;
     $content = ShortMessage::getRandNum(4);
     $text1 = "验证码:";
     $text2 = ",您正在使用快客洗涤手机客户端,请在10分钟内验证。(洁净生活·快客开始,服务电话:0859-3383000)";
     $message = $text1 . $content . $text2 . "【快客洗涤】";
     $result = ShortMessage::SendMessage($phoneNum, $message);
     $xmlObj = simplexml_load_string($result);
     if ($xmlObj->RetCode == "Sucess") {
         $this->LogInfo("Send verify code success, verify code is " . $content);
         $data['obj'] = $content;
         $this->ReturnJson($data);
         return;
     } else {
         $this->LogInfo("Send verify code failed.");
         $this->errorCode = SEND_MESSAGE_FAILED;
         $this->ReturnJson();
         return;
     }
 }
 static function GetRolePrivilege($user, $obj_type, $obj_value)
 {
     FuegoLog::getLog()->LogInfo("Get role privilege...");
     $privilegeResult = true;
     $companyCondition['company_id'] = $user['company_id'];
     $companyDao = MispDaoContext::Company();
     $companyStatus = $companyDao->where($companyCondition)->getField('company_status');
     if (CompanyEnum::STATUS_FREEZE == $companyStatus) {
         FuegoLog::getLog()->LogInfo("Get role privilege failed. The company is freezed, company id is " . $user['company_id']);
         return false;
     }
     $loginCondition['master_value'] = $user['role_id'];
     $loginCondition['master_type'] = PrivilegeEnum::MASTER_TYPE_ROLE;
     $loginCondition['access_obj_type'] = $obj_type;
     $loginCondition['access_obj_value'] = $obj_value;
     $privilegeDao = MispDaoContext::Privilege();
     $Privilege = $privilegeDao->where($loginCondition)->count();
     if ($Privilege < 1) {
         $privilegeResult = false;
     }
     return $privilegeResult;
 }
 protected function GetModel()
 {
     return MispDaoContext::Company();
 }