Пример #1
0
 public function mobilenumactiveAction()
 {
     $deploy_mode = $this->container->getParameter('deploy_mode');
     $request = $this->getRequest();
     $mobile_num = $request->get('mobile_num');
     $mobile_pwd = $request->get('mobile_pwd');
     //$eno = $request->get('eno');
     $eno = $deploy_mode == "C" ? Utils::$PUBLIC_ENO : $this->container->getParameter("ENO");
     //企业独立部署时企业不设置,从配置文件中获取固定的企业号
     $ename = $request->get('ename');
     $nick_name = $request->get('nick_name');
     $active_code = $request->get('active_code');
     $login_account = $mobile_num;
     $ldap_uid = $request->get("ldap_uid");
     if (empty($active_code)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入短信验证码!");
     }
     if (empty($mobile_pwd)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入密码!");
     }
     if (empty($nick_name)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "请输入姓名!");
     }
     $da = $this->get('we_data_access');
     $da_im = $this->get('we_data_access_im');
     $cacheobj = new \Justsy\BaseBundle\Management\Enterprise($da, $this->get("logger"), $this->container);
     if (!strpos($login_account, "@")) {
         $domain = $this->container->getParameter('edomain');
         $login_account .= "@" . $domain;
     }
     $staffMgr = new \Justsy\BaseBundle\Management\Staff($da, $da_im, $login_account, $this->get("logger"), $this->container);
     $had = $staffMgr->getInfo();
     if (!empty($had)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已注册,继续使用请先找回密码");
     }
     //判断手机号是否已经被使用
     if ($staffMgr->checkUser($mobile_num)) {
         return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已被绑定,请解绑后重试");
     }
     $sysparam = new \Justsy\BaseBundle\DataAccess\SysParam($this->container);
     $wn_code = $sysparam->GetSysParam("mobile_active_code");
     try {
         if ($wn_code != $active_code) {
             $sql = "select state_id,active_code,review_note from we_register where login_account=?";
             $ds = $da->GetData("we_register", $sql, array($login_account));
             if ($ds && $ds['we_register']['recordcount'] <= 0) {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "未找到该手机号的注册信息!");
             }
             if ($ds['we_register']['rows'][0]['state_id'] == '3') {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "该手机号已被注册!");
             }
             if ((empty($ds['we_register']['rows'][0]['review_note']) ? 0 : $ds['we_register']['rows'][0]['review_note']) >= 5) {
                 return $this->getResponse(ReturnCode::$OTHERERROR, "抱歉,验证码请求次数过多,如果获取不到验证码请根据下方提示与我们联系");
             }
             if ($ds['we_register']['rows'][0]['active_code'] != $active_code) {
                 $num = 5 - (empty($ds['we_register']['rows'][0]['review_note']) ? 0 : $ds['we_register']['rows'][0]['review_note']);
                 $sql = "update we_register set review_note=ifnull(review_note,0)+1 where login_account=?";
                 $da->ExecSQL($sql, array($login_account));
                 return $this->getResponse(ReturnCode::$OTHERERROR, "验证码错误,请重新输入。");
             }
         }
         $para = array();
         $para['account'] = $mobile_num;
         $para['password'] = $mobile_pwd;
         $para['deptid'] = '';
         $para['nick_name'] = $nick_name;
         $para['ldap_uid'] = '';
         $re = $staffMgr->createstaff($para);
     } catch (\Exception $e) {
         $re = Utils::WrapResultError($e->getMessage());
     }
     return $this->getResponse($re['returncode'], $re['msg']);
 }