示例#1
0
 public function indexAction()
 {
     $p = $_REQUEST;
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     $pNewptxt = empty($p['newptxt']) ? '' : trim($p['newptxt']);
     $pCode = empty($p['code']) ? '' : intval(trim($p['code']));
     $tTime = time();
     if (empty($pPhone)) {
         Tool_Fnc::ajaxMsg('请输入手机号码');
     }
     if (empty($pNewptxt)) {
         Tool_Fnc::ajaxMsg('请输入新密码');
     }
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     $tMO = new UserModel();
     $tRow = $tMO->field('*')->where('phone = \'' . $pPhone . '\'')->fRow();
     if (empty($tRow['id'])) {
         Tool_Fnc::ajaxMsg('用户不存在');
     }
     $tCodeMO = new PhonecodeModel();
     $tCodeCRow = $tCodeMO->check($pPhone, 2, $pCode);
     if ($tCodeCRow['status'] == 0) {
         Tool_Fnc::ajaxMsg($tCodeCRow['msg']);
     }
     $tKey = Tool_Fnc::newrand(4);
     $tMd5str = Tool_Fnc::markmd5($pNewptxt, $tKey);
     $tData = array('passwd' => $tMd5str, 'id' => $tRow['id'], 'private_key' => $tKey);
     if ($tMO->update($tData)) {
         Tool_Fnc::ajaxMsg('密码修改成功', 1);
     }
     Tool_Fnc::ajaxMsg('密码修改失败');
 }
示例#2
0
 public function indexAction()
 {
     $p = $_REQUEST;
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     $pPassword = empty($p['ptxt']) ? '' : trim($p['ptxt']);
     $pDid = empty($p['did']) ? '' : trim($p['did']);
     $tTime = time();
     if (empty($pPhone)) {
         Tool_Fnc::ajaxMsg('请输入手机号码');
     }
     if (empty($pPassword)) {
         Tool_Fnc::ajaxMsg('请输入密码');
     }
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     if (!Tool_Validate::az09($pDid)) {
         Tool_Fnc::ajaxMsg('did 错误');
     }
     $tUserMO = new UserModel();
     $tUserRow = $tUserMO->field('private_key')->where('phone = \'' . $pPhone . '\'')->fRow();
     $tUkey = empty($tUserRow['private_key']) ? '' : $tUserRow['private_key'];
     $tMd5str = Tool_Fnc::markmd5($pPassword, $tUkey);
     $tUserRow = $tUserMO->field('id,user_type')->where('phone = \'' . $pPhone . '\' and passwd = \'' . $tMd5str . '\'')->fRow();
     if (empty($tUserRow['id'])) {
         Tool_Fnc::ajaxMsg("用户名或者密码错误");
     }
     //添加登陆 记录
     $tData = array('uid' => $tUserRow['id'], 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
     $tUllMO = new UserloginlogModel();
     if (!$tUllMO->insert($tData)) {
         Tool_Fnc::ajaxMsg("登录失败");
     }
     //did入库
     $tUDMO = new UserdidModel();
     $tUDRow = $tUDMO->field('count(0) c')->where('uid = ' . $tUserRow['id'] . ' and did = \'' . $pDid . '\'')->fRow();
     if (empty($tUDRow['c'])) {
         $tData = array('uid' => $tUserRow['id'], 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
         $tUDMO->insert($tData);
     }
     $tTokenarr = $this->creattoken($tUserRow['id']);
     //匿名转实名
     $tUserMO->incognito_real($pDid, $tUserRow['id']);
     Tool_Fnc::ajaxMsg("登录成功", 1, array_merge($tTokenarr, array('user_type' => $tUserRow['user_type'])));
     //登录成功返回token
 }
示例#3
0
 public function codeAction()
 {
     $p = $_REQUEST;
     header("Content-type: text/html; charset=utf-8");
     $pPhone = empty($p['phone']) ? 0 : intval($p['phone']);
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     exec('cd ' . Yaf_Registry::get("config")->guahao->shell->dir . ' regcode.py ' . $pPhone, $tOut);
     if (!isset($tOut[0])) {
         Tool_Fnc::ajaxMsg('发送验证码异常 001');
     }
     $tRes = json_decode($tOut[0], true);
     $tRes['msg'] = $tRes['msg'] == "false" ? '当前手机号每天只能发送4条短信,您已经超过限制' : $tRes['msg'];
     Tool_Fnc::ajaxMsg($tRes['msg'], $tRes['status'], array('webcode' => $tRes['webcode']));
     exit;
 }
示例#4
0
 public function bindphoneAction()
 {
     $p = $_REQUEST;
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     $pPassword = empty($p['ptxt']) ? '' : trim($p['ptxt']);
     #客户端发送的必须是md5的 密码
     $pCode = empty($p['code']) ? '0' : trim($p['code']);
     $tTime = time();
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     if (empty($pPassword)) {
         Tool_Fnc::ajaxMsg('密码不能为空');
     }
     if (empty($pCode)) {
         Tool_Fnc::ajaxMsg('验证码不能为空');
     }
     if (!Tool_Validate::integer($pCode)) {
         Tool_Fnc::ajaxMsg('验证码格式错误');
     }
     if (strlen($pPassword) != 32) {
         Tool_Fnc::ajaxMsg('接口发送的必须是密文密码');
     }
     $tMemberMO = new Web_MembersModel();
     $tRow = $tMemberMO->field('count(0) c')->where('mem_phone = \'' . $pPhone . '\'')->fRow();
     if (!empty($tRow['c'])) {
         Tool_Fnc::ajaxMsg('该手机已被他人使用,请重新输入');
     }
     $tKey = Tool_Fnc::newrand(4);
     $tMd5str = Tool_Fnc::markmd5($pPassword, $tKey);
     $tCodeMO = new Web_CodeModel();
     $tCodeCRow = $tCodeMO->check($pPhone, 1, $pCode);
     if ($tCodeCRow['status'] == 0) {
         Tool_Fnc::ajaxMsg($tCodeCRow['msg']);
     }
     $tData = array('mem_phone' => $pPhone, 'mem_zc_ip' => Tool_Fnc::realip(), "mem_pwd" => $tMd5str, 'mem_key' => $tKey, 'id_web_members' => $this->tUid);
     if ($tMemberMO->update($tData)) {
         $tTokenarr = $this->creattoken($this->tUid);
         Tool_Fnc::ajaxMsg("绑定成功", 1, $tTokenarr);
         //注册成功返回token
     }
     Tool_Fnc::ajaxMsg('绑定失败');
 }
示例#5
0
 public function ckauthcodeAction()
 {
     $p = $_REQUEST;
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     $pReqmode = empty($p['reqmode']) ? '' : intval(trim($p['reqmode']));
     #1: 注册请求;2: 忘记/找回密码请求;   3:第三方
     $pCode = empty($p['code']) ? '' : intval(trim($p['code']));
     $tTime = time();
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     $tCodeMO = new PhonecodeModel();
     $tCodeCRow = $tCodeMO->check($pPhone, $pReqmode, $pCode);
     $tUMO = new UserModel();
     $tURow = $tUMO->field('count(0) c')->where('phone = \'' . $pPhone . '\'')->fRow();
     $tIsregphone = 0;
     if (!empty($tURow['c'])) {
         $tIsregphone = 1;
     }
     Tool_Fnc::ajaxMsg($tCodeCRow['msg'], $tCodeCRow['status'], array('isregphone' => $tIsregphone));
 }
示例#6
0
 public function indexAction()
 {
     $p = $_REQUEST;
     if (!count($p)) {
         Tool_Fnc::ajaxMsg('参数错误');
     }
     $pPhone = empty($p['phone']) ? '' : trim($p['phone']);
     if (!Tool_Validate::mo($pPhone)) {
         Tool_Fnc::ajaxMsg('手机号不正确');
     }
     //判断手机号是否是白求恩
     $tBUserInfo = Oci_User::isPhone($pPhone);
     if (empty($tBUserInfo)) {
         Tool_Fnc::ajaxMsg('非白求恩用户,下一步完善必须资料', 1, array('user_type' => 0));
     }
     $pPassword = empty($p['ptxt']) ? '' : trim($p['ptxt']);
     #客户端发送的必须是md5的 密码
     $pCode = empty($p['code']) ? '0' : trim($p['code']);
     $pDid = empty($p['did']) ? '' : trim($p['did']);
     $tTime = time();
     if (empty($pPassword)) {
         Tool_Fnc::ajaxMsg('密码不能为空');
     }
     if (empty($pCode)) {
         Tool_Fnc::ajaxMsg('验证码不能为空');
     }
     if (!Tool_Validate::integer($pCode)) {
         Tool_Fnc::ajaxMsg('验证码格式错误');
     }
     if (strlen($pPassword) != 32) {
         Tool_Fnc::ajaxMsg('接口发送的必须是密文密码');
     }
     if (empty($pDid) || !Tool_Validate::az09($pDid)) {
         Tool_Fnc::ajaxMsg('did error');
     }
     $tUMO = new UserModel();
     $tUMO->begin();
     $tRow = $tUMO->field('count(0) c')->where('phone = \'' . $pPhone . '\'')->fRow();
     if (!empty($tRow['c'])) {
         Tool_Fnc::ajaxMsg('该手机已被他人使用,请重新输入');
     }
     $tKey = Tool_Fnc::newrand(4);
     $tMd5str = Tool_Fnc::markmd5($pPassword, $tKey);
     $tCodeMO = new PhonecodeModel();
     $tCodeCRow = $tCodeMO->check($pPhone, 1, $pCode);
     if ($tCodeCRow['status'] == 0) {
         Tool_Fnc::ajaxMsg($tCodeCRow['msg']);
     }
     $tData = array('phone' => $pPhone, 'reg_ip' => Tool_Fnc::realip(), "passwd" => $tMd5str, "reg_time" => $tTime, 'private_key' => $tKey, 'reg_did' => $pDid, 'user_type' => 1);
     if (!($tID = $tUMO->insert($tData))) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 001');
     }
     //did入库
     $tUDMO = new UserdidModel();
     $tUDRow = $tUDMO->field('count(0) c')->where('uid = ' . $tID . ' and did = \'' . $pDid . '\'')->fRow();
     if (empty($tUDRow['c'])) {
         $tData = array('uid' => $tID, 'did' => $pDid, 'created' => $tTime, 'ip' => Tool_Fnc::realip());
         if (!$tUDMO->insert($tData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 002');
         }
     }
     $tTokenarr = $this->creattoken($tID);
     //获取数据
     $tSex = $tBUserInfo['SEX'] == '男' ? 1 : 0;
     $tPatientId = $tBUserInfo['PATIENT_ID'];
     //提取干体重
     $tDryWeight = Oci_User::getDryWeight($tPatientId);
     $tDatas = array('id' => $tID, 'nickname' => $tBUserInfo['NAME'], 'sex' => $tSex, 'dry_weight' => $tDryWeight['BODY_WEIGHT'], 'date_of_birth' => $tBUserInfo['DATE_OF_BIRTH'], 'headimg' => $tBUserInfo['PHOTO']);
     if (!$tUMO->update($tDatas)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 003');
     }
     //新建健康档案
     $tUserAssessment = Oci_User::getAssessment($tPatientId);
     $tUserAssessment['uid'] = $tID;
     $tUserAssessment['name'] = $tBUserInfo['NAME'];
     //his系统数据更新
     $tCMO = new CenterModel();
     $tCRow = $tCMO->field('id,name')->where(' center_id = \'' . $tBUserInfo['CENTER_ID'] . '\'')->fRow();
     if (!empty($tCRow['id'])) {
         $tUserAssessment['medical_id'] = $tCRow['id'];
         //用户透析中心字段更新
         $tUMedicalData = array('id' => $tID, 'center_id' => $tCRow['id'], 'medical_addr' => $tCRow['name']);
         if (!$tUMO->update($tUMedicalData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 003');
         }
     } else {
         $tCenterdict = Oci_User::getCenterdict($tBUserInfo['CENTER_ID']);
         $tCData = array('center_id' => $tCenterdict['CENTER_ID'], 'center_code' => $tCenterdict['CENTER_CODE'], 'name' => $tCenterdict['CENTER_NAME'], 'position' => $tCenterdict['POSITION'], 'created' => $tTime);
         if (!($tUserAssessment['medical_id'] = $tCMO->insert($tCData))) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 008');
         }
         //用户透析中心字段更新
         $tUMedicalData = array('id' => $tID, 'center_id' => $tUserAssessment['medical_id'], 'medical_addr' => $tCenterdict['CENTER_NAME']);
         if (!$tUMO->update($tUMedicalData)) {
             $tUMO->back();
             Tool_Fnc::ajaxMsg('错误异常 003');
         }
     }
     //健康档案
     $tUA = new UserassessmentModel();
     foreach ($tUserAssessment as $k => $v) {
         $tUserAssessmentData[strtolower($k)] = $v;
     }
     $tUserAssessmentData['created'] = $tTime;
     //添加透析方式默认值
     $tUserAssessmentData['method'] = 1;
     if (!$tUA->insert($tUserAssessmentData)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 004');
     }
     //干重记录表数据更新
     $tDWMO = new DryweightlogModel();
     /*$tDryWeightLog = array(
           'uid' => $tID,
           'weight' => $tDryWeight['BODY_WEIGHT'],
           'date' => $tDryWeight['TREATE_DATE'],
           'month' => date('Y-m',strtotime($tDryWeight['TREATE_DATE'])),
           'year' => date('Y',strtotime($tDryWeight['TREATE_DATE'])),
           'patient_id' => $tPatientId,
           'created' => time(),
       );*/
     $tSql = 'update ' . $tDWMO->table . ' set uid=' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tDWMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 005');
     }
     #更新白求恩排班表
     $tSDMO = new BqeschedulingdetailModel();
     $tSql = 'update ' . $tSDMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tSDMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 006');
     }
     #透析 - 治疗单主记录
     $tTRMO = new BqetreatmentrecordModel();
     $tSql = 'update ' . $tTRMO->table . ' set uid = ' . $tID . ' where patient_id = \'' . $tPatientId . '\'';
     if (!$tTRMO->exec($tSql)) {
         $tUMO->back();
         Tool_Fnc::ajaxMsg('错误异常 007');
     }
     $tUMO->commit();
     //匿名转实名
     $tUMO->incognito_real($pDid, $tID);
     $tTokenarr = array_merge($tTokenarr, array('user_type' => 1));
     Tool_Fnc::ajaxMsg("注册成功,白求恩用户", 1, $tTokenarr);
     //注册成功返回token
 }