Esempio n. 1
0
 function upAddress($data = array(), $uid, $isParent = 0, $isMum = 1)
 {
     //$condition = '`childID`='.$uid;
     $se_uid = array('uid' => $uid);
     $arr = array('childID' => $uid, 'isMum' => $isMum);
     //$p = ($isMum = 1 ? "母":"父");
     if (!$isParent) {
         if (mysql_fetch_array(UserInfo::userinfo_select($se_uid, 1))) {
             $condition = '`uid`=' . $uid;
             $re = UserInfo::userinfo_update($data, $condition);
             if ($re) {
                 return mysql_fetch_array(UserInfo::userinfo_select($se_uid, 1), MYSQL_ASSOC);
             } else {
                 return 400;
             }
         } else {
             return 400;
         }
     } else {
         if (ParentInfo::parentinfo_select_affect($arr, 1)) {
             $data['childID'] = $uid;
             $data['isMum'] = $isMum;
             $condition = '`childID`=' . $uid . ' AND `isMum`=' . $isMum;
             $re = ParentInfo::parentinfo_update($data, $condition);
             if ($re) {
                 return mysql_fetch_array(ParentInfo::parentinfo_select($arr, 1), MYSQL_ASSOC);
             } else {
                 return 400;
             }
         } else {
             $data['childID'] = $uid;
             $data['isMum'] = $isMum;
             $re = ParentInfo::parentinfo_insert($data);
             if ($re) {
                 return mysql_fetch_array(ParentInfo::parentinfo_select($arr, 1), MYSQL_ASSOC);
             } else {
                 return 400;
             }
         }
     }
 }
Esempio n. 2
0
 $re_select = $setUser->userinfo_select($arr_select, 1);
 //uid如果已经存在的用户,更新资料
 if (mysql_fetch_row($re_select)) {
     $arr['gender'] = isset($arr['gender']) ? $arr['gender'] : 0;
     $arr['age'] = isset($arr['age']) ? $arr['age'] : 0;
     $arr['idCard'] = isset($arr['idCard']) ? $arr['idCard'] : '';
     $arr['realName'] = isset($arr['realName']) ? $arr['realName'] : '';
     $arr['birthDate'] = isset($arr['birthDate']) ? $arr['birthDate'] : '';
     $checkArr = array('uid' => $arr['uid']);
     //更新个人信息
     $r = $setUser->userinfo_select($checkArr, 1);
     if (!mysql_fetch_assoc($r)) {
         echo $res->show(407);
         exit;
     }
     $re = $setUser->userinfo_update($arr, $condition);
     if ($re == 1) {
         echo $res->show(200, mysql_fetch_assoc($setUser->userinfo_select($arr_select, 1)));
     } else {
         echo $res->show(407);
     }
     exit;
 }
 //不存在的用户,新创建
 if (isset($arr['token'])) {
     //找回密码,要验证token
     if (isset($arr['tel'])) {
         $token = $arr['token'];
         if (checkToken($arr['tel'], $token) == 200) {
             unset($arr['token']);
             $arr_select_tel = array('tel' => $arr['tel']);
Esempio n. 3
0
 function updateUserInfo($data, $condition)
 {
     $re = new UserInfo();
     return mysql_fetch_row($re->userinfo_update($data, $condition));
 }