/** * 会员信息编辑 * * Enter description here ... */ public function member_edit() { $member_id = intval($this->input['member_id']); if (!$member_id) { $this->errorOutput('未传入会员ID'); } //头像 if (isset($this->input['member_avatar']) == 'member_avatar' && $_FILES['avatar']['tmp_name']) { $files = $_FILES['avatar']; $ret_avatar = $this->mMember->avatarEdit($member_id, $files); if (!$ret_avatar) { $this->errorOutput('头像更新失败'); } } //昵称、手机、性别 if (isset($this->input['member']) && trim($this->input['member']) == 'member') { if (isset($this->input['mobile'])) { $mobile = trim($this->input['mobile']); if (!$mobile) { $this->errorOutput('手机号不能为空'); } if ($this->mMember->check_mobile_exists($mobile)) { $this->errorOutput('该手机号已被绑定'); } } if (isset($this->input['nick_name'])) { $nick_name = trim(urldecode($this->input['nick_name'])); if (!$nick_name) { $this->errorOutput('昵称不能为空'); } if ($this->mMember->check_nick_name_exists($nick_name, $member_id)) { $this->errorOutput('昵称已存在'); } } if (isset($this->input['email'])) { $email = trim(urldecode($this->input['email'])); if (!$email) { $this->errorOutput('邮箱不能为空'); } $re = $this->mMember->_check_email($email); if ($re == -3) { $this->errorOutput('邮箱不合法'); } /* if ($re == -4) { $this->errorOutput('邮箱已存在'); } */ } if (isset($this->input['sex'])) { $sex = intval($this->input['sex']); } $ret_member = $this->mMember->memberEdit($member_id, $nick_name, $mobile, $sex, $email); if (!$ret_member) { $this->errorOutput('绑定手机号失败'); } } //基本信息 if (isset($this->input['member_info']) && trim($this->input['member_info']) == 'member_info') { $member_info = array('member_id' => $member_id, 'cn_name' => trim($this->input['cn_name']), 'en_name' => trim($this->input['en_name']), 'sex' => intval($this->input['sex']), 'birth' => strtotime(urldecode($this->input['birth'])), 'constellation' => intval($this->input['constellation']), 'bloodtype' => intval($this->input['bloodtype']), 'language' => trim($this->input['language']), 'live_country' => trim($this->input['live_country']), 'live_prov' => intval($this->input['live_prov']), 'live_city' => intval($this->input['live_city']), 'live_dist' => intval($this->input['live_dist']), 'home_country' => urldecode($this->input['home_country']), 'home_prov' => urldecode($this->input['home_prov']), 'home_city' => urldecode($this->input['home_city']), 'home_dist' => urldecode($this->input['home_dist']), 'introduce' => trim($this->input['introduce']), 'mark' => trim(urldecode($this->input['mark']), ',')); if ($this->mMemberInfo->checkMemberInfo('member_info', $member_id)) { $ret_info = $this->mMemberInfo->memberInfoCreate($member_info, $member_id); } else { $ret_info = $this->mMemberInfo->memberInfoUpdate($member_info, $member_id); } if (!$ret_info['member_id']) { $this->errorOutput('会员基本信息编辑失败'); } if ($this->settings['is_open_xs']) { require_once ROOT_PATH . 'lib/class/team.class.php'; $obj_team = new team(); $ret = $obj_team->update_search($ret_info['member_id'], 'user'); } } //联系方式 if (isset($this->input['member_contact']) && trim($this->input['member_contact']) == 'member_contact') { $member_contact = array('member_id' => $member_id, 'qq_num' => trim($this->input['qq_num']), 'other_com' => trim($this->input['other_com']), 'mobile' => trim($this->input['_mobile']), 'phone' => trim($this->input['phone']), 'email' => trim($this->input['_email']), 'address_country' => trim($this->input['address_country']), 'address_prov' => intval($this->input['address_prov']), 'address_city' => intval($this->input['address_city']), 'address_dist' => intval($this->input['address_dist']), 'address' => trim($this->input['address']), 'zipcode' => intval($this->input['zipcode']), 'website' => trim($this->input['website'])); if ($this->mMemberInfo->checkMemberInfo('member_contact', $member_id)) { $ret_contact = $this->mMemberInfo->memberContactCreate($member_contact, $member_id); } else { $ret_contact = $this->mMemberInfo->memberContactUpdate($member_contact, $member_id); } if (!$ret_contact['member_id']) { $this->errorOutput('会员联系方式编辑失败'); } } $this->addItem(array('success' => $member_id)); $this->output(); }