This commit is contained in:
oneao committed 2025-12-03 17:31:28 +08:00
1 parent e81f605999
commit cf9b01e633
26 files changed
+860 -935

No files matched your search

@@ -13,6 +13,7 @@ import EmptyState from '@/components/common/EmptyStatus'
import { GluestackUIProvider } from '@/components/ui/gluestack-ui-provider'
import { useMoneyCategoryStore } from '@/store/moneyCategory'
import { useNavStore } from '@/store/navigation'
import { useSpaceStore } from '@/store/space'
import { useUserStore } from '@/store/user'
import { ToastProviderWrapper } from '@/utils/toast'
import '@/styles/global.css'
@@ -43,9 +44,11 @@ export function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {
export default function RootLayout() {
const router = useRouter()
const userStore = useUserStore()
const moneyCategoryStore = useMoneyCategoryStore()
const pathname = usePathname()
const userStore = useUserStore()
const spaceStore = useSpaceStore()
const moneyCategoryStore = useMoneyCategoryStore()
const navStore = useNavStore()
const [fontsLoaded] = useFonts({
@@ -60,14 +63,15 @@ export default function RootLayout() {
if (!fontsLoaded)
return
// 初始化分类
moneyCategoryStore.init()
// 登录跳转
if (!userStore.isLoggedIn()) {
navStore.navigateToAuth()
}
// 如果登录的话,就初始化下
moneyCategoryStore.init()
spaceStore.init()
// 隐藏 splash
SplashScreen.hideAsync()
}, [fontsLoaded, userStore, moneyCategoryStore, router])
@@ -1,15 +1,22 @@
import { useState } from 'react'
import { useEffect, useState } from 'react'
import { View } from 'react-native'
import CustomHeader from '@/components/custom/Header'
import { useSpaceStore } from '@/store/space'
import JoinSpace from './components/JoinSpace'
import SpaceHome from './components/SpaceHome'
import SpaceInviteAndMembers from './components/SpaceInviteAndMembers'
import StepFade from './components/StepFade'
export default function PagerWithTab() {
const spaceStore = useSpaceStore()
const [step, setStep] = useState<'join' | 'invite' | 'home'>('home')
useEffect(() => {
spaceStore.init()
}, [])
return (
<View className="flex-1">
<CustomHeader title="共享空间" />
@@ -41,7 +41,6 @@ const Button: React.FC<CustomButtonProps> = ({
}) => {
const isDisabled = disabled || loading
const hasChildren = !!children
console.log(hasChildren)
const renderLeftIcon = () => {
if (loading)
return <ButtonSpinner color="#fff" className={hasChildren ? 'mr-2' : ''} />
@@ -0,0 +1,12 @@
import type { CreateSpaceParams, CreateSpaceResult, DissolveSpaceParams, DissolveSpaceResult } from '@/types/space/space'
import alovaInstance from '../../index'
const API_PREFIX = '/space'
export function createSpaceApi(params: CreateSpaceParams) {
return alovaInstance.Post<ResponseData<CreateSpaceResult>>(`${API_PREFIX}/create`, params)
}
export function dissolveSpaceApi(params: DissolveSpaceParams) {
return alovaInstance.Post<ResponseData<DissolveSpaceResult>>(`${API_PREFIX}/dissolve`, params)
}
@@ -0,0 +1,41 @@
import type {
ExitSpaceParams,
ExitSpaceResult,
GetUserSpaceParams,
GetUserSpaceResult,
JoinSpaceParams,
JoinSpaceResult,
ListSpaceUsersParams,
ListSpaceUsersResult,
RemoveSpaceUserParams,
RemoveSpaceUserResult,
UpdateSpaceUserRoleParams,
UpdateSpaceUserRoleResult,
} from '@/types/space/spaceUser'
import alovaInstance from '../../index'
const API_PREFIX = '/space/user'
export function getUserSpaceApi(params: GetUserSpaceParams) {
return alovaInstance.Get<ResponseData<GetUserSpaceResult | null>>(`${API_PREFIX}/get`, params)
}
export function exitSpaceApi(params: ExitSpaceParams) {
return alovaInstance.Post<ResponseData<ExitSpaceResult>>(`${API_PREFIX}/exit`, params)
}
export function joinSpaceApi(params: JoinSpaceParams) {
return alovaInstance.Post<ResponseData<JoinSpaceResult>>(`${API_PREFIX}/join`, params)
}
export function listSpaceUsersApi(params: ListSpaceUsersParams) {
return alovaInstance.Post<ResponseData<ListSpaceUsersResult>>(`${API_PREFIX}/list`, params)
}
export function removeSpaceUserApi(params: RemoveSpaceUserParams) {
return alovaInstance.Post<ResponseData<RemoveSpaceUserResult>>(`${API_PREFIX}/remove`, params)
}
export function updateSpaceUserRoleApi(params: UpdateSpaceUserRoleParams) {
return alovaInstance.Post<ResponseData<UpdateSpaceUserRoleResult>>(`${API_PREFIX}/updateRole`, params)
}
@@ -3,7 +3,6 @@ import type { AxiosError } from 'axios'
import type { RefreshTokenResult } from '@/types/auth'
import { axiosRequestAdapter } from '@alova/adapter-axios'
import { createAlova } from 'alova'
import { router } from 'expo-router'
import { useNavStore } from '@/store/navigation'
import { useUserStore } from '@/store/user'
import { toast } from '@/utils/toast'
@@ -35,12 +35,6 @@ export const useMoneyCategoryStore = create<MoneyCategoryStore>()(
set({ categories: get().categories.filter(c => c.id !== id) }),
init: async () => {
const local = get().categories
if (local && local.length > 0) {
return
}
try {
await queryMoneyCategoryApi().then((res) => {
if (res.isSuccess) {
@@ -0,0 +1,23 @@
import { create } from 'zustand'
import { getUserSpaceApi } from '@/request/api/space/spaceUser'
interface SpaceState {
userSpace: UserSpace | null
setUserSpace: (space: UserSpace | null) => void
init: () => Promise<void>
}
export const useSpaceStore = create<SpaceState>(set => ({
userSpace: null,
setUserSpace: space => set({ userSpace: space }),
init: async () => {
try {
const res = await getUserSpaceApi({})
set({ userSpace: res.isSuccess ? res.data : null })
}
catch (err) {
set({ userSpace: null })
console.error(err)
}
},
}))
+9 -1
View File
@@ -8,16 +8,24 @@ interface UserState {
setUserInfo: (userInfo: UserInfo | null) => void
logout: () => void
isLoggedIn: () => boolean
userSpace: UserSpace | null
setUserSpace: (userSpace: UserSpace | null) => void
}
const useUserStore = create<UserState>()(
persist(
(set, get) => ({
userInfo: null,
userSpace: null,
setUserInfo: userInfo => set({ userInfo }),
setUserSpace: userSpace => set({ userSpace }),
logout: () => {
set({ userInfo: null })
set({ userInfo: null, userSpace: null })
},
isLoggedIn: () => !!get().userInfo?.token,
}),
{
+6
View File
@@ -19,4 +19,10 @@ declare global {
refreshToken?: string
rememberMe?: boolean
}
interface UserSpace {
id: number
name: string
invite_code: string
}
}
@@ -0,0 +1,17 @@
// 创建空间
export interface CreateSpaceParams {
}
export interface CreateSpaceResult {
id: number
invite_code: string
}
// 解散空间
export interface DissolveSpaceParams {
}
export interface DissolveSpaceResult {
}
@@ -0,0 +1,61 @@
// 获取用户的空间
export interface GetUserSpaceParams {
}
export interface GetUserSpaceResult {
id: number
name: string
invite_code: string
}
// 退出空间
export interface ExitSpaceParams {
}
export interface ExitSpaceResult {
}
// 获取空间列表用户
export interface SpaceUser {
user_id: number
username: string
space_role: number
}
export interface ListSpaceUsersParams {
}
export interface ListSpaceUsersResult {
users: SpaceUser[]
}
// 踢出空间
export interface RemoveSpaceUserParams {
space_id: number
user_id: number
}
export interface RemoveSpaceUserResult {
}
// 更新用户权限
export interface UpdateSpaceUserRoleParams {
space_id: number
user_id: number
role: number
}
export interface UpdateSpaceUserRoleResult {
}
// 加入空间
export interface JoinSpaceParams {
invite_code: string
}
export interface JoinSpaceResult {
}
+153 -681
View File
@@ -1,708 +1,180 @@
<!DOCTYPE html>
<html lang="zh-CN">
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>查询进度步骤条 - 精确对齐版本</title>
<meta charset="UTF-8" />
<title>字段配置示例</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
padding: 40px 20px;
font-family: Arial;
padding: 20px;
}
.container {
table {
width: 100%;
max-width: 800px;
min-height: 600px;
background: white;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
overflow: hidden;
display: flex;
flex-direction: column;
}
.header {
background: linear-gradient(to right, #4b6cb7, #182848);
color: white;
padding: 25px 30px;
text-align: center;
}
.header h1 {
font-size: 24px;
font-weight: 600;
border-collapse: collapse;
margin-bottom: 5px;
}
.header p {
opacity: 0.9;
font-size: 14px;
th,
td {
border: 1px solid #ccc;
padding: 8px;
}
.progress-container {
padding: 40px 30px;
.config-row td {
background: #fafafa;
padding: 15px;
}
.config-panel {
display: flex;
gap: 20px;
}
.config-group {
flex: 1;
display: flex;
flex-direction: column;
border: 1px solid #ddd;
padding: 10px;
border-radius: 6px;
background: white;
}
.progress-steps {
display: flex;
justify-content: space-between;
position: relative;
margin-bottom: 30px;
counter-reset: step;
.config-group h4 {
margin-top: 0;
}
.step {
position: relative;
z-index: 3;
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
}
.step-connector {
position: absolute;
top: 25px;
height: 4px;
background-color: #e0e0e0;
z-index: 1;
}
.step-progress {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background: #4b6cb7;
transition: width 0.8s ease, background-color 0.8s ease;
z-index: 2;
}
.step-progress.success {
background: linear-gradient(to right, #4CAF50, #2E7D32);
}
.step-progress.failed {
background: linear-gradient(to right, #f44336, #c62828);
}
.step-icon {
width: 50px;
height: 50px;
border-radius: 50%;
background: #e0e0e0;
display: flex;
justify-content: center;
align-items: center;
color: #999;
font-weight: bold;
border: 4px solid white;
box-shadow: 0 0 0 3px #e0e0e0;
transition: all 0.5s ease;
position: relative;
z-index: 4;
}
.step.active .step-icon {
background: #4b6cb7;
color: white;
box-shadow: 0 0 0 3px #b8c6f0;
animation: pulse 1.5s infinite;
}
.step.completed .step-icon {
background: #4CAF50;
color: white;
box-shadow: 0 0 0 3px #a5d6a7;
}
.step.failed .step-icon {
background: #f44336;
color: white;
box-shadow: 0 0 0 3px #ffcdd2;
}
.step.completed .step-icon::after {
content: '✓';
font-size: 24px;
}
.step.failed .step-icon::after {
content: '✕';
font-size: 24px;
}
.step-label {
margin-top: 10px;
text-align: center;
font-size: 14px;
color: #666;
font-weight: 500;
max-width: 100px;
}
.step.active .step-label {
color: #4b6cb7;
font-weight: 600;
}
.step.completed .step-label {
color: #4CAF50;
}
.step.failed .step-label {
color: #f44336;
font-weight: 600;
}
.progress-info {
background: #f8f9fa;
border-radius: 8px;
padding: 20px;
margin-top: 20px;
text-align: center;
border-left: 4px solid #4b6cb7;
min-height: 120px;
display: flex;
flex-direction: column;
justify-content: center;
}
.progress-info.failed {
border-left-color: #f44336;
}
.progress-info.success {
border-left-color: #4CAF50;
}
.progress-status {
font-size: 16px;
color: #333;
.config-item {
margin-bottom: 10px;
}
.progress-details {
font-size: 14px;
color: #666;
line-height: 1.5;
}
.progress-time {
display: inline-block;
background: #e3f2fd;
padding: 3px 8px;
border-radius: 4px;
.config-item label {
display: block;
font-size: 12px;
color: #1565c0;
margin-top: 5px;
}
.error-message {
color: #f44336;
background: #ffebee;
padding: 10px;
border-radius: 4px;
margin-top: 10px;
font-size: 14px;
}
.buttons {
display: flex;
justify-content: center;
gap: 15px;
margin-top: 30px;
}
button {
padding: 12px 25px;
border: none;
border-radius: 6px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
#startBtn {
background: linear-gradient(to right, #4b6cb7, #182848);
color: white;
}
#retryBtn {
background: linear-gradient(to right, #ff9800, #f57c00);
color: white;
display: none;
}
#resetBtn {
background: #f5f5f5;
color: #666;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(75, 108, 183, 0.7);
}
70% {
box-shadow: 0 0 0 10px rgba(75, 108, 183, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(75, 108, 183, 0);
}
}
.spinner {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: white;
animation: spin 1s linear infinite;
margin-right: 8px;
vertical-align: middle;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@media (max-width: 600px) {
.step-icon {
width: 40px;
height: 40px;
}
.step-label {
font-size: 12px;
max-width: 80px;
}
.progress-info {
padding: 15px;
}
button {
padding: 10px 20px;
font-size: 14px;
}
.container {
min-height: 500px;
}
.config-item input[type="text"],
.config-item input[type="number"],
.config-item textarea {
width: 100%;
padding: 5px;
margin-top: 2px;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>远程数据查询进度</h1>
<p>正在从服务器获取数据,每一步都可能失败,请耐心等待...</p>
</div>
<div class="progress-container">
<div class="progress-steps">
<!-- 步骤1 -->
<div class="step active" id="step1">
<div class="step-icon">1</div>
<div class="step-label">验证查询条件</div>
</div>
<!-- 步骤2 -->
<div class="step" id="step2">
<div class="step-icon">2</div>
<div class="step-label">发出请求</div>
</div>
<!-- 步骤3 -->
<div class="step" id="step3">
<div class="step-icon">3</div>
<div class="step-label">等待响应</div>
</div>
<!-- 步骤4 -->
<div class="step" id="step4">
<div class="step-icon">4</div>
<div class="step-label">查询成功</div>
</div>
<!-- 连接线1-2 -->
<div class="step-connector" id="connector1" style="left: 12.5%; width: 25%;">
<div class="step-progress" id="progress1"></div>
</div>
<!-- 连接线2-3 -->
<div class="step-connector" id="connector2" style="left: 37.5%; width: 25%;">
<div class="step-progress" id="progress2"></div>
</div>
<!-- 连接线3-4 -->
<div class="step-connector" id="connector3" style="left: 62.5%; width: 25%;">
<div class="step-progress" id="progress3"></div>
</div>
</div>
<div class="progress-info" id="progressInfo">
<div class="progress-status" id="progressStatus">正在验证查询条件...</div>
<div class="progress-details" id="progressDetails">
检查查询参数的有效性,确保数据请求符合系统要求。
<div class="progress-time">已用时间: <span id="timeElapsed">0分00秒</span></div>
</div>
<div class="error-message" id="errorMessage" style="display: none;"></div>
</div>
<div class="buttons">
<button id="startBtn">开始查询</button>
<button id="retryBtn">重试当前步骤</button>
<button id="resetBtn" disabled>重置进度</button>
</div>
</div>
</div>
<h2>字段配置示例</h2>
<table id="fieldTable">
<thead>
<tr>
<th>字段名</th>
<th>类型</th>
<th>必填</th>
<th style="width: 80px">操作</th>
</tr>
</thead>
<tbody id="fieldTableBody">
</tbody>
</table>
<script>
document.addEventListener('DOMContentLoaded', function() {
const steps = document.querySelectorAll('.step');
const stepProgresses = document.querySelectorAll('.step-progress');
const connectors = document.querySelectorAll('.step-connector');
const progressInfoElement = document.getElementById('progressInfo');
const progressStatus = document.getElementById('progressStatus');
const progressDetails = document.getElementById('progressDetails');
const errorMessage = document.getElementById('errorMessage');
const timeElapsed = document.getElementById('timeElapsed');
const startBtn = document.getElementById('startBtn');
const retryBtn = document.getElementById('retryBtn');
const resetBtn = document.getElementById('resetBtn');
let currentStep = 1;
let isRunning = false;
let hasFailed = false;
let timerInterval;
let seconds = 0;
let stepStatus = [null, 'active', null, null, null];
// 计算连接线位置
function calculateConnectorPositions() {
const stepWidth = 100 / steps.length; // 每个步骤占据的宽度百分比
connectors.forEach((connector, index) => {
// 计算连接线的起始位置和宽度
const left = (index + 0.5) * stepWidth; // 从第一个步骤的中心开始
const width = stepWidth; // 连接线宽度等于步骤宽度
connector.style.left = `${left}%`;
connector.style.width = `${width}%`;
});
}
// 更新步骤状态
function updateSteps() {
steps.forEach((step, index) => {
step.classList.remove('active', 'completed', 'failed');
if (index + 1 < currentStep) {
step.classList.add('completed');
} else if (index + 1 === currentStep) {
if (currentStep > steps.length) {
// 如果所有步骤已完成,最后一个步骤显示为完成状态
step.classList.add('completed');
} else {
step.classList.add('active');
}
}
});
}
// 更新进度条
function updateProgressBars() {
// 重置所有进度条
stepProgresses.forEach((progress, index) => {
progress.style.width = '0';
progress.classList.remove('success', 'failed');
});
// 设置已完成的进度条
for (let i = 1; i < currentStep; i++) {
if (i <= stepProgresses.length) {
const progress = document.getElementById(`progress${i}`);
if (progress) {
progress.style.width = '100%';
// 根据步骤状态设置颜色
if (stepStatus[i] === 'completed') {
progress.classList.add('success');
} else if (stepStatus[i] === 'failed') {
progress.classList.add('failed');
}
}
}
}
}
// 标记步骤失败
function markStepFailed(stepIndex, error) {
stepStatus[stepIndex] = 'failed';
hasFailed = true;
steps[stepIndex - 1].classList.remove('active', 'completed');
steps[stepIndex - 1].classList.add('failed');
// 标记前一个连接线为失败
if (stepIndex > 1) {
const prevProgress = document.getElementById(`progress${stepIndex - 1}`);
if (prevProgress) {
prevProgress.classList.add('failed');
}
}
progressInfoElement.classList.add('failed');
errorMessage.textContent = error;
errorMessage.style.display = 'block';
isRunning = false;
stopTimer();
startBtn.disabled = true;
retryBtn.style.display = 'inline-block';
resetBtn.disabled = false;
updateProgressBars();
}
// 标记步骤成功
function markStepCompleted(stepIndex) {
stepStatus[stepIndex] = 'completed';
updateSteps();
// 标记前一个连接线为成功
if (stepIndex > 1) {
const prevProgress = document.getElementById(`progress${stepIndex - 1}`);
if (prevProgress) {
prevProgress.classList.add('success');
}
}
updateProgressBars();
}
// 标记所有步骤完成
function markAllStepsCompleted() {
for (let i = 1; i <= steps.length; i++) {
stepStatus[i] = 'completed';
}
updateSteps();
updateProgressBars();
}
// 更新状态信息
function updateStatus() {
const statusTexts = [
'',
'正在验证查询条件...',
'正在向服务器发出请求...',
'正在等待服务器响应...',
'查询成功,正在处理结果...'
];
const detailTexts = [
'',
'检查查询参数的有效性,确保数据请求符合系统要求。',
'将查询请求发送到远程服务器,建立数据连接。',
'等待服务器处理查询请求并返回结果。',
'处理查询结果并准备返回,即将完成整个过程。'
];
progressStatus.textContent = statusTexts[currentStep];
progressDetails.innerHTML = detailTexts[currentStep] +
`<div class="progress-time">已用时间: <span id="timeElapsed">${formatTime(seconds)}</span></div>`;
// 隐藏错误信息
errorMessage.style.display = 'none';
progressInfoElement.classList.remove('failed');
}
// 格式化时间显示
function formatTime(totalSeconds) {
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return `${minutes}分${seconds.toString().padStart(2, '0')}秒`;
}
// 开始计时器
function startTimer() {
seconds = 0;
timerInterval = setInterval(() => {
seconds++;
timeElapsed.textContent = formatTime(seconds);
}, 1000);
}
// 停止计时器
function stopTimer() {
clearInterval(timerInterval);
}
// 模拟查询过程
function simulateQuery() {
if (currentStep > steps.length) {
// 查询完成
isRunning = false;
hasFailed = false;
startBtn.disabled = true;
retryBtn.style.display = 'none';
resetBtn.disabled = false;
stopTimer();
// 标记所有步骤为完成状态
markAllStepsCompleted();
progressStatus.innerHTML = '<span style="color:#4CAF50;">查询完成!</span>';
progressDetails.innerHTML = '数据查询已成功完成,结果已准备就绪。' +
`<div class="progress-time">总用时: <span id="timeElapsed">${formatTime(seconds)}</span></div>`;
return;
}
// 模拟每个步骤的耗时
const stepDurations = [0, 1000, 1000, 1000, 1000];
// 模拟每一步有20%的失败概率
const willFail = Math.random() < 0.2;
setTimeout(() => {
if (willFail && !hasFailed) {
// 模拟失败
const errorMessages = [
'',
'验证查询条件失败:查询参数格式不正确。',
'发出请求失败:无法连接到远程服务器。',
'等待响应失败:服务器响应超时。',
'查询成功失败:数据处理错误。'
];
markStepFailed(currentStep, errorMessages[currentStep]);
return;
}
if (currentStep === steps.length) {
// 最后一步成功,标记为完成
markStepCompleted(currentStep);
currentStep++;
// 完成所有步骤
updateProgressBars();
updateStatus();
simulateQuery();
} else {
// 步骤成功,继续下一步
markStepCompleted(currentStep);
currentStep++;
updateStatus();
if (currentStep <= steps.length) {
// 继续下一步
updateSteps();
updateProgressBars();
simulateQuery();
}
}
}, stepDurations[currentStep]);
}
// 开始查询
startBtn.addEventListener('click', function() {
if (!isRunning) {
isRunning = true;
hasFailed = false;
// 重置步骤状态
stepStatus = [null, 'active', null, null, null];
startBtn.disabled = true;
retryBtn.style.display = 'none';
resetBtn.disabled = true;
startTimer();
updateSteps();
updateProgressBars();
simulateQuery();
const fields = [
{ id: 1, name: "username", type: "string", required: true, default: "", repeat: false, maxLen: 20, desc: "" },
{ id: 2, name: "age", type: "number", required: false, default: 0, repeat: false, maxLen: 3, desc: "" },
];
let openConfigRowId = null;
function renderTable() {
const tbody = document.getElementById("fieldTableBody");
tbody.innerHTML = "";
fields.forEach(field => {
// 主行
const tr = document.createElement("tr");
tr.innerHTML = `
<td>${field.name}</td>
<td>${field.type}</td>
<td>${field.required ? "是" : "否"}</td>
<td><button onclick="toggleConfig(${field.id})">配置</button></td>
`;
tbody.appendChild(tr);
// 配置行
if (openConfigRowId === field.id) {
const cfgRow = document.createElement("tr");
cfgRow.className = "config-row";
cfgRow.innerHTML = `
<td colspan="4">
${renderConfigPanel(field)}
</td>
`;
tbody.appendChild(cfgRow);
}
});
// 重试当前步骤
retryBtn.addEventListener('click', function() {
if (!isRunning) {
isRunning = true;
hasFailed = false;
startBtn.disabled = true;
retryBtn.style.display = 'none';
resetBtn.disabled = true;
startTimer();
// 重新开始当前步骤
updateSteps();
updateStatus();
simulateQuery();
}
});
// 重置进度
resetBtn.addEventListener('click', function() {
isRunning = false;
hasFailed = false;
currentStep = 1;
stepStatus = [null, 'active', null, null, null];
updateSteps();
updateProgressBars();
updateStatus();
stopTimer();
seconds = 0;
timeElapsed.textContent = formatTime(seconds);
startBtn.disabled = false;
retryBtn.style.display = 'none';
resetBtn.disabled = true;
progressStatus.textContent = '准备开始新的查询...';
progressDetails.innerHTML = '点击"开始查询"按钮启动数据检索过程。' +
`<div class="progress-time">已用时间: <span id="timeElapsed">${formatTime(seconds)}</span></div>`;
});
// 初始化
calculateConnectorPositions();
updateSteps();
updateProgressBars();
updateStatus();
// 窗口大小改变时重新计算连接线位置
window.addEventListener('resize', function() {
calculateConnectorPositions();
});
});
}
function toggleConfig(id) {
openConfigRowId = openConfigRowId === id ? null : id;
renderTable();
}
function renderConfigPanel(field) {
return `
<div class="config-panel">
<div class="config-group">
<h4>基础配置</h4>
<div class="config-item">
<label>字段名</label>
<input type="text" value="${field.name}" oninput="updateField(${field.id}, 'name', this.value)">
</div>
<div class="config-item">
<label>默认值</label>
<input type="text" value="${field.default}" oninput="updateField(${field.id}, 'default', this.value)">
</div>
<div class="config-item">
<label><input type="checkbox" ${field.repeat ? "checked" : ""} onchange="updateField(${field.id}, 'repeat', this.checked)"> 可重复</label>
</div>
</div>
<div class="config-group">
<h4>校验配置</h4>
<div class="config-item">
<label>必填</label>
<input type="checkbox" ${field.required ? "checked" : ""} onchange="updateField(${field.id}, 'required', this.checked)">
</div>
<div class="config-item">
<label>最大长度</label>
<input type="number" value="${field.maxLen}" oninput="updateField(${field.id}, 'maxLen', this.value)">
</div>
</div>
<div class="config-group">
<h4>展示配置</h4>
<div class="config-item">
<label>说明</label>
<textarea rows="4" oninput="updateField(${field.id}, 'desc', this.value)">${field.desc}</textarea>
</div>
</div>
</div>
`;
}
function updateField(id, key, value) {
const field = fields.find(f => f.id === id);
field[key] = value;
}
renderTable();
</script>
</body>
</html>
</html>
@@ -18,11 +18,11 @@ import (
"github.com/cloudwego/hertz/pkg/protocol/consts"
)
// InsertSpace .
// @router /space/insert [POST]
func InsertSpace(ctx context.Context, c *app.RequestContext) {
// CreateSpace .
// @router /space/create [POST]
func CreateSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.InsertSpaceParams
var req space.CreateSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -109,7 +109,7 @@ func InsertSpace(ctx context.Context, c *app.RequestContext) {
return
}
resp := &space.InsertSpaceResult{
resp := &space.CreateSpaceResult{
Id: spaceId,
InviteCode: inviteCode,
}
@@ -117,11 +117,11 @@ func InsertSpace(ctx context.Context, c *app.RequestContext) {
response.Success(c).Data(resp).Send()
}
// DeleteSpace .
// @router /space/delete [POST]
func DeleteSpace(ctx context.Context, c *app.RequestContext) {
// DissolveSpace .
// @router /space/dissolve [POST]
func DissolveSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.DeleteSpaceParams
var req space.DissolveSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
@@ -8,6 +8,7 @@ import (
"cn/oneao/base-go/db"
"cn/oneao/base-go/db/repo"
"cn/oneao/base-go/utils/errorx"
"cn/oneao/base-go/utils/idgen"
"cn/oneao/base-go/utils/response"
"context"
@@ -16,7 +17,7 @@ import (
)
// ExitSpace .
// @router /space_user/exit [POST]
// @router /space/user/exit [POST]
func ExitSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.ExitSpaceParams
@@ -39,7 +40,7 @@ func ExitSpace(ctx context.Context, c *app.RequestContext) {
}
// ListSpaceUsers .
// @router /space_user/list [POST]
// @router /space/user/list [POST]
func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
var err error
var req space.ListSpaceUsersParams
@@ -49,16 +50,32 @@ func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
return
}
spaceId := req.SpaceId
// 先创建空返回对象
resp := &space.ListSpaceUsersResult{
Users: []*space.SpaceUser{},
}
userID := middleware.GetUserID(ctx)
// 获取用户所在空间
spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil || errorx.IsNotFound(err) {
// 未加入空间或查询出错,直接返回空数组
response.Success(c).Data(resp).Send()
return
}
spaceId := spaceByUserId.ID
// 查询空间内用户
users, err := db.Queries.ListSpaceUsers(ctx, spaceId)
if err != nil {
// 查询出错,返回空数组
errorx.AddError(c, err)
return
}
resp := &space.ListSpaceUsersResult{}
// 填充用户列表
for _, u := range users {
resp.Users = append(resp.Users, &space.SpaceUser{
UserId: u.UserID,
@@ -71,7 +88,7 @@ func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
}
// RemoveSpaceUser .
// @router /space_user/remove [POST]
// @router /space/user/remove [POST]
func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
var req space.RemoveSpaceUserParams
if err := c.BindAndValidate(&req); err != nil {
@@ -137,7 +154,7 @@ func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
}
// UpdateSpaceUserRole .
// @router /space_user/updateRole [POST]
// @router /space/user/updateRole [POST]
func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
var req space.UpdateSpaceUserRoleParams
if err := c.BindAndValidate(&req); err != nil {
@@ -163,16 +180,22 @@ func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
return
}
// 3. 权限检查:只有创建者或管理员可以修改他人角色
// 3. 权限检查:只有创建者可以修改他人角色
// 假设 Role: 0=创建者, 1=管理员, 2=普通成员
if operator.Role != 0 && operator.Role != 1 {
if operator.Role != 0 {
response.Fail(c).Message("权限不足").Send()
return
}
// 3.1 不允许修改自己的角色
if operator.UserID == req.UserId {
response.Fail(c).Message("不能修改自己的角色").Send()
return
}
// 4. 校验目标 Role 是否合法
if req.Role != 1 && req.Role != 2 {
response.Fail(c).Message("Role 只能是 1 或 2").Send()
response.Fail(c).Message("角色修改错误").Send()
return
}
@@ -203,5 +226,96 @@ func UpdateSpaceUserRole(ctx context.Context, c *app.RequestContext) {
return
}
response.Success(c).Data().Send()
response.Success(c).Send()
}
// JoinSpace .
// @router /space/user/join [POST]
func JoinSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.JoinSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
userID := middleware.GetUserID(ctx)
inviteCode := req.InviteCode
// 检查该用户是否已加入其他空间
_, err = db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil {
if errorx.IsNotFound(err) {
} else {
errorx.AddError(c, err)
}
} else {
response.Fail(c).Message("请先退出已加入的空间").Send()
return
}
// 检查验证码是否有效
spaceByCode, err := db.Queries.GetSpaceByInviteCode(ctx, inviteCode)
if err != nil {
if errorx.IsNotFound(err) {
response.Fail(c).Message("邀请码无效").Send()
return
} else {
errorx.AddError(c, err)
return
}
}
// 加入空间,默认
params := repo.InsertSpaceUserParams{
ID: idgen.NextId(),
SpaceID: spaceByCode.ID,
UserID: userID,
Role: 2,
}
err = db.Queries.InsertSpaceUser(ctx, params)
if err != nil {
errorx.AddError(c, err)
return
}
response.Success(c).Message("加入空间成功").Send()
}
// GetUserSpace .
// @router /space/user/get [GET]
func GetUserSpace(ctx context.Context, c *app.RequestContext) {
var err error
var req space.GetUserSpaceParams
err = c.BindAndValidate(&req)
if err != nil {
c.String(consts.StatusBadRequest, err.Error())
return
}
resp := new(space.GetUserSpaceResult)
userID := middleware.GetUserID(ctx)
spaceByUserId, err := db.Queries.GetSpaceByUserId(ctx, userID)
if err != nil {
if errorx.IsNotFound(err) {
response.Success(c).Data(nil).Send()
return
} else {
errorx.AddError(c, err)
return
}
}
resp.Id = spaceByUserId.ID
resp.Name = spaceByUserId.Name.String
resp.InviteCode = spaceByUserId.InviteCode
response.Success(c).Data(resp).Send()
}
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: api.proto
package api
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space.proto
package space
@@ -28,79 +28,97 @@ var file_space_proto_rawDesc = []byte{
0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f,
0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xba, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, 0x65,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65, 0x72,
0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49,
0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53,
0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d,
0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x54, 0x0a,
0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73,
0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x64, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x32, 0xa5, 0x03, 0x0a, 0x10, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65,
0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x09, 0x45, 0x78, 0x69, 0x74,
0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78,
0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e,
0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70, 0x61, 0x63,
0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x69, 0x74, 0x12, 0x60, 0x0a, 0x0e, 0x4c,
0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xc2, 0x01, 0x0a, 0x0c, 0x53, 0x70, 0x61, 0x63, 0x65,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x1a, 0x18, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0xd2, 0xc1, 0x18, 0x0d,
0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x5c, 0x0a,
0x0d, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a,
0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1a, 0x2e, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x13, 0xd2, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x32, 0xd3, 0x04, 0x0a, 0x10,
0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x59, 0x0a, 0x0c, 0x67, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65,
0x12, 0x19, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x19, 0x2e, 0x73, 0x70,
0x61, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x13, 0xca, 0xc1, 0x18, 0x0f, 0x2f, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x67, 0x65, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x45,
0x78, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65,
0x2e, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61,
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73,
0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x69, 0x74, 0x12, 0x60,
0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73,
0x12, 0x1b, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61,
0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e,
0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55,
0x73, 0x65, 0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1b, 0x2e, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72,
0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10, 0x2f, 0x73, 0x70,
0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x65, 0x0a,
0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72,
0x12, 0x1c, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x1c,
0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61,
0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x16, 0xd2, 0xc1,
0x18, 0x12, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x72, 0x65,
0x6d, 0x6f, 0x76, 0x65, 0x12, 0x75, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70,
0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x20, 0x2e, 0x73, 0x70,
0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55,
0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x20, 0x2e,
0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63,
0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22,
0x1a, 0xd2, 0xc1, 0x18, 0x16, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72,
0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x22, 0x5a, 0x20, 0x63,
0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f,
0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18, 0x10,
0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6c, 0x69, 0x73, 0x74,
0x12, 0x65, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55,
0x73, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x1a, 0x1c, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22,
0x16, 0xd2, 0xc1, 0x18, 0x12, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72,
0x2f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x75, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x20,
0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61,
0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x1a, 0x20, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53,
0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x22, 0x1a, 0xd2, 0xc1, 0x18, 0x16, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75,
0x73, 0x65, 0x72, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x51,
0x0a, 0x09, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x70,
0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x4a, 0x6f, 0x69, 0x6e,
0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0xd2, 0xc1, 0x18,
0x10, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x6a, 0x6f, 0x69,
0x6e, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61,
0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f,
0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_space_proto_goTypes = []interface{}{
(*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams
(*DeleteSpaceParams)(nil), // 1: space.DeleteSpaceParams
(*ExitSpaceParams)(nil), // 2: space.ExitSpaceParams
(*ListSpaceUsersParams)(nil), // 3: space.ListSpaceUsersParams
(*RemoveSpaceUserParams)(nil), // 4: space.RemoveSpaceUserParams
(*UpdateSpaceUserRoleParams)(nil), // 5: space.UpdateSpaceUserRoleParams
(*InsertSpaceResult)(nil), // 6: space.InsertSpaceResult
(*DeleteSpaceResult)(nil), // 7: space.DeleteSpaceResult
(*ExitSpaceResult)(nil), // 8: space.ExitSpaceResult
(*ListSpaceUsersResult)(nil), // 9: space.ListSpaceUsersResult
(*RemoveSpaceUserResult)(nil), // 10: space.RemoveSpaceUserResult
(*UpdateSpaceUserRoleResult)(nil), // 11: space.UpdateSpaceUserRoleResult
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
(*DissolveSpaceParams)(nil), // 1: space.DissolveSpaceParams
(*GetUserSpaceParams)(nil), // 2: space.GetUserSpaceParams
(*ExitSpaceParams)(nil), // 3: space.ExitSpaceParams
(*ListSpaceUsersParams)(nil), // 4: space.ListSpaceUsersParams
(*RemoveSpaceUserParams)(nil), // 5: space.RemoveSpaceUserParams
(*UpdateSpaceUserRoleParams)(nil), // 6: space.UpdateSpaceUserRoleParams
(*JoinSpaceParams)(nil), // 7: space.JoinSpaceParams
(*DissolveSpaceResult)(nil), // 8: space.DissolveSpaceResult
(*GetUserSpaceResult)(nil), // 9: space.GetUserSpaceResult
(*ExitSpaceResult)(nil), // 10: space.ExitSpaceResult
(*ListSpaceUsersResult)(nil), // 11: space.ListSpaceUsersResult
(*RemoveSpaceUserResult)(nil), // 12: space.RemoveSpaceUserResult
(*UpdateSpaceUserRoleResult)(nil), // 13: space.UpdateSpaceUserRoleResult
(*JoinSpaceResult)(nil), // 14: space.JoinSpaceResult
}
var file_space_proto_depIdxs = []int32{
0, // 0: space.SpaceService.InsertSpace:input_type -> space.InsertSpaceParams
1, // 1: space.SpaceService.DeleteSpace:input_type -> space.DeleteSpaceParams
2, // 2: space.SpaceUserService.ExitSpace:input_type -> space.ExitSpaceParams
3, // 3: space.SpaceUserService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams
4, // 4: space.SpaceUserService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams
5, // 5: space.SpaceUserService.UpdateSpaceUserRole:input_type -> space.UpdateSpaceUserRoleParams
6, // 6: space.SpaceService.InsertSpace:output_type -> space.InsertSpaceResult
7, // 7: space.SpaceService.DeleteSpace:output_type -> space.DeleteSpaceResult
8, // 8: space.SpaceUserService.ExitSpace:output_type -> space.ExitSpaceResult
9, // 9: space.SpaceUserService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult
10, // 10: space.SpaceUserService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult
11, // 11: space.SpaceUserService.UpdateSpaceUserRole:output_type -> space.UpdateSpaceUserRoleResult
6, // [6:12] is the sub-list for method output_type
0, // [0:6] is the sub-list for method input_type
0, // 0: space.SpaceService.CreateSpace:input_type -> space.CreateSpaceParams
1, // 1: space.SpaceService.DissolveSpace:input_type -> space.DissolveSpaceParams
2, // 2: space.SpaceUserService.getUserSpace:input_type -> space.GetUserSpaceParams
3, // 3: space.SpaceUserService.ExitSpace:input_type -> space.ExitSpaceParams
4, // 4: space.SpaceUserService.ListSpaceUsers:input_type -> space.ListSpaceUsersParams
5, // 5: space.SpaceUserService.RemoveSpaceUser:input_type -> space.RemoveSpaceUserParams
6, // 6: space.SpaceUserService.UpdateSpaceUserRole:input_type -> space.UpdateSpaceUserRoleParams
7, // 7: space.SpaceUserService.JoinSpace:input_type -> space.JoinSpaceParams
0, // 8: space.SpaceService.CreateSpace:output_type -> space.CreateSpaceParams
8, // 9: space.SpaceService.DissolveSpace:output_type -> space.DissolveSpaceResult
9, // 10: space.SpaceUserService.getUserSpace:output_type -> space.GetUserSpaceResult
10, // 11: space.SpaceUserService.ExitSpace:output_type -> space.ExitSpaceResult
11, // 12: space.SpaceUserService.ListSpaceUsers:output_type -> space.ListSpaceUsersResult
12, // 13: space.SpaceUserService.RemoveSpaceUser:output_type -> space.RemoveSpaceUserResult
13, // 14: space.SpaceUserService.UpdateSpaceUserRole:output_type -> space.UpdateSpaceUserRoleResult
14, // 15: space.SpaceUserService.JoinSpace:output_type -> space.JoinSpaceResult
8, // [8:16] is the sub-list for method output_type
0, // [0:8] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space/space_types.proto
package space
@@ -22,14 +22,14 @@ const (
)
// 创建空间
type InsertSpaceParams struct {
type CreateSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *InsertSpaceParams) Reset() {
*x = InsertSpaceParams{}
func (x *CreateSpaceParams) Reset() {
*x = CreateSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -37,13 +37,13 @@ func (x *InsertSpaceParams) Reset() {
}
}
func (x *InsertSpaceParams) String() string {
func (x *CreateSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceParams) ProtoMessage() {}
func (*CreateSpaceParams) ProtoMessage() {}
func (x *InsertSpaceParams) ProtoReflect() protoreflect.Message {
func (x *CreateSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -55,12 +55,12 @@ func (x *InsertSpaceParams) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceParams.ProtoReflect.Descriptor instead.
func (*InsertSpaceParams) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateSpaceParams.ProtoReflect.Descriptor instead.
func (*CreateSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{0}
}
type InsertSpaceResult struct {
type CreateSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -69,8 +69,8 @@ type InsertSpaceResult struct {
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *InsertSpaceResult) Reset() {
*x = InsertSpaceResult{}
func (x *CreateSpaceResult) Reset() {
*x = CreateSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -78,13 +78,13 @@ func (x *InsertSpaceResult) Reset() {
}
}
func (x *InsertSpaceResult) String() string {
func (x *CreateSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InsertSpaceResult) ProtoMessage() {}
func (*CreateSpaceResult) ProtoMessage() {}
func (x *InsertSpaceResult) ProtoReflect() protoreflect.Message {
func (x *CreateSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -96,19 +96,19 @@ func (x *InsertSpaceResult) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use InsertSpaceResult.ProtoReflect.Descriptor instead.
func (*InsertSpaceResult) Descriptor() ([]byte, []int) {
// Deprecated: Use CreateSpaceResult.ProtoReflect.Descriptor instead.
func (*CreateSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{1}
}
func (x *InsertSpaceResult) GetId() int64 {
func (x *CreateSpaceResult) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *InsertSpaceResult) GetInviteCode() string {
func (x *CreateSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
@@ -116,14 +116,14 @@ func (x *InsertSpaceResult) GetInviteCode() string {
}
// 解散空间
type DeleteSpaceParams struct {
type DissolveSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceParams) Reset() {
*x = DeleteSpaceParams{}
func (x *DissolveSpaceParams) Reset() {
*x = DissolveSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -131,13 +131,13 @@ func (x *DeleteSpaceParams) Reset() {
}
}
func (x *DeleteSpaceParams) String() string {
func (x *DissolveSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceParams) ProtoMessage() {}
func (*DissolveSpaceParams) ProtoMessage() {}
func (x *DeleteSpaceParams) ProtoReflect() protoreflect.Message {
func (x *DissolveSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -149,19 +149,19 @@ func (x *DeleteSpaceParams) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceParams.ProtoReflect.Descriptor instead.
func (*DeleteSpaceParams) Descriptor() ([]byte, []int) {
// Deprecated: Use DissolveSpaceParams.ProtoReflect.Descriptor instead.
func (*DissolveSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{2}
}
type DeleteSpaceResult struct {
type DissolveSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DeleteSpaceResult) Reset() {
*x = DeleteSpaceResult{}
func (x *DissolveSpaceResult) Reset() {
*x = DissolveSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_types_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -169,13 +169,13 @@ func (x *DeleteSpaceResult) Reset() {
}
}
func (x *DeleteSpaceResult) String() string {
func (x *DissolveSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteSpaceResult) ProtoMessage() {}
func (*DissolveSpaceResult) ProtoMessage() {}
func (x *DeleteSpaceResult) ProtoReflect() protoreflect.Message {
func (x *DissolveSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_types_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -187,8 +187,8 @@ func (x *DeleteSpaceResult) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use DeleteSpaceResult.ProtoReflect.Descriptor instead.
func (*DeleteSpaceResult) Descriptor() ([]byte, []int) {
// Deprecated: Use DissolveSpaceResult.ProtoReflect.Descriptor instead.
func (*DissolveSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_types_proto_rawDescGZIP(), []int{3}
}
@@ -197,20 +197,20 @@ var File_space_space_types_proto protoreflect.FileDescriptor
var file_space_space_types_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x73, 0x70, 0x61, 0x63, 0x65,
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x49,
0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0x5c, 0x0a, 0x11, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x22, 0x5c, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a,
0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f,
0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x13,
0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x70, 0x61,
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f,
0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a,
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x15,
0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x73, 0x6f, 0x6c, 0x76,
0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20,
0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f,
0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -227,10 +227,10 @@ func file_space_space_types_proto_rawDescGZIP() []byte {
var file_space_space_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_space_space_types_proto_goTypes = []interface{}{
(*InsertSpaceParams)(nil), // 0: space.InsertSpaceParams
(*InsertSpaceResult)(nil), // 1: space.InsertSpaceResult
(*DeleteSpaceParams)(nil), // 2: space.DeleteSpaceParams
(*DeleteSpaceResult)(nil), // 3: space.DeleteSpaceResult
(*CreateSpaceParams)(nil), // 0: space.CreateSpaceParams
(*CreateSpaceResult)(nil), // 1: space.CreateSpaceResult
(*DissolveSpaceParams)(nil), // 2: space.DissolveSpaceParams
(*DissolveSpaceResult)(nil), // 3: space.DissolveSpaceResult
}
var file_space_space_types_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -247,7 +247,7 @@ func file_space_space_types_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_space_space_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceParams); i {
switch v := v.(*CreateSpaceParams); i {
case 0:
return &v.state
case 1:
@@ -259,7 +259,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InsertSpaceResult); i {
switch v := v.(*CreateSpaceResult); i {
case 0:
return &v.state
case 1:
@@ -271,7 +271,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceParams); i {
switch v := v.(*DissolveSpaceParams); i {
case 0:
return &v.state
case 1:
@@ -283,7 +283,7 @@ func file_space_space_types_proto_init() {
}
}
file_space_space_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSpaceResult); i {
switch v := v.(*DissolveSpaceResult); i {
case 0:
return &v.state
case 1:
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v6.33.1
// protoc v4.25.3
// source: space/space_user_types.proto
package space
@@ -26,8 +26,6 @@ type ListSpaceUsersParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"`
}
func (x *ListSpaceUsersParams) Reset() {
@@ -62,13 +60,6 @@ func (*ListSpaceUsersParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{0}
}
func (x *ListSpaceUsersParams) GetSpaceId() int64 {
if x != nil {
return x.SpaceId
}
return 0
}
type SpaceUser struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -185,7 +176,7 @@ type JoinSpaceParams struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
InviteCode int64 `protobuf:"varint,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"` // 邀请码
InviteCode string `protobuf:"bytes,1,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code" vd:"$ != ''"` // 邀请码
}
func (x *JoinSpaceParams) Reset() {
@@ -220,20 +211,17 @@ func (*JoinSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{3}
}
func (x *JoinSpaceParams) GetInviteCode() int64 {
func (x *JoinSpaceParams) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return 0
return ""
}
type JoinSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id"`
InviteCode string `protobuf:"bytes,2,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *JoinSpaceResult) Reset() {
@@ -268,20 +256,6 @@ func (*JoinSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{4}
}
func (x *JoinSpaceResult) GetSpaceId() int64 {
if x != nil {
return x.SpaceId
}
return 0
}
func (x *JoinSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
// 退出空间
type ExitSpaceParams struct {
state protoimpl.MessageState
@@ -555,41 +529,135 @@ func (*UpdateSpaceUserRoleResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{10}
}
// 获取当前用户的空间信息
type GetUserSpaceParams struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetUserSpaceParams) Reset() {
*x = GetUserSpaceParams{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserSpaceParams) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserSpaceParams) ProtoMessage() {}
func (x *GetUserSpaceParams) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserSpaceParams.ProtoReflect.Descriptor instead.
func (*GetUserSpaceParams) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{11}
}
type GetUserSpaceResult struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" form:"id" json:"id"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" form:"name" json:"name"`
InviteCode string `protobuf:"bytes,3,opt,name=InviteCode,proto3" form:"invite_code" json:"invite_code"`
}
func (x *GetUserSpaceResult) Reset() {
*x = GetUserSpaceResult{}
if protoimpl.UnsafeEnabled {
mi := &file_space_space_user_types_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetUserSpaceResult) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserSpaceResult) ProtoMessage() {}
func (x *GetUserSpaceResult) ProtoReflect() protoreflect.Message {
mi := &file_space_space_user_types_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetUserSpaceResult.ProtoReflect.Descriptor instead.
func (*GetUserSpaceResult) Descriptor() ([]byte, []int) {
return file_space_space_user_types_proto_rawDescGZIP(), []int{12}
}
func (x *GetUserSpaceResult) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *GetUserSpaceResult) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *GetUserSpaceResult) GetInviteCode() string {
if x != nil {
return x.InviteCode
}
return ""
}
var File_space_space_user_types_proto protoreflect.FileDescriptor
var file_space_space_user_types_proto_rawDesc = []byte{
0x0a, 0x1c, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x75, 0x73,
0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x48, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65,
0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63,
0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73,
0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20,
0x30, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x09, 0x53,
0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73,
0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a,
0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42,
0x0c, 0xca, 0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55,
0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65,
0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a,
0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63,
0x65, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61,
0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a,
0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73,
0x70, 0x61, 0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05,
0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0x42, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61,
0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69,
0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca, 0xbb,
0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49,
0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x6a, 0x0a, 0x0f, 0x4a, 0x6f, 0x69,
0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07,
0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca,
0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61,
0x63, 0x65, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e,
0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74,
0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61,
0x22, 0x16, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65,
0x72, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x09, 0x53, 0x70, 0x61,
0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x08, 0x55,
0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0c, 0xca,
0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x08, 0x55, 0x73, 0x65,
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x6f,
0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x73, 0x70,
0x61, 0x63, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x6f, 0x6c, 0x65, 0x22, 0x3e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x70, 0x61, 0x63, 0x65,
0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x05, 0x75,
0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73,
0x65, 0x72, 0x73, 0x22, 0x4d, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65,
0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xca, 0xbb, 0x18, 0x0b,
0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0xda, 0xbb, 0x18, 0x07, 0x24,
0x20, 0x21, 0x3d, 0x20, 0x27, 0x27, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f,
0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74, 0x53, 0x70, 0x61,
0x63, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x74,
0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x78, 0x0a, 0x15, 0x52,
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61,
@@ -613,10 +681,19 @@ var file_space_space_user_types_proto_rawDesc = []byte{
0x04, 0x72, 0x6f, 0x6c, 0x65, 0xda, 0xbb, 0x18, 0x10, 0x24, 0x20, 0x3d, 0x3d, 0x20, 0x31, 0x20,
0x7c, 0x7c, 0x20, 0x24, 0x20, 0x3d, 0x3d, 0x20, 0x32, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x22,
0x1b, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73,
0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20,
0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f,
0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70, 0x61, 0x63, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x72, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x73, 0x22, 0x7b, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61,
0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64,
0x12, 0x1c, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08,
0xca, 0xbb, 0x18, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2f,
0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x63,
0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x42,
0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65,
0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70,
0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -631,7 +708,7 @@ func file_space_space_user_types_proto_rawDescGZIP() []byte {
return file_space_space_user_types_proto_rawDescData
}
var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_space_space_user_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_space_space_user_types_proto_goTypes = []interface{}{
(*ListSpaceUsersParams)(nil), // 0: space.ListSpaceUsersParams
(*SpaceUser)(nil), // 1: space.SpaceUser
@@ -644,6 +721,8 @@ var file_space_space_user_types_proto_goTypes = []interface{}{
(*RemoveSpaceUserResult)(nil), // 8: space.RemoveSpaceUserResult
(*UpdateSpaceUserRoleParams)(nil), // 9: space.UpdateSpaceUserRoleParams
(*UpdateSpaceUserRoleResult)(nil), // 10: space.UpdateSpaceUserRoleResult
(*GetUserSpaceParams)(nil), // 11: space.GetUserSpaceParams
(*GetUserSpaceResult)(nil), // 12: space.GetUserSpaceResult
}
var file_space_space_user_types_proto_depIdxs = []int32{
1, // 0: space.ListSpaceUsersResult.users:type_name -> space.SpaceUser
@@ -792,6 +871,30 @@ func file_space_space_user_types_proto_init() {
return nil
}
}
file_space_space_user_types_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserSpaceParams); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_space_space_user_types_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetUserSpaceResult); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -799,7 +902,7 @@ func file_space_space_user_types_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_space_space_user_types_proto_rawDesc,
NumEnums: 0,
NumMessages: 11,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},
@@ -55,3 +55,28 @@ func _updatespaceuserroleMw() []app.HandlerFunc {
// your code...
return nil
}
func _joinspaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _createspaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _dissolvespaceMw() []app.HandlerFunc {
// your code...
return nil
}
func _userMw() []app.HandlerFunc {
// your code...
return nil
}
func _getuserspaceMw() []app.HandlerFunc {
// your code...
return nil
}
@@ -19,14 +19,16 @@ func Register(r *server.Hertz) {
root := r.Group("/", rootMw()...)
{
_space := root.Group("/space", _spaceMw()...)
_space.POST("/delete", append(_deletespaceMw(), space.DeleteSpace)...)
_space.POST("/insert", append(_insertspaceMw(), space.InsertSpace)...)
}
{
_space_user := root.Group("/space_user", _space_userMw()...)
_space_user.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...)
_space_user.POST("/list", append(_listspaceusersMw(), space.ListSpaceUsers)...)
_space_user.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...)
_space_user.POST("/updateRole", append(_updatespaceuserroleMw(), space.UpdateSpaceUserRole)...)
_space.POST("/create", append(_createspaceMw(), space.CreateSpace)...)
_space.POST("/dissolve", append(_dissolvespaceMw(), space.DissolveSpace)...)
{
_user := _space.Group("/user", _userMw()...)
_user.POST("/exit", append(_exitspaceMw(), space.ExitSpace)...)
_user.GET("/get", append(_getuserspaceMw(), space.GetUserSpace)...)
_user.POST("/join", append(_joinspaceMw(), space.JoinSpace)...)
_user.POST("/list", append(_listspaceusersMw(), space.ListSpaceUsers)...)
_user.POST("/remove", append(_removespaceuserMw(), space.RemoveSpaceUser)...)
_user.POST("/updateRole", append(_updatespaceuserroleMw(), space.UpdateSpaceUserRole)...)
}
}
}
@@ -33,4 +33,5 @@ ORDER BY su.join_time ASC;
-- name: GetSpaceUserByUserId :one
SELECT * FROM space_user WHERE user_id = $1;
SELECT * FROM space_user WHERE user_id = $1;
@@ -10,28 +10,38 @@ import "space/space_types.proto";
import "space/space_user_types.proto";
service SpaceService {
rpc InsertSpace(InsertSpaceParams) returns (InsertSpaceResult){
option (api.post) = '/space/insert';
rpc CreateSpace(CreateSpaceParams) returns (CreateSpaceParams){
option (api.post) = '/space/create';
};
rpc DeleteSpace(DeleteSpaceParams) returns (DeleteSpaceResult){
option (api.post) = '/space/delete';
rpc DissolveSpace(DissolveSpaceParams) returns (DissolveSpaceResult){
option (api.post) = '/space/dissolve';
};
}
service SpaceUserService{
rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){
option (api.post) = '/space_user/exit';
// 获取用户空间
rpc getUserSpace(GetUserSpaceParams) returns (GetUserSpaceResult){
option (api.get) = '/space/user/get';
};
// 退出空间
rpc ExitSpace(ExitSpaceParams) returns (ExitSpaceResult){
option (api.post) = '/space/user/exit';
};
// 获取空间用户列表
rpc ListSpaceUsers(ListSpaceUsersParams) returns (ListSpaceUsersResult){
option (api.post) = '/space_user/list';
option (api.post) = '/space/user/list';
};
// 踢出某人
rpc RemoveSpaceUser(RemoveSpaceUserParams) returns (RemoveSpaceUserResult){
option (api.post) = '/space_user/remove';
option (api.post) = '/space/user/remove';
};
// 更新用户权限
rpc UpdateSpaceUserRole(UpdateSpaceUserRoleParams) returns (UpdateSpaceUserRoleResult){
option (api.post) = '/space_user/updateRole';
option (api.post) = '/space/user/updateRole';
};
// 加入空间
rpc JoinSpace(JoinSpaceParams) returns (JoinSpaceResult) {
option (api.post) = "/space/user/join";
};
}
@@ -7,20 +7,21 @@ option go_package = "space";
import "api.proto";
// 创建空间
message InsertSpaceParams {
message CreateSpaceParams {
}
message InsertSpaceResult {
message CreateSpaceResult {
int64 Id = 1 [(api.body)="id"];
string InviteCode = 2 [(api.body)="invite_code"];
}
// 解散空间
message DeleteSpaceParams {
message DissolveSpaceParams {
}
message DeleteSpaceResult {
message DissolveSpaceResult {
}
@@ -7,7 +7,6 @@ option go_package = "space";
import "api.proto";
// 获取空间下的成员
message ListSpaceUsersParams {
int64 SpaceId = 1 [(api.body)="space_id",(api.vd)="$ != 0"];
}
message SpaceUser {
@@ -22,12 +21,11 @@ message ListSpaceUsersResult {
// 加入空间
message JoinSpaceParams {
int64 InviteCode = 1 [(api.body)="invite_code"]; // 邀请码
string InviteCode = 1 [(api.body)="invite_code",(api.vd)="$ != ''"]; // 邀请码
}
message JoinSpaceResult {
int64 SpaceId = 1 [(api.body)="space_id"];
string InviteCode = 2 [(api.body)="invite_code"];
}
// 退出空间
@@ -58,4 +56,14 @@ message UpdateSpaceUserRoleParams {
message UpdateSpaceUserRoleResult{
}
}
// 获取当前用户的空间信息
message GetUserSpaceParams{
}
message GetUserSpaceResult{
int64 Id = 1[(api.body)="id"];
string Name = 2[(api.body)="name"];
string InviteCode = 3[(api.body)="invite_code"];
}
@@ -11,7 +11,7 @@ import (
type Result struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
Data interface{} `json:"data"`
TrackId string `json:"trackId,omitempty"`
}
@@ -76,9 +76,9 @@ func (b *Builder) Data(data interface{}) *Builder {
// Send 发送响应
func (b *Builder) Send() {
if b.result.Data == nil {
b.result.Data = ""
}
//if b.result.Data == nil {
// b.result.Data = ""
//}
reqID := requestid.Get(b.c)
b.result.TrackId = reqID