/**
     * @brief 医生认证申请
     * @author cs
     * @exampleUrl 
     *
     * @Param $userId
     * @Param $name
     * @Param $hospitalName
     * @Param $facultyName
     * @Param $hospitalProvince
     * @Param $hospitalCity
     * @Param $isPublic
     * @Param $workCard
     * @Param $certificate
     *
     * @Returns   
  */
 public function doctorAuthApplication($userId, $name, $hospitalName, $facultyName, $hospitalProvince='', $hospitalCity='', $isPublic='', $workCardAttachmentIds='', $certificateAttachmentIds='', $mobile='', $captcha = '', $grade = '')
 {/*{{{*/
     $user = DAL::get()->find('user', $userId);
     if ($user->isNull())
     {
         $this->setErrorCode(1221);
         return 0;
     }
     if ($mobile || $captcha)
     {
         if ($mobile == '13800138000')
         {
             $this->setErrorCode(828);
             return 0;
         }
         if(false == XString::isMobileNew($mobile))
         {
             $this->setErrorCode(827);
             return 0;
         }
         if(!User::validKeyForRegister($mobile, strtolower($captcha)))
         {
             $this->setErrorCode(1181);
             return 0;
         }
         UserClient::getInstance()->setMobile($user->id, $mobile);
     }
     if ($name == '')
     {
         $this->setErrorCode(830);
         return 0;
     }
     if ($hospitalName == '')
     {
         $this->setErrorCode(804);
         return 0;
     }
     if ($facultyName == '')
     {
         $this->setErrorCode(8041);
         return 0;
     }
     $workCardIds = $certificateIds = array();
     if (!empty($workCardAttachmentIds))
     {
         $token = strtok($workCardAttachmentIds, ',');
         while($token !== false)
         {
             $workCardIds[] = $token;
             $token = strtok(',');
         }
     }
     if(!empty($certificateAttachmentIds))
     {
         $token = strtok($certificateAttachmentIds, ',');
         while($token !== false)
         {
             $certificateIds[] = $token;
             $token = strtok(',');
         }
     }
     $preDoctor = DAL::get()->find_by_userid('predoctor', $user->id);
     if (false == $preDoctor->isNull())
     {
         if ($preDoctor->isInit())
         {
             $this->setErrorCode(803);
             return 0;
         }
         if ($preDoctor->isConfirmed())
         {
             $this->setErrorCode(802);
             return 0;
         }
     }
     $params = array();
     $params['name'] = $name;
     $params['hospitalName'] = $hospitalName;
     $params['facultyName'] = $facultyName;
     $params['hospitalProvince'] = $hospitalProvince;
     $params['hospitalCity'] = $hospitalCity;
     $params['isPublic'] = $isPublic;
     $params['workCard'] = $workCardIds;
     $params['certificate'] =$certificateIds;
     $params['grade'] = $grade == '无职称' ? '' : $grade;
     $preDoctor = PreDoctorClient::getInstance()->addPreDoctor($user->id, $params);
     if ($preDoctor->isNull())
     {
         $this->setErrorCode(801);
         return 0;
     }
     if ($_REQUEST['os'] == 'ios' && $_REQUEST['v'] >= '3.0.1' || $_REQUEST['os'] == 'android' && $_REQUEST['v'] >= '3.0.5')
     {
         $title = '医生客户端注册完成';
         $content = "尊敬的医生您好,您已完成注册,可以开始使用客户端的部分功能。\n目前对您的信息正在核对与认证,认证后您可使用客户端全部功能。\n有任何疑问可通过客户端直接联系我们,谢谢。";
         StationLetterClient::getInstance()->sendMsg(Message::AdminUserId, $preDoctor->user->id, $title, $content);
     }
     $this->content = array('successfuly' => 1); 
 }/*}}}*/
예제 #2
0
    public function sendDocotrAppDownSMS($request, $response)
    {/*{{{*/

        $mobile = $request->mobile;
        if(false == XString::isMobileNew($mobile))
        {
            $result = '{"code":"error_mobile"}';
        }
        else if(Captcha::verify($request->door, XIpLocation::getIp(), $request->kind, 0, $request->token) == false)
        {
            $result = '{"code":"error_door"}';
        }
        else
        {
            $content = "全新的医生专用版客户端下载地址:http://m.haodf.com/sd ,建议在Wi-Fi环境下下载。如您在使用过程中遇到问题,请与医生助理联系010-56707226";
            SMSClient::getInstance()->sendSMSNoSignature(array($mobile) , $content);
            $result = '{"code":"success"}';
        }
        $callback = $request->callback;
        if ($callback) {
            $result = $callback.'('.$result.');';
            header('Content-Type: text/javascript;'); 
        } else {
            header('Content-Type: application/json;'); 
        }
        header("Content-Type: text/html; charset=GBK");
        echo $result;
        return parent::DIRECT_OUTPUT;
    }/*}}}*/