/** * 修改会员信息 */ public function mod_member() { $member_session_id = $_POST['member_session_id']; $member_id = $this->session_handle->getsession_userid($member_session_id, 1); $nick_name = isset($_POST['nick_name']) ? htmlspecialchars($_POST['nick_name']) : ''; $email = isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; $signature = isset($_POST['signature']) ? htmlspecialchars($_POST['signature']) : ''; $driving_exp = isset($_POST['driving_exp']) ? htmlspecialchars($_POST['driving_exp']) : ''; $gender = isset($_POST['gender']) ? htmlspecialchars($_POST['gender']) : ''; if (empty($nick_name)) { $this->jsonUtils->echo_json_msg(4, '用户昵称为空...'); exit; } /* * if(empty($email)){ * $this->JsonUtils->echo_json_msg(4,'email为空...');exit(); } */ $data['nick_name'] = $nick_name; if (!empty($email)) { $data['email'] = $email; } if (!empty($signature)) { $data['signature'] = $signature; } if (!empty($driving_exp)) { $data['driving_exp'] = $driving_exp; } if (isset($gender)) { $data['gender'] = (int) $gender; } if ($_FILES) { $img = mul_upload('/Header/', 3); if ($img) { $data['header'] = $img[0]; } } $result = $this->dao->where("id={$member_id['id']}")->save($data); if ($result === false) { $this->jsonUtils->echo_json_msg(1, '修改失败'); exit; } else { if (!empty($img[0])) { CommonController::saveHeader($member_id['id'], $member_id['type'], $img[0]); } CommonController::saveName($member_id['id'], $member_id['type'], $nick_name); $this->jsonUtils->echo_json_msg(0, '修改成功!'); exit; } }
/** * 执行审核通过 * @param int $id */ function execAction() { $id = $_REQUEST['id']; if (empty($id)) { return ''; } $arr = C('AUTH_DB_CONFIG'); $db = M('Auth'); $data = $db->where("id ={$id}")->find(); if ($data['status'] == 0) { $check_data = json_decode($data['check_data'], true); $db_no = $data['db_no']; $action = $data['check_action']; //商家操作 只能支持save 有触发器 关联聊天 if ($db_no == 0) { if ($action != 'save') { die('错误操作'); } } $where = array('id' => $data['mark_id']); $exec_db = M($arr[$db_no]); switch ($action) { case 'save': $exec = $exec_db->where($where)->save($check_data); break; case 'add': //未启用 $exec = $exec_db->add($check_data); break; case 'del': $exec = $exec_db->where($where)->delete(); break; default: die('错误数据:action'); break; } if ($exec === false) { $this->ajaxReturn(array('code' => 1, 'msg' => $exec_db->getLastSql())); exit; } else { if ($db_no == 0) { //同步更新 商户名称和头像 if (!empty($check_data["merchant_name"])) { CommonController::saveName($data['mark_id'], 2, $check_data["merchant_name"]); } if (!empty($check_data["header"])) { CommonController::saveHeader($data['mark_id'], 2, $check_data["header"]); } } $db->where("id ={$id}")->save(array('status' => 1)); //审核通过 $this->ajaxReturn(array('code' => 0, 'msg' => '审核成功')); exit; } } else { $this->ajaxReturn(array('code' => 1, 'msg' => '已操作过,无需审核')); exit; } }
/** * 修改个人资料 */ public function editUserInfoV2() { $session_id = isset($_POST['session_id']) ? htmlspecialchars($_POST['session_id']) : ''; $member_id = $this->session_handle->getsession_userid($session_id, 1); //$systemid = CommonController::getSystemUserid($member_id['id'],$member_id['type']); $pics = isset($_POST['pics']) ? trim($_POST['pics']) : ''; $signature = isset($_POST['signature']) ? htmlspecialchars($_POST['signature']) : ''; $nick_name = isset($_POST['nick_name']) ? htmlspecialchars($_POST['nick_name']) : ''; $gender = isset($_POST['gender']) ? htmlspecialchars($_POST['gender']) : ''; $driving_exp = isset($_POST['driving_exp']) ? htmlspecialchars($_POST['driving_exp']) : ''; $haunts = isset($_POST['haunts']) ? htmlspecialchars($_POST['haunts']) : ''; $interests = isset($_POST['interests']) ? htmlspecialchars($_POST['interests']) : ''; $personal_description = isset($_POST['personal_description']) ? htmlspecialchars($_POST['personal_description']) : ''; if (empty($nick_name)) { $this->jsonUtils->echo_json_msg(5, '昵称为空'); exit; } if (empty($gender) && !in_array($gender, array(1, 0))) { $this->jsonUtils->echo_json_msg(5, '性别为空'); exit; } if (empty($driving_exp)) { $this->jsonUtils->echo_json_msg(5, '驾龄为空'); exit; } $db = M('Member'); Log::write($pics, 'ERR'); if (!empty($pics)) { $arr_decode = json_decode($pics, true); if (!empty($arr_decode)) { foreach ($arr_decode as $key => $row) { if (!empty($row)) { $temp[$key]['hs'] = str_replace(C('ROOT_UPLOADS'), '', $row['hs']); $temp[$key]['hb'] = str_replace(C('ROOT_UPLOADS'), '', $row['hb']); } } foreach ($temp as $row) { $data['albums'][] = $row; } } else { $data['albums'] = array(); } } else { $data['albums'] = array(); } if ($_FILES) { $f_arr = mul_upload('/Merchant/', 1); if ($f_arr) { $data['albums'] = array_merge($data['albums'], $f_arr); // 把多张图片数组格式转json保存数据库 } } $data['albums'] = json_encode($data['albums']); $data['nick_name'] = $nick_name; CommonController::saveName($member_id['id'], 0, $nick_name); $data['gender'] = $gender; $data['driving_exp'] = $driving_exp; if (!empty($signature)) { $data['signature'] = $signature; } if (!empty($interests)) { $data['interests'] = $interests; } if (!empty($personal_description)) { $data['personal_description'] = $personal_description; } if (!empty($haunts)) { $data['haunts'] = $haunts; } $rel = $db->where(array('id' => $member_id['id']))->save($data); if ($rel === false) { $this->jsonUtils->echo_json_msg(6, '修改失败'); exit; } else { $this->jsonUtils->echo_json_msg(0, 'ok'); exit; } }