/** * 执行审核通过 * @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; } }
/** * 商家头像上传 * * @return [type] [description] */ public function merchantHeader() { $mer_session_id = isset($_POST['mer_session_id']) ? htmlspecialchars(trim($_POST['mer_session_id'])) : ''; $merchant_id = $this->session_handle->getsession_userid($mer_session_id, 1); if ($_FILES) { $result = mul_upload('/Header/', 3); // Log::write(json_encode($result),'ERR'); if ($result) { $data['header'] = $result[0]; $id = $merchant_id['id']; $this->dao->where(array('id' => $merchant_id['id']))->save($data); CommonController::saveHeader($merchant_id['id'], $merchant_id['type'], $result[0]); $header = imgUrl($result[0]); $this->jsonUtils->echo_json_data(0, '上传成功!', array('header' => $header)); exit; } else { $this->jsonUtils->echo_json_msg(1, '上传失败!'); exit; } } else { $this->jsonUtils->echo_json_msg(1, '无文件上传!'); exit; } }
/** * 修改会员信息 */ 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; } }