u
This commit is contained in:
1 parent
33ab76f73e
commit
3af982d669
31 files changed
+603
-287
No files matched your search
@@ -12,6 +12,7 @@ import { LucideIcon } from '@/components/common/ao'
|
|||||||
import EmptyState from '@/components/common/EmptyStatus'
|
import EmptyState from '@/components/common/EmptyStatus'
|
||||||
import MoneyCategoryIcon from '@/components/common/MoneyCategoryIcon'
|
import MoneyCategoryIcon from '@/components/common/MoneyCategoryIcon'
|
||||||
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
||||||
|
import { useUserStore } from '@/store/user'
|
||||||
|
|
||||||
interface StaticTransactionsProps {
|
interface StaticTransactionsProps {
|
||||||
records: MoneyRecordGroup[]
|
records: MoneyRecordGroup[]
|
||||||
@@ -30,7 +31,7 @@ export default function StaticTransactions({
|
|||||||
onLoadMore,
|
onLoadMore,
|
||||||
onRefreshData,
|
onRefreshData,
|
||||||
}: StaticTransactionsProps) {
|
}: StaticTransactionsProps) {
|
||||||
const moneyCategoryStore = useMoneyCategoryStore()
|
const userID = useUserStore().userInfo?.id
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
const [loadingMore, setLoadingMore] = useState(false)
|
const [loadingMore, setLoadingMore] = useState(false)
|
||||||
const [selectedId, setSelectedId] = useState<number | null>(null)
|
const [selectedId, setSelectedId] = useState<number | null>(null)
|
||||||
@@ -119,7 +120,6 @@ export default function StaticTransactions({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
renderItem={({ item, index }) => {
|
renderItem={({ item, index }) => {
|
||||||
const category = moneyCategoryStore.getCategoryById(item.category_id)
|
|
||||||
return (
|
return (
|
||||||
<Menu
|
<Menu
|
||||||
renderer={renderers.Popover}
|
renderer={renderers.Popover}
|
||||||
@@ -147,28 +147,27 @@ export default function StaticTransactions({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View className="relative w-10 h-10 rounded-full bg-gray-100 items-center justify-center">
|
<View className="relative w-10 h-10 rounded-full bg-gray-100 items-center justify-center">
|
||||||
<MoneyCategoryIcon name={category?.icon} size={20} color="#000" />
|
<MoneyCategoryIcon name={item.category_icon} size={20} color="#000" />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className="flex-1">
|
<View className="flex-1">
|
||||||
<Text className="text-gray-800 text-base">
|
<Text className="text-gray-800 text-base">
|
||||||
{item.remark ? item.remark : category?.name}
|
{item.remark ? item.remark : item.category_name}
|
||||||
</Text>
|
</Text>
|
||||||
{
|
{
|
||||||
index === 1 && (
|
item.user_id !== userID && (
|
||||||
<Text className="text-gray-500 text-xs italic">
|
<Text className="text-gray-500 text-xs italic">
|
||||||
张三
|
{item.username}
|
||||||
</Text>
|
</Text>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Text
|
<Text
|
||||||
className="text-sm text-gray-600 text-right"
|
className="text-sm text-gray-600 text-right"
|
||||||
>
|
>
|
||||||
{category?.type === 1 ? '+' : '-'}
|
{item.category_type === 1 ? '+' : '-'}
|
||||||
{' '}
|
{' '}
|
||||||
{item.amount}
|
{item.amount}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ export default function Money() {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
moneyRecordStore.setRecords(res.data.records, res.data.total_expense, res.data.total_income, searchParams.record_time)
|
moneyRecordStore.setRecords(res.data.records, res.data.total_expense, res.data.total_income, searchParams.record_time)
|
||||||
|
|
||||||
|
console.log(res.data.records)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toast.show({
|
toast.show({
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
import { Text, TouchableOpacity, View } from 'react-native'
|
import { Text, View } from 'react-native'
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context'
|
import { SafeAreaView } from 'react-native-safe-area-context'
|
||||||
import { LucideIcon } from '@/components/common/ao/index'
|
import { LucideIcon } from '@/components/common/ao/index'
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
AvatarImage,
|
AvatarImage,
|
||||||
} from '@/components/ui/avatar'
|
} from '@/components/ui/avatar'
|
||||||
|
import { useUserStore } from '@/store/user'
|
||||||
import ListItem from './components/ListItem'
|
import ListItem from './components/ListItem'
|
||||||
|
|
||||||
export default function User() {
|
export default function User() {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView className="flex-1 p-4">
|
<SafeAreaView className="flex-1 p-4">
|
||||||
<View className="flex flex-row items-center ">
|
<View className="flex flex-row items-center ">
|
||||||
@@ -17,7 +20,7 @@ export default function User() {
|
|||||||
source={require('@/static/images/logo.png')}
|
source={require('@/static/images/logo.png')}
|
||||||
/>
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Text className="text-xl font-semibold ml-3">张三</Text>
|
<Text className="text-xl font-semibold ml-3">{userStore.userInfo?.username}</Text>
|
||||||
<LucideIcon icon="ChevronRight" size={26} className="ml-auto" color="#aaa" strokeWidth={1.5} />
|
<LucideIcon icon="ChevronRight" size={26} className="ml-auto" color="#aaa" strokeWidth={1.5} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { MenuProvider } from 'react-native-popup-menu'
|
|||||||
import { AButton } from '@/components/common/ao'
|
import { AButton } from '@/components/common/ao'
|
||||||
import EmptyState from '@/components/common/EmptyStatus'
|
import EmptyState from '@/components/common/EmptyStatus'
|
||||||
import { GluestackUIProvider } from '@/components/ui/gluestack-ui-provider'
|
import { GluestackUIProvider } from '@/components/ui/gluestack-ui-provider'
|
||||||
|
import { getUserSpaceApi } from '@/request/api/space/spaceUser'
|
||||||
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
||||||
import { useNavStore } from '@/store/navigation'
|
import { useNavStore } from '@/store/navigation'
|
||||||
import { useSpaceStore } from '@/store/space'
|
import { useSpaceStore } from '@/store/space'
|
||||||
@@ -70,7 +71,12 @@ export default function RootLayout() {
|
|||||||
|
|
||||||
// 如果登录的话,就初始化下
|
// 如果登录的话,就初始化下
|
||||||
moneyCategoryStore.init()
|
moneyCategoryStore.init()
|
||||||
spaceStore.init()
|
|
||||||
|
getUserSpaceApi({}).then((res) => {
|
||||||
|
spaceStore.setUserSpace(res.data)
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
|
||||||
// 隐藏 splash
|
// 隐藏 splash
|
||||||
SplashScreen.hideAsync()
|
SplashScreen.hideAsync()
|
||||||
|
|||||||
@@ -4,18 +4,15 @@ import { Text, View } from 'react-native'
|
|||||||
import { AButton, ACell, ACellGroup, AModal } from '@/components/common/ao'
|
import { AButton, ACell, ACellGroup, AModal } from '@/components/common/ao'
|
||||||
import MoneyCategoryIcon from '@/components/common/MoneyCategoryIcon'
|
import MoneyCategoryIcon from '@/components/common/MoneyCategoryIcon'
|
||||||
import CustomHeader from '@/components/custom/Header'
|
import CustomHeader from '@/components/custom/Header'
|
||||||
import { useMoneyCategoryStore } from '@/store/moneyCategory'
|
|
||||||
import { useMoneyRecordStore } from '@/store/moneyRecord'
|
import { useMoneyRecordStore } from '@/store/moneyRecord'
|
||||||
import { toDateString, toDateTimeString } from '@/utils/time'
|
import { toDateString, toDateTimeString } from '@/utils/time'
|
||||||
|
|
||||||
export default function MoneyRecordDetail() {
|
export default function MoneyRecordDetail() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const moneyRecordStore = useMoneyRecordStore()
|
const moneyRecordStore = useMoneyRecordStore()
|
||||||
const moneyCategoryStore = useMoneyCategoryStore()
|
|
||||||
const { id: detailId } = useLocalSearchParams<{ id: string }>()
|
const { id: detailId } = useLocalSearchParams<{ id: string }>()
|
||||||
|
|
||||||
const moneryRecord = moneyRecordStore.getMoneyRecordById(Number(detailId))
|
const moneryRecord = moneyRecordStore.getMoneyRecordById(Number(detailId))
|
||||||
const moneyCategory = moneyCategoryStore.getCategoryById(moneryRecord?.category_id || 0)
|
|
||||||
|
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
@@ -29,12 +26,12 @@ export default function MoneyRecordDetail() {
|
|||||||
<CustomHeader title="账单详情" />
|
<CustomHeader title="账单详情" />
|
||||||
<View className="flex-1">
|
<View className="flex-1">
|
||||||
<View className="flex flex-col items-center">
|
<View className="flex flex-col items-center">
|
||||||
<MoneyCategoryIcon name={moneyCategory?.icon} size={56} />
|
<MoneyCategoryIcon name={moneryRecord.category_icon} size={56} />
|
||||||
<Text className="mt-1">{moneyCategory?.name}</Text>
|
<Text className="mt-1">{moneryRecord.category_name}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ACellGroup showDivider={false} className="mt-4">
|
<ACellGroup showDivider={false} className="mt-4">
|
||||||
<ACell title="类别" rightText={moneyCategory?.type === 0 ? '支出' : '收入'} />
|
<ACell title="类别" rightText={moneryRecord.category_type === 0 ? '支出' : '收入'} />
|
||||||
<ACell title="金额" rightText={moneryRecord.amount} />
|
<ACell title="金额" rightText={moneryRecord.amount} />
|
||||||
<ACell title="备注" rightText={moneryRecord.remark} />
|
<ACell title="备注" rightText={moneryRecord.remark} />
|
||||||
<ACell title="日期" rightText={toDateString(moneryRecord.record_time)} />
|
<ACell title="日期" rightText={toDateString(moneryRecord.record_time)} />
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ export default function MoenyRecordEditor() {
|
|||||||
const defaultMoneyRecord: MoneyRecordBase = {
|
const defaultMoneyRecord: MoneyRecordBase = {
|
||||||
id: -1,
|
id: -1,
|
||||||
category_id: -1,
|
category_id: -1,
|
||||||
|
username: '',
|
||||||
|
category_icon: '',
|
||||||
|
category_name: '',
|
||||||
|
category_type: 0,
|
||||||
user_id: -1,
|
user_id: -1,
|
||||||
amount: '0.00',
|
amount: '0.00',
|
||||||
remark: '',
|
remark: '',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function Share() {
|
|||||||
style={{
|
style={{
|
||||||
backgroundColor: '#d9d9db',
|
backgroundColor: '#d9d9db',
|
||||||
}}
|
}}
|
||||||
onPress={() => setShowExitModal(true)}
|
onPress={() => exitLogin()}
|
||||||
>
|
>
|
||||||
<Text>退出登录</Text>
|
<Text>退出登录</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { UserSpace } from '@/types/space/spaceUser'
|
|
||||||
import { Text, View } from 'react-native'
|
import { Text, View } from 'react-native'
|
||||||
import { AButton, ADivider, LucideIcon } from '@/components/common/ao'
|
import { AButton, ADivider, LucideIcon } from '@/components/common/ao'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { SpaceUser, UserSpace } from '@/types/space/spaceUser'
|
import type { SpaceUser } from '@/types/space/spaceUser'
|
||||||
import * as Clipboard from 'expo-clipboard'
|
import * as Clipboard from 'expo-clipboard'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { FlatList, TouchableHighlight, TouchableOpacity, View } from 'react-native'
|
import { FlatList, TouchableHighlight, TouchableOpacity, View } from 'react-native'
|
||||||
@@ -32,19 +32,29 @@ import { HStack } from '@/components/ui/hstack'
|
|||||||
import { ChevronDownIcon, ChevronUpIcon } from '@/components/ui/icon'
|
import { ChevronDownIcon, ChevronUpIcon } from '@/components/ui/icon'
|
||||||
import { Text } from '@/components/ui/text'
|
import { Text } from '@/components/ui/text'
|
||||||
import { VStack } from '@/components/ui/vstack'
|
import { VStack } from '@/components/ui/vstack'
|
||||||
import { exitSpaceApi } from '@/request/api/space/spaceUser'
|
import { dissolveSpaceApi } from '@/request/api/space/space'
|
||||||
|
import { exitSpaceApi, removeSpaceUserApi } from '@/request/api/space/spaceUser'
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
import { formatRelativeTime } from '@/utils/time'
|
import { formatRelativeTime } from '@/utils/time'
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
|
|
||||||
|
type ExitAction = 'exit' | 'remove' | 'dissolve'
|
||||||
|
|
||||||
|
interface ExitParams {
|
||||||
|
type: ExitAction
|
||||||
|
userId?: number
|
||||||
|
}
|
||||||
|
|
||||||
interface SpaceInviteProps {
|
interface SpaceInviteProps {
|
||||||
userSpace: UserSpace | null
|
userSpace: UserSpace | null
|
||||||
spaceUsers: SpaceUser[]
|
spaceUsers: SpaceUser[]
|
||||||
|
onExit?: (params: ExitParams) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SpaceInvite({
|
export default function SpaceInvite({
|
||||||
userSpace,
|
userSpace,
|
||||||
spaceUsers,
|
spaceUsers,
|
||||||
|
onExit,
|
||||||
}: SpaceInviteProps) {
|
}: SpaceInviteProps) {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
@@ -52,13 +62,14 @@ export default function SpaceInvite({
|
|||||||
const [modal, setModal] = useState<{
|
const [modal, setModal] = useState<{
|
||||||
open: boolean
|
open: boolean
|
||||||
title: string
|
title: string
|
||||||
type: 'exit' | 'remove' | 'dissolve'
|
type: ExitAction
|
||||||
|
userId?: number
|
||||||
}>({
|
}>({
|
||||||
open: false,
|
open: false,
|
||||||
title: '',
|
title: '',
|
||||||
type: 'dissolve',
|
type: 'dissolve',
|
||||||
})
|
})
|
||||||
,
|
|
||||||
const [accordion, setAccordion] = useState(['a'])
|
const [accordion, setAccordion] = useState(['a'])
|
||||||
|
|
||||||
async function copyInviteCode() {
|
async function copyInviteCode() {
|
||||||
@@ -69,8 +80,43 @@ export default function SpaceInvite({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function exitSpace() {
|
function handleModalConfirm() {
|
||||||
|
if (userSpace === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (modal.type === 'exit') {
|
||||||
|
// 退出
|
||||||
|
exitSpaceApi({}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if (modal.type === 'remove') {
|
||||||
|
if (!modal.userId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 移除
|
||||||
|
removeSpaceUserApi({
|
||||||
|
user_id: modal.userId,
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 解散
|
||||||
|
dissolveSpaceApi({}).catch((err) => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setModal({
|
||||||
|
...modal,
|
||||||
|
open: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
onExit?.({
|
||||||
|
type: modal.type,
|
||||||
|
userId: modal.userId,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -207,6 +253,7 @@ export default function SpaceInvite({
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{userSpace.role === 0 && userStore.userInfo?.id !== item.user_id && (
|
||||||
<MenuOption
|
<MenuOption
|
||||||
customStyles={{
|
customStyles={{
|
||||||
OptionTouchableComponent: TouchableHighlight,
|
OptionTouchableComponent: TouchableHighlight,
|
||||||
@@ -216,27 +263,21 @@ export default function SpaceInvite({
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
}}
|
setModal({
|
||||||
>
|
...modal,
|
||||||
<View className="flex flex-row items-center h-10 px-2">
|
open: true,
|
||||||
<Text className="text-lg">授予管理员</Text>
|
title: `确定将 ${item.username} 提出空间?`,
|
||||||
</View>
|
type: 'remove',
|
||||||
</MenuOption>
|
userId: item.user_id,
|
||||||
<MenuOption
|
})
|
||||||
customStyles={{
|
|
||||||
OptionTouchableComponent: TouchableHighlight,
|
|
||||||
optionTouchable: {
|
|
||||||
underlayColor: '#f0f0f0',
|
|
||||||
activeOpacity: 0.7,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
onSelect={() => {
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View className="flex flex-row items-center h-10 px-2">
|
<View className="flex flex-row items-center h-10 px-2">
|
||||||
<Text className="text-lg">踢出空间</Text>
|
<Text className="text-lg">踢出空间</Text>
|
||||||
</View>
|
</View>
|
||||||
</MenuOption>
|
</MenuOption>
|
||||||
|
)}
|
||||||
|
|
||||||
</MenuOptions>
|
</MenuOptions>
|
||||||
</Menu>
|
</Menu>
|
||||||
</View>
|
</View>
|
||||||
@@ -247,15 +288,50 @@ export default function SpaceInvite({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<AButton size="sm" className="mb-8 mt-4">退出该空间</AButton>
|
<AButton
|
||||||
|
size="sm"
|
||||||
|
className="mb-8 mt-4"
|
||||||
|
onPress={() => {
|
||||||
|
if (userSpace?.role === 0) {
|
||||||
|
setModal({
|
||||||
|
...modal,
|
||||||
|
open: true,
|
||||||
|
title: `确定解散该空间么?不可恢复!`,
|
||||||
|
type: 'dissolve',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setModal({
|
||||||
|
...modal,
|
||||||
|
open: true,
|
||||||
|
title: `确定退出该空间么?`,
|
||||||
|
type: 'exit',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{userSpace?.role === 0 ? '解散空间' : '退出空间'}
|
||||||
|
</AButton>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<AModal
|
<AModal
|
||||||
title="确认退出当前账号?"
|
title={modal.title}
|
||||||
isOpen={showExitModal}
|
isOpen={modal.open}
|
||||||
onCancel={() => setShowExitModal(false)}
|
onCancel={() => {
|
||||||
onClose={() => setShowExitModal(false)}
|
setModal({
|
||||||
onConfirm={exitLogin}
|
...modal,
|
||||||
|
open: false,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
onClose={() => {
|
||||||
|
setModal({
|
||||||
|
...modal,
|
||||||
|
open: false,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
onConfirm={() => {
|
||||||
|
handleModalConfirm()
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
import type { SpaceUser, UserSpace } from '@/types/space/spaceUser'
|
import type { SpaceUser } from '@/types/space/spaceUser'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { View } from 'react-native'
|
import { View } from 'react-native'
|
||||||
import CustomHeader from '@/components/custom/Header'
|
import CustomHeader from '@/components/custom/Header'
|
||||||
import { createSpaceApi } from '@/request/api/space/space'
|
import { createSpaceApi } from '@/request/api/space/space'
|
||||||
import { getUserSpaceApi, joinSpaceApi, listSpaceUsersApi } from '@/request/api/space/spaceUser'
|
import { getUserSpaceApi, joinSpaceApi, listSpaceUsersApi } from '@/request/api/space/spaceUser'
|
||||||
|
import { useSpaceStore } from '@/store/space'
|
||||||
import JoinSpace from './components/JoinSpace'
|
import JoinSpace from './components/JoinSpace'
|
||||||
import SpaceHome from './components/SpaceHome'
|
import SpaceHome from './components/SpaceHome'
|
||||||
import SpaceInviteAndMembers from './components/SpaceInvite'
|
import SpaceInvite from './components/SpaceInvite'
|
||||||
import StepFade from './components/StepFade'
|
import StepFade from './components/StepFade'
|
||||||
|
|
||||||
export default function PagerWithTab() {
|
export default function PagerWithTab() {
|
||||||
|
const spaceStore = useSpaceStore()
|
||||||
|
|
||||||
const [step, setStep] = useState<'join' | 'invite' | 'home'>('home')
|
const [step, setStep] = useState<'join' | 'invite' | 'home'>('home')
|
||||||
const [userSpace, setUserSpace] = useState<UserSpace | null>(null)
|
|
||||||
const [spaceUsers, setSpaceUsers] = useState<SpaceUser[]>([])
|
const [spaceUsers, setSpaceUsers] = useState<SpaceUser[]>([])
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
@@ -20,11 +22,11 @@ export default function PagerWithTab() {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
if (res.data === null) {
|
if (res.data === null) {
|
||||||
setUserSpace(null)
|
spaceStore.setUserSpace(null)
|
||||||
setStep('home')
|
setStep('home')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setUserSpace({
|
spaceStore.setUserSpace({
|
||||||
space_id: res.data.space_id,
|
space_id: res.data.space_id,
|
||||||
space_name: res.data.space_name,
|
space_name: res.data.space_name,
|
||||||
role: res.data.role,
|
role: res.data.role,
|
||||||
@@ -51,6 +53,7 @@ export default function PagerWithTab() {
|
|||||||
.catch(err => console.error('listSpaceUsersApi error:', err)),
|
.catch(err => console.error('listSpaceUsersApi error:', err)),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchData()
|
fetchData()
|
||||||
}, [])
|
}, [])
|
||||||
@@ -58,13 +61,22 @@ export default function PagerWithTab() {
|
|||||||
function createSpace() {
|
function createSpace() {
|
||||||
createSpaceApi({}).then((res) => {
|
createSpaceApi({}).then((res) => {
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
setUserSpace({
|
spaceStore.setUserSpace({
|
||||||
space_id: res.data.id,
|
space_id: res.data.id,
|
||||||
space_name: '',
|
space_name: '',
|
||||||
role: 0,
|
role: 0,
|
||||||
invite_code: res.data.invite_code,
|
invite_code: res.data.invite_code,
|
||||||
})
|
})
|
||||||
|
listSpaceUsersApi({})
|
||||||
|
.then((res) => {
|
||||||
|
if (res.isSuccess) {
|
||||||
|
setSpaceUsers(res.data.users)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 提示
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => console.error('listSpaceUsersApi error:', err))
|
||||||
setStep('invite')
|
setStep('invite')
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -111,7 +123,21 @@ export default function PagerWithTab() {
|
|||||||
</StepFade>
|
</StepFade>
|
||||||
|
|
||||||
<StepFade visible={step === 'invite'}>
|
<StepFade visible={step === 'invite'}>
|
||||||
<SpaceInviteAndMembers userSpace={userSpace} spaceUsers={spaceUsers} />
|
<SpaceInvite
|
||||||
|
userSpace={spaceStore.userSpace}
|
||||||
|
spaceUsers={spaceUsers}
|
||||||
|
onExit={(data) => {
|
||||||
|
if (data.type === 'remove' && data.userId !== undefined) {
|
||||||
|
setSpaceUsers(prevUsers =>
|
||||||
|
prevUsers.filter(user => user.user_id !== data.userId),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setStep('home')
|
||||||
|
spaceStore.setUserSpace(null)
|
||||||
|
setSpaceUsers([])
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</StepFade>
|
</StepFade>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import type {
|
|||||||
ListSpaceUsersResult,
|
ListSpaceUsersResult,
|
||||||
RemoveSpaceUserParams,
|
RemoveSpaceUserParams,
|
||||||
RemoveSpaceUserResult,
|
RemoveSpaceUserResult,
|
||||||
UpdateSpaceUserRoleParams,
|
|
||||||
UpdateSpaceUserRoleResult,
|
|
||||||
} from '@/types/space/spaceUser'
|
} from '@/types/space/spaceUser'
|
||||||
import alovaInstance from '../../index'
|
import alovaInstance from '../../index'
|
||||||
|
|
||||||
@@ -35,7 +33,3 @@ export function listSpaceUsersApi(params: ListSpaceUsersParams) {
|
|||||||
export function removeSpaceUserApi(params: RemoveSpaceUserParams) {
|
export function removeSpaceUserApi(params: RemoveSpaceUserParams) {
|
||||||
return alovaInstance.Post<ResponseData<RemoveSpaceUserResult>>(`${API_PREFIX}/remove`, params)
|
return alovaInstance.Post<ResponseData<RemoveSpaceUserResult>>(`${API_PREFIX}/remove`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateSpaceUserRoleApi(params: UpdateSpaceUserRoleParams) {
|
|
||||||
return alovaInstance.Post<ResponseData<UpdateSpaceUserRoleResult>>(`${API_PREFIX}/updateRole`, params)
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,7 @@ import type { RefreshTokenResult } from '@/types/auth'
|
|||||||
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
||||||
import { createAlova } from 'alova'
|
import { createAlova } from 'alova'
|
||||||
import { useNavStore } from '@/store/navigation'
|
import { useNavStore } from '@/store/navigation'
|
||||||
|
import { useSpaceStore } from '@/store/space'
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
|
|
||||||
@@ -31,8 +32,8 @@ function isWhiteListed(url: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const alovaInstance = createAlova({
|
const alovaInstance = createAlova({
|
||||||
baseURL: 'http://192.168.5.6:8086/app',
|
// baseURL: 'http://192.168.5.6:8086/app',
|
||||||
// baseURL: 'http://192.168.1.136:8086/app',
|
baseURL: 'http://192.168.1.136:8086/app',
|
||||||
requestAdapter: axiosRequestAdapter(),
|
requestAdapter: axiosRequestAdapter(),
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
cacheFor: null,
|
cacheFor: null,
|
||||||
@@ -149,6 +150,12 @@ const alovaInstance = createAlova({
|
|||||||
}
|
}
|
||||||
|
|
||||||
method.config.headers.token = useUserStore.getState().userInfo?.token ?? ''
|
method.config.headers.token = useUserStore.getState().userInfo?.token ?? ''
|
||||||
|
|
||||||
|
const userSpace = useSpaceStore.getState().userSpace
|
||||||
|
if (userSpace !== null) {
|
||||||
|
const spaceID = userSpace.space_id
|
||||||
|
method.config.headers['x-space-id'] = spaceID
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -19,14 +19,19 @@ interface MoneyCategoryStore {
|
|||||||
|
|
||||||
updateCategories: (data: MoneyCategoryItem[], type: number) => void
|
updateCategories: (data: MoneyCategoryItem[], type: number) => void
|
||||||
deleteCategoryById: (id: number, type: number) => void
|
deleteCategoryById: (id: number, type: number) => void
|
||||||
|
|
||||||
|
sysCategories: MoneyCategoryItem[]
|
||||||
|
setSysCategories: (categories: MoneyCategoryItem[]) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useMoneyCategoryStore = create<MoneyCategoryStore>()(
|
export const useMoneyCategoryStore = create<MoneyCategoryStore>()(
|
||||||
persist(
|
persist(
|
||||||
(set, get) => ({
|
(set, get) => ({
|
||||||
categories: [],
|
categories: [],
|
||||||
|
sysCategories:[],
|
||||||
|
|
||||||
setCategories: categories => set({ categories }),
|
setCategories: categories => set({ categories }),
|
||||||
|
setSysCategories: categories => set({ categories }),
|
||||||
|
|
||||||
addCategory: category =>
|
addCategory: category =>
|
||||||
set({ categories: [...get().categories, category] }),
|
set({ categories: [...get().categories, category] }),
|
||||||
@@ -35,7 +40,6 @@ export const useMoneyCategoryStore = create<MoneyCategoryStore>()(
|
|||||||
set({ categories: get().categories.filter(c => c.id !== id) }),
|
set({ categories: get().categories.filter(c => c.id !== id) }),
|
||||||
|
|
||||||
init: async () => {
|
init: async () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await queryMoneyCategoryApi().then((res) => {
|
await queryMoneyCategoryApi().then((res) => {
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
@@ -58,6 +62,11 @@ export const useMoneyCategoryStore = create<MoneyCategoryStore>()(
|
|||||||
getCategoryById: (id: number) => {
|
getCategoryById: (id: number) => {
|
||||||
return get().categories.find(c => c.id === id) || null
|
return get().categories.find(c => c.id === id) || null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSysCategoryById: (id: number) => {
|
||||||
|
return get().sysCategories.find(c => c.id === id) || null
|
||||||
|
},
|
||||||
|
|
||||||
updateCategories: (data, type) => {
|
updateCategories: (data, type) => {
|
||||||
// 获取当前所有分类
|
// 获取当前所有分类
|
||||||
const allCategories = get().categories
|
const allCategories = get().categories
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
import { getUserSpaceApi } from '@/request/api/space/spaceUser'
|
|
||||||
|
|
||||||
interface SpaceState {
|
interface SpaceState {
|
||||||
userSpace: UserSpace | null
|
userSpace: UserSpace | null
|
||||||
setUserSpace: (space: UserSpace | null) => void
|
setUserSpace: (space: UserSpace | null) => void
|
||||||
init: () => Promise<void>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSpaceStore = create<SpaceState>(set => ({
|
export const useSpaceStore = create<SpaceState>(set => ({
|
||||||
userSpace: null,
|
userSpace: null,
|
||||||
setUserSpace: space => set({ userSpace: space }),
|
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)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}))
|
}))
|
||||||
@@ -4,7 +4,11 @@
|
|||||||
export interface MoneyRecordBase {
|
export interface MoneyRecordBase {
|
||||||
id: number
|
id: number
|
||||||
category_id: number
|
category_id: number
|
||||||
|
category_type: number
|
||||||
|
category_name: string
|
||||||
|
category_icon: string
|
||||||
user_id: number
|
user_id: number
|
||||||
|
username: string
|
||||||
amount: string
|
amount: string
|
||||||
remark: string
|
remark: string
|
||||||
record_time: string
|
record_time: string
|
||||||
@@ -47,7 +51,13 @@ export interface InsertMoneyRecordParams {
|
|||||||
export interface InsertMoneyRecordResult extends MoneyRecordBase {}
|
export interface InsertMoneyRecordResult extends MoneyRecordBase {}
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
export interface UpdateMoneyRecordParams extends Omit<MoneyRecordBase, 'create_time' | 'user_id'> {}
|
export interface UpdateMoneyRecordParams {
|
||||||
|
id: number
|
||||||
|
category_id: number
|
||||||
|
amount: string
|
||||||
|
remark: string
|
||||||
|
record_time: string
|
||||||
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
export interface DeleteMoneyRecordParams {
|
export interface DeleteMoneyRecordParams {
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
export interface UserSpace {
|
|
||||||
space_id: number
|
|
||||||
space_name: string
|
|
||||||
role: number
|
|
||||||
invite_code: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户的空间
|
// 获取用户的空间
|
||||||
export interface GetUserSpaceParams {
|
export interface GetUserSpaceParams {
|
||||||
|
|
||||||
@@ -41,7 +34,6 @@ export interface ListSpaceUsersResult {
|
|||||||
|
|
||||||
// 踢出空间
|
// 踢出空间
|
||||||
export interface RemoveSpaceUserParams {
|
export interface RemoveSpaceUserParams {
|
||||||
space_id: number
|
|
||||||
user_id: number
|
user_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,29 +39,84 @@ func QueryMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
|||||||
}
|
}
|
||||||
endTime := startTime.AddDate(0, 1, 0).Add(-time.Nanosecond)
|
endTime := startTime.AddDate(0, 1, 0).Add(-time.Nanosecond)
|
||||||
|
|
||||||
// 获取 userID
|
// 获取 userID 和 spaceID
|
||||||
userID := middleware.GetUserID(ctx)
|
userID := middleware.GetUserID(ctx)
|
||||||
|
spaceID, ok := middleware.GetSpaceID(ctx)
|
||||||
|
|
||||||
// 查询记录
|
// 定义统一的 records 切片
|
||||||
|
var dbRecordsUser []repo.FindUserMoneyRecordsRow
|
||||||
|
var dbRecordsSpace []repo.FindMoneyRecordsBySpaceRow
|
||||||
|
var errQuery error
|
||||||
|
|
||||||
|
// 最终返回统一类型
|
||||||
|
var records []*money.MoneyRecordItem
|
||||||
|
|
||||||
|
if ok { // 有空间ID,查询空间内所有用户
|
||||||
|
params := repo.FindMoneyRecordsBySpaceParams{
|
||||||
|
SpaceID: spaceID,
|
||||||
|
RecordTime: pgtype.Timestamp{Time: startTime, Valid: true},
|
||||||
|
RecordTime_2: pgtype.Timestamp{Time: endTime, Valid: true},
|
||||||
|
}
|
||||||
|
dbRecordsSpace, errQuery = db.Queries.FindMoneyRecordsBySpace(ctx, params)
|
||||||
|
if errQuery != nil {
|
||||||
|
errorx.AddError(c, errQuery)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range dbRecordsSpace {
|
||||||
|
records = append(records, &money.MoneyRecordItem{
|
||||||
|
Id: r.ID,
|
||||||
|
CategoryId: r.CategoryID,
|
||||||
|
CategoryType: r.CategoryType.Int32,
|
||||||
|
CategoryIcon: r.CategoryIcon.String,
|
||||||
|
CategoryName: r.CategoryName.String,
|
||||||
|
UserId: r.UserID,
|
||||||
|
Username: r.Username.String,
|
||||||
|
Amount: pgtypex.NumericToString(r.Amount),
|
||||||
|
Remark: r.Remark.String,
|
||||||
|
RecordTime: pgtypex.TimestampToDateString(r.RecordTime),
|
||||||
|
CreateTime: pgtypex.TimestampToDateTimeString(r.CreateTime),
|
||||||
|
UpdateTime: pgtypex.TimestampToDateTimeString(r.UpdateTime),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // 没有空间ID,只查询单用户
|
||||||
params := repo.FindUserMoneyRecordsParams{
|
params := repo.FindUserMoneyRecordsParams{
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
RecordTime: pgtype.Timestamp{Time: startTime, Valid: true},
|
RecordTime: pgtype.Timestamp{Time: startTime, Valid: true},
|
||||||
RecordTime_2: pgtype.Timestamp{Time: endTime, Valid: true},
|
RecordTime_2: pgtype.Timestamp{Time: endTime, Valid: true},
|
||||||
}
|
}
|
||||||
|
dbRecordsUser, errQuery = db.Queries.FindUserMoneyRecords(ctx, params)
|
||||||
records, err := db.Queries.FindUserMoneyRecords(ctx, params)
|
if errQuery != nil {
|
||||||
if err != nil {
|
errorx.AddError(c, errQuery)
|
||||||
errorx.AddError(c, err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, r := range dbRecordsUser {
|
||||||
|
records = append(records, &money.MoneyRecordItem{
|
||||||
|
Id: r.ID,
|
||||||
|
CategoryId: r.CategoryID,
|
||||||
|
CategoryType: r.CategoryType.Int32,
|
||||||
|
CategoryIcon: r.CategoryIcon.String,
|
||||||
|
CategoryName: r.CategoryName.String,
|
||||||
|
UserId: r.UserID,
|
||||||
|
Username: "", // 单用户查询没有 username
|
||||||
|
Amount: pgtypex.NumericToString(r.Amount),
|
||||||
|
Remark: r.Remark.String,
|
||||||
|
RecordTime: pgtypex.TimestampToDateString(r.RecordTime),
|
||||||
|
CreateTime: pgtypex.TimestampToDateTimeString(r.CreateTime),
|
||||||
|
UpdateTime: pgtypex.TimestampToDateTimeString(r.UpdateTime),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 分组统计
|
// 分组统计
|
||||||
groupMap := make(map[string]*money.MoneyRecordGroup)
|
groupMap := make(map[string]*money.MoneyRecordGroup)
|
||||||
totalIncome := decimal.NewFromInt(0)
|
totalIncome := decimal.NewFromInt(0)
|
||||||
totalExpense := decimal.NewFromInt(0)
|
totalExpense := decimal.NewFromInt(0)
|
||||||
|
|
||||||
for _, r := range records {
|
for _, r := range records {
|
||||||
day := r.RecordTime.Time.Format("2006-01-02")
|
day := r.RecordTime[:10] // "YYYY-MM-DD"
|
||||||
|
|
||||||
group, ok := groupMap[day]
|
group, ok := groupMap[day]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -74,28 +129,16 @@ func QueryMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
|||||||
groupMap[day] = group
|
groupMap[day] = group
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构造单条记录
|
group.Records = append(group.Records, r)
|
||||||
item := &money.MoneyRecordItem{
|
|
||||||
Id: r.ID,
|
|
||||||
CategoryId: r.CategoryID,
|
|
||||||
UserId: r.UserID,
|
|
||||||
Amount: pgtypex.NumericToString(r.Amount),
|
|
||||||
Remark: r.Remark.String,
|
|
||||||
RecordTime: pgtypex.TimestampToDateString(r.RecordTime),
|
|
||||||
CreateTime: pgtypex.TimestampToDateTimeString(r.CreateTime),
|
|
||||||
UpdateTime: pgtypex.TimestampToDateTimeString(r.UpdateTime),
|
|
||||||
}
|
|
||||||
|
|
||||||
group.Records = append(group.Records, item)
|
|
||||||
|
|
||||||
// 收支累加
|
// 收支累加
|
||||||
amount := pgtypex.NumericToDecimal(r.Amount)
|
amount := decimal.RequireFromString(r.Amount)
|
||||||
if r.CategoryType.Int32 == 1 {
|
if r.CategoryType == 1 {
|
||||||
incomeDec, _ := decimal.NewFromString(group.Income)
|
incomeDec, _ := decimal.NewFromString(group.Income)
|
||||||
incomeDec = incomeDec.Add(amount)
|
incomeDec = incomeDec.Add(amount)
|
||||||
group.Income = incomeDec.Round(2).StringFixed(2)
|
group.Income = incomeDec.Round(2).StringFixed(2)
|
||||||
totalIncome = totalIncome.Add(amount)
|
totalIncome = totalIncome.Add(amount)
|
||||||
} else if r.CategoryType.Int32 == 0 {
|
} else if r.CategoryType == 0 {
|
||||||
expenseDec, _ := decimal.NewFromString(group.Expense)
|
expenseDec, _ := decimal.NewFromString(group.Expense)
|
||||||
expenseDec = expenseDec.Add(amount)
|
expenseDec = expenseDec.Add(amount)
|
||||||
group.Expense = expenseDec.Round(2).StringFixed(2)
|
group.Expense = expenseDec.Round(2).StringFixed(2)
|
||||||
@@ -103,14 +146,13 @@ func QueryMoneyRecord(ctx context.Context, c *app.RequestContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对日期排序,最新在前
|
// 对日期排序
|
||||||
dates := make([]string, 0, len(groupMap))
|
dates := make([]string, 0, len(groupMap))
|
||||||
for k := range groupMap {
|
for k := range groupMap {
|
||||||
dates = append(dates, k)
|
dates = append(dates, k)
|
||||||
}
|
}
|
||||||
sort.Slice(dates, func(i, j int) bool { return dates[i] > dates[j] })
|
sort.Slice(dates, func(i, j int) bool { return dates[i] > dates[j] })
|
||||||
|
|
||||||
// 构建最终返回数组
|
|
||||||
resultGroups := make([]*money.MoneyRecordGroup, 0, len(dates))
|
resultGroups := make([]*money.MoneyRecordGroup, 0, len(dates))
|
||||||
for _, day := range dates {
|
for _, day := range dates {
|
||||||
resultGroups = append(resultGroups, groupMap[day])
|
resultGroups = append(resultGroups, groupMap[day])
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ func ListSpaceUsers(ctx context.Context, c *app.RequestContext) {
|
|||||||
response.Success(c).Data(resp).Send()
|
response.Success(c).Data(resp).Send()
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveSpaceUser .
|
// RemoveSpaceUser 移除空间用户
|
||||||
// @router /space/user/remove [POST]
|
// @router /space/user/remove [POST]
|
||||||
func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
|
func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
|
||||||
var req space.RemoveSpaceUserParams
|
var req space.RemoveSpaceUserParams
|
||||||
@@ -98,17 +98,17 @@ func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
spaceId := req.SpaceId
|
delUserID := req.UserId
|
||||||
delUserId := req.UserId
|
currentUserID := middleware.GetUserID(ctx)
|
||||||
userID := middleware.GetUserID(ctx)
|
|
||||||
|
|
||||||
if userID == delUserId {
|
// 不能删除自己
|
||||||
|
if currentUserID == delUserID {
|
||||||
response.Fail(c).Message("请退出空间或解散空间").Send()
|
response.Fail(c).Message("请退出空间或解散空间").Send()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前操作者信息
|
// 获取当前操作者所在空间及角色
|
||||||
spaceUser, err := db.Queries.GetSpaceUserByUserId(ctx, userID)
|
spaceUser, err := db.Queries.GetSpaceUserByUserId(ctx, currentUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errorx.IsNotFound(err) {
|
if errorx.IsNotFound(err) {
|
||||||
response.Fail(c).Message("权限不足").Send()
|
response.Fail(c).Message("权限不足").Send()
|
||||||
@@ -118,36 +118,31 @@ func RemoveSpaceUser(ctx context.Context, c *app.RequestContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if spaceUser.SpaceID != spaceId {
|
// 检查权限
|
||||||
response.Fail(c).Message("权限不足").Send()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if spaceUser.Role != 0 && spaceUser.Role != 1 {
|
if spaceUser.Role != 0 && spaceUser.Role != 1 {
|
||||||
response.Fail(c).Message("权限不足").Send()
|
response.Fail(c).Message("权限不足").Send()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 被踢用户是否在该空间
|
// 获取待删除用户的空间信息
|
||||||
targetUser, err := db.Queries.GetSpaceUserByUserId(ctx, delUserId)
|
delUserSpace, err := db.Queries.GetSpaceByUserId(ctx, delUserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errorx.IsNotFound(err) {
|
if errorx.IsNotFound(err) {
|
||||||
response.Success(c).Message("用户不在空间").Send()
|
response.Fail(c).Message("待删除用户不存在或权限不足").Send()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
errorx.AddError(c, err)
|
errorx.AddError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if targetUser.SpaceID != spaceId {
|
// 校验是否在同一个空间
|
||||||
response.Fail(c).Message("用户不在该空间").Send()
|
if spaceUser.SpaceID != delUserSpace.ID {
|
||||||
|
response.Fail(c).Message("权限不足").Send()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除用户
|
||||||
err = db.Queries.DeleteSpaceUser(ctx, delUserId)
|
if err := db.Queries.DeleteSpaceUser(ctx, delUserID); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
errorx.AddError(c, err)
|
errorx.AddError(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: api.proto
|
// source: api.proto
|
||||||
|
|
||||||
package api
|
package api
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: money.proto
|
// source: money.proto
|
||||||
|
|
||||||
package money
|
package money
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: money/money_category_types.proto
|
// source: money/money_category_types.proto
|
||||||
|
|
||||||
package money
|
package money
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: money/money_record_types.proto
|
// source: money/money_record_types.proto
|
||||||
|
|
||||||
package money
|
package money
|
||||||
@@ -35,6 +35,10 @@ type MoneyRecordItem struct {
|
|||||||
RecordTime string `protobuf:"bytes,6,opt,name=RecordTime,proto3" form:"record_time" json:"record_time"`
|
RecordTime string `protobuf:"bytes,6,opt,name=RecordTime,proto3" form:"record_time" json:"record_time"`
|
||||||
CreateTime string `protobuf:"bytes,7,opt,name=CreateTime,proto3" form:"create_time" json:"create_time"`
|
CreateTime string `protobuf:"bytes,7,opt,name=CreateTime,proto3" form:"create_time" json:"create_time"`
|
||||||
UpdateTime string `protobuf:"bytes,8,opt,name=UpdateTime,proto3" form:"update_time" json:"update_time"`
|
UpdateTime string `protobuf:"bytes,8,opt,name=UpdateTime,proto3" form:"update_time" json:"update_time"`
|
||||||
|
Username string `protobuf:"bytes,9,opt,name=Username,proto3" form:"username" json:"username"`
|
||||||
|
CategoryType int32 `protobuf:"varint,10,opt,name=CategoryType,proto3" form:"category_type" json:"category_type"`
|
||||||
|
CategoryIcon string `protobuf:"bytes,11,opt,name=CategoryIcon,proto3" form:"category_icon" json:"category_icon"`
|
||||||
|
CategoryName string `protobuf:"bytes,12,opt,name=CategoryName,proto3" form:"category_name" json:"category_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MoneyRecordItem) Reset() {
|
func (x *MoneyRecordItem) Reset() {
|
||||||
@@ -125,6 +129,34 @@ func (x *MoneyRecordItem) GetUpdateTime() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *MoneyRecordItem) GetUsername() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Username
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MoneyRecordItem) GetCategoryType() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CategoryType
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MoneyRecordItem) GetCategoryIcon() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CategoryIcon
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *MoneyRecordItem) GetCategoryName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CategoryName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// 同一天的记账记录分组
|
// 同一天的记账记录分组
|
||||||
type MoneyRecordGroup struct {
|
type MoneyRecordGroup struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@@ -695,7 +727,7 @@ var file_money_money_record_types_proto_rawDesc = []byte{
|
|||||||
0x0a, 0x1e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x72, 0x65,
|
0x0a, 0x1e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x5f, 0x72, 0x65,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x12, 0x05, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f,
|
0x12, 0x05, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x1a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x22, 0xda, 0x02, 0x0a, 0x0f, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
|
0x74, 0x6f, 0x22, 0xa9, 0x04, 0x0a, 0x0f, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
|
||||||
0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 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,
|
0x28, 0x03, 0x42, 0x06, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f,
|
||||||
0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||||
@@ -716,103 +748,115 @@ var file_money_money_record_types_proto_rawDesc = []byte{
|
|||||||
0x6d, 0x65, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f,
|
0x6d, 0x65, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f,
|
||||||
0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01,
|
0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01,
|
||||||
0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74,
|
0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74,
|
||||||
0x69, 0x6d, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22,
|
0x69, 0x6d, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
|
||||||
0xcd, 0x01, 0x0a, 0x10, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x47,
|
0x28, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
|
||||||
0x72, 0x6f, 0x75, 0x70, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69,
|
0x09, 0x42, 0x0c, 0xca, 0xbb, 0x18, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x52,
|
||||||
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65,
|
0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x0c, 0x43, 0x61, 0x74,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
0x65, 0x67, 0x6f, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x42,
|
||||||
0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65,
|
0x11, 0xca, 0xbb, 0x18, 0x0d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x74, 0x79,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x65, 0x78, 0x70, 0x65,
|
0x70, 0x65, 0x52, 0x0c, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65,
|
||||||
0x6e, 0x73, 0x65, 0x52, 0x07, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x06,
|
0x12, 0x35, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e,
|
||||||
0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb,
|
0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0xca, 0xbb, 0x18, 0x0d, 0x63, 0x61, 0x74, 0x65,
|
||||||
0x18, 0x06, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x06, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65,
|
0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x63, 0x6f, 0x6e, 0x52, 0x0c, 0x43, 0x61, 0x74, 0x65, 0x67,
|
||||||
0x12, 0x3d, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
0x6f, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x43, 0x61, 0x74, 0x65, 0x67,
|
||||||
0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52,
|
0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x42, 0x11, 0xca,
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72,
|
0xbb, 0x18, 0x0d, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22,
|
0x52, 0x0c, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xcd,
|
||||||
0x4a, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63,
|
0x01, 0x0a, 0x10, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x47, 0x72,
|
||||||
0x6f, 0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65,
|
0x6f, 0x75, 0x70, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f,
|
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63,
|
||||||
0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52,
|
|
||||||
0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17,
|
|
||||||
0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
|
||||||
0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x3e, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
|
||||||
0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79,
|
|
||||||
0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x47, 0x72, 0x6f, 0x75,
|
|
||||||
0x70, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07,
|
|
||||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c,
|
|
||||||
0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, 0xca, 0xbb,
|
|
||||||
0x18, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x0b,
|
|
||||||
0x54, 0x6f, 0x74, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x0c, 0x54,
|
|
||||||
0x6f, 0x74, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x42, 0x11, 0xca, 0xbb, 0x18, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70,
|
|
||||||
0x65, 0x6e, 0x73, 0x65, 0x52, 0x0c, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x65, 0x6e,
|
|
||||||
0x73, 0x65, 0x22, 0xa4, 0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e,
|
|
||||||
0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x38,
|
|
||||||
0x0a, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
|
||||||
0x28, 0x03, 0x42, 0x18, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79,
|
|
||||||
0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x05, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x52, 0x0a, 0x43, 0x61,
|
|
||||||
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x4d, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75,
|
|
||||||
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d,
|
|
||||||
0x6f, 0x75, 0x6e, 0x74, 0xda, 0xbb, 0x18, 0x27, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26, 0x26,
|
|
||||||
0x20, 0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x2b, 0x28, 0x5c, 0x2e,
|
|
||||||
0x5c, 0x64, 0x7b, 0x31, 0x2c, 0x32, 0x7d, 0x29, 0x3f, 0x24, 0x27, 0x2c, 0x20, 0x24, 0x29, 0x52,
|
|
||||||
0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72,
|
|
||||||
0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d,
|
|
||||||
0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x5c, 0x0a, 0x0a, 0x52,
|
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42,
|
|
||||||
0x3c, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
|
||||||
0xda, 0xbb, 0x18, 0x29, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26, 0x26, 0x20, 0x72, 0x65, 0x67,
|
|
||||||
0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x7b, 0x34, 0x7d, 0x2d, 0x5c, 0x64, 0x7b, 0x32,
|
|
||||||
0x7d, 0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d, 0x24, 0x27, 0x2c, 0x20, 0x24, 0x29, 0x52, 0x0a, 0x52,
|
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe2, 0x02, 0x0a, 0x17, 0x49, 0x6e,
|
|
||||||
0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 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, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
|
||||||
0x03, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f,
|
|
||||||
0x69, 0x64, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x23,
|
|
||||||
0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 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, 0x22, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20,
|
|
||||||
0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52,
|
|
||||||
0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72,
|
|
||||||
0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d,
|
|
||||||
0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a, 0x52,
|
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42,
|
|
||||||
0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
|
||||||
0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a,
|
|
||||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
|
|
||||||
0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
|
||||||
0x65, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a,
|
|
||||||
0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28,
|
|
||||||
0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69,
|
|
||||||
0x6d, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe3,
|
|
||||||
0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65,
|
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x02, 0x49, 0x64,
|
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb,
|
|
||||||
0x18, 0x04, 0x24, 0x21, 0x3d, 0x30, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x43, 0x61,
|
|
||||||
0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f,
|
|
||||||
0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x52,
|
|
||||||
0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x41,
|
|
||||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18,
|
|
||||||
0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12,
|
|
||||||
0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42,
|
|
||||||
0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d,
|
|
||||||
0x61, 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d,
|
|
||||||
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63,
|
|
||||||
0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||||
0x54, 0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f,
|
0x54, 0x69, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x18,
|
||||||
0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x65, 0x78, 0x70, 0x65, 0x6e,
|
||||||
0x39, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65,
|
0x73, 0x65, 0x52, 0x07, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x06, 0x49,
|
||||||
0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x02, 0x49, 0x64,
|
0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb,
|
0x06, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x06, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x12,
|
||||||
0x18, 0x04, 0x24, 0x21, 0x3d, 0x30, 0x52, 0x02, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x44, 0x65,
|
0x3d, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
|
||||||
0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52,
|
0x32, 0x16, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65,
|
||||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61,
|
0x63, 0x6f, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72, 0x65,
|
||||||
0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f,
|
0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x22, 0x4a,
|
||||||
0x64, 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f,
|
||||||
0x33,
|
0x72, 0x64, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63,
|
||||||
|
0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca,
|
||||||
|
0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a,
|
||||||
|
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x51,
|
||||||
|
0x75, 0x65, 0x72, 0x79, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73,
|
||||||
|
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x3e, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||||
|
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x2e,
|
||||||
|
0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70,
|
||||||
|
0x42, 0x0b, 0xca, 0xbb, 0x18, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x07, 0x52,
|
||||||
|
0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x49,
|
||||||
|
0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x10, 0xca, 0xbb, 0x18,
|
||||||
|
0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x52, 0x0b, 0x54,
|
||||||
|
0x6f, 0x74, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x0c, 0x54, 0x6f,
|
||||||
|
0x74, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||||
|
0x42, 0x11, 0xca, 0xbb, 0x18, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65,
|
||||||
|
0x6e, 0x73, 0x65, 0x52, 0x0c, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x45, 0x78, 0x70, 0x65, 0x6e, 0x73,
|
||||||
|
0x65, 0x22, 0xa4, 0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65,
|
||||||
|
0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x38, 0x0a,
|
||||||
|
0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x42, 0x18, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f,
|
||||||
|
0x69, 0x64, 0xda, 0xbb, 0x18, 0x05, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x52, 0x0a, 0x43, 0x61, 0x74,
|
||||||
|
0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x4d, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e,
|
||||||
|
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x35, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f,
|
||||||
|
0x75, 0x6e, 0x74, 0xda, 0xbb, 0x18, 0x27, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26, 0x26, 0x20,
|
||||||
|
0x72, 0x65, 0x67, 0x65, 0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x2b, 0x28, 0x5c, 0x2e, 0x5c,
|
||||||
|
0x64, 0x7b, 0x31, 0x2c, 0x32, 0x7d, 0x29, 0x3f, 0x24, 0x27, 0x2c, 0x20, 0x24, 0x29, 0x52, 0x06,
|
||||||
|
0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b,
|
||||||
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d, 0x61,
|
||||||
|
0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x5c, 0x0a, 0x0a, 0x52, 0x65,
|
||||||
|
0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x3c,
|
||||||
|
0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xda,
|
||||||
|
0xbb, 0x18, 0x29, 0x24, 0x21, 0x3d, 0x27, 0x27, 0x20, 0x26, 0x26, 0x20, 0x72, 0x65, 0x67, 0x65,
|
||||||
|
0x78, 0x70, 0x28, 0x27, 0x5e, 0x5c, 0x64, 0x7b, 0x34, 0x7d, 0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d,
|
||||||
|
0x2d, 0x5c, 0x64, 0x7b, 0x32, 0x7d, 0x24, 0x27, 0x2c, 0x20, 0x24, 0x29, 0x52, 0x0a, 0x52, 0x65,
|
||||||
|
0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe2, 0x02, 0x0a, 0x17, 0x49, 0x6e, 0x73,
|
||||||
|
0x65, 0x72, 0x74, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 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,
|
||||||
|
0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
|
||||||
|
0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69,
|
||||||
|
0x64, 0x52, 0x0a, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x23, 0x0a,
|
||||||
|
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 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, 0x22, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x06,
|
||||||
|
0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b,
|
||||||
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d, 0x61,
|
||||||
|
0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65,
|
||||||
|
0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f,
|
||||||
|
0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52,
|
||||||
|
0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x43,
|
||||||
|
0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42,
|
||||||
|
0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65,
|
||||||
|
0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a,
|
||||||
|
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
|
||||||
|
0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
|
||||||
|
0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe3, 0x01,
|
||||||
|
0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63,
|
||||||
|
0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x02, 0x49, 0x64, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb, 0x18,
|
||||||
|
0x04, 0x24, 0x21, 0x3d, 0x30, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x0a, 0x43, 0x61, 0x74,
|
||||||
|
0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0f, 0xca,
|
||||||
|
0xbb, 0x18, 0x0b, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x52, 0x0a,
|
||||||
|
0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x41, 0x6d,
|
||||||
|
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xca, 0xbb, 0x18, 0x06,
|
||||||
|
0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22,
|
||||||
|
0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a,
|
||||||
|
0xca, 0xbb, 0x18, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61,
|
||||||
|
0x72, 0x6b, 0x12, 0x2f, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65,
|
||||||
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x72, 0x65, 0x63, 0x6f,
|
||||||
|
0x72, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x54,
|
||||||
|
0x69, 0x6d, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x6f, 0x6e,
|
||||||
|
0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x39,
|
||||||
|
0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63,
|
||||||
|
0x6f, 0x72, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x0a, 0x02, 0x49, 0x64, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x02, 0x69, 0x64, 0xda, 0xbb, 0x18,
|
||||||
|
0x04, 0x24, 0x21, 0x3d, 0x30, 0x52, 0x02, 0x49, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x44, 0x65, 0x6c,
|
||||||
|
0x65, 0x74, 0x65, 0x4d, 0x6f, 0x6e, 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 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, 0x6d, 0x6f, 0x6e, 0x65, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: space.proto
|
// source: space.proto
|
||||||
|
|
||||||
package space
|
package space
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: space/space_types.proto
|
// source: space/space_types.proto
|
||||||
|
|
||||||
package space
|
package space
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.28.0
|
// protoc-gen-go v1.28.0
|
||||||
// protoc v6.33.1
|
// protoc v4.25.3
|
||||||
// source: space/space_user_types.proto
|
// source: space/space_user_types.proto
|
||||||
|
|
||||||
package space
|
package space
|
||||||
@@ -347,8 +347,7 @@ type RemoveSpaceUserParams struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
SpaceId int64 `protobuf:"varint,1,opt,name=SpaceId,proto3" form:"space_id" json:"space_id" vd:"$ != 0"`
|
UserId int64 `protobuf:"varint,1,opt,name=UserId,proto3" form:"user_id" json:"user_id" vd:"$ != 0"`
|
||||||
UserId int64 `protobuf:"varint,2,opt,name=UserId,proto3" form:"user_id" json:"user_id" vd:"$ != 0"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveSpaceUserParams) Reset() {
|
func (x *RemoveSpaceUserParams) Reset() {
|
||||||
@@ -383,13 +382,6 @@ func (*RemoveSpaceUserParams) Descriptor() ([]byte, []int) {
|
|||||||
return file_space_space_user_types_proto_rawDescGZIP(), []int{7}
|
return file_space_space_user_types_proto_rawDescGZIP(), []int{7}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RemoveSpaceUserParams) GetSpaceId() int64 {
|
|
||||||
if x != nil {
|
|
||||||
return x.SpaceId
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *RemoveSpaceUserParams) GetUserId() int64 {
|
func (x *RemoveSpaceUserParams) GetUserId() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UserId
|
return x.UserId
|
||||||
@@ -576,32 +568,29 @@ var file_space_space_user_types_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x64, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x4a, 0x6f, 0x69, 0x6e, 0x53, 0x70, 0x61, 0x63, 0x65,
|
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,
|
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,
|
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,
|
0x74, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x46, 0x0a, 0x15,
|
||||||
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50,
|
0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50,
|
||||||
0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x30, 0x0a, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64,
|
0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x16, 0xca, 0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63,
|
0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||||
0x65, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x07,
|
0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x06, 0x55, 0x73,
|
||||||
0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49,
|
0x65, 0x72, 0x49, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x70,
|
||||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x15, 0xca, 0xbb, 0x18, 0x07, 0x75, 0x73, 0x65,
|
0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x14, 0x0a,
|
||||||
0x72, 0x5f, 0x69, 0x64, 0xda, 0xbb, 0x18, 0x06, 0x24, 0x20, 0x21, 0x3d, 0x20, 0x30, 0x52, 0x06,
|
0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x72,
|
||||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65,
|
0x61, 0x6d, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53,
|
||||||
0x53, 0x70, 0x61, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22,
|
0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07, 0x53, 0x70,
|
||||||
0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x50,
|
0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca, 0xbb, 0x18,
|
||||||
0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65,
|
0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61, 0x63, 0x65,
|
||||||
0x72, 0x53, 0x70, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x26, 0x0a, 0x07,
|
0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18,
|
||||||
0x53, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, 0xca,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||||
0xbb, 0x18, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x52, 0x07, 0x53, 0x70, 0x61,
|
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||||
0x63, 0x65, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61, 0x6d,
|
0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03,
|
||||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xca, 0xbb, 0x18, 0x0a, 0x73, 0x70, 0x61,
|
0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65,
|
||||||
0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x09, 0x53, 0x70, 0x61, 0x63, 0x65, 0x4e, 0x61,
|
0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64,
|
||||||
0x6d, 0x65, 0x12, 0x2f, 0x0a, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x64, 0x65,
|
0x65, 0x12, 0x1c, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x42,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0f, 0xca, 0xbb, 0x18, 0x0b, 0x69, 0x6e, 0x76, 0x69,
|
0x08, 0xca, 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x42,
|
||||||
0x74, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x43,
|
0x22, 0x5a, 0x20, 0x63, 0x6e, 0x2f, 0x6f, 0x6e, 0x65, 0x61, 0x6f, 0x2f, 0x62, 0x61, 0x73, 0x65,
|
||||||
0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
0x2d, 0x67, 0x6f, 0x2f, 0x62, 0x69, 0x7a, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x73, 0x70,
|
||||||
0x05, 0x42, 0x08, 0xca, 0xbb, 0x18, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x52, 0x6f, 0x6c,
|
0x61, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
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 (
|
var (
|
||||||
|
|||||||
@@ -6,14 +6,20 @@ import (
|
|||||||
"cn/oneao/base-go/utils/response"
|
"cn/oneao/base-go/utils/response"
|
||||||
"context"
|
"context"
|
||||||
"github.com/cloudwego/hertz/pkg/app"
|
"github.com/cloudwego/hertz/pkg/app"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 私有 key,防止冲突
|
// 私有 key,防止冲突
|
||||||
type ctxKeyUserID struct{}
|
type ctxKeyUser struct{}
|
||||||
|
|
||||||
|
// ContextUser 保存用户信息,包括 UserID 和 SpaceID
|
||||||
|
type ContextUser struct {
|
||||||
|
UserID int64
|
||||||
|
SpaceID int64
|
||||||
|
}
|
||||||
|
|
||||||
// Auth 中间件,直接在中间件里过滤白名单路径
|
// Auth 中间件,直接在中间件里过滤白名单路径
|
||||||
func Auth() app.HandlerFunc {
|
func Auth() app.HandlerFunc {
|
||||||
// 白名单路径,直接写死
|
|
||||||
whitelistPaths := []string{
|
whitelistPaths := []string{
|
||||||
"/auth/login",
|
"/auth/login",
|
||||||
"/auth/register",
|
"/auth/register",
|
||||||
@@ -23,14 +29,13 @@ func Auth() app.HandlerFunc {
|
|||||||
return func(ctx context.Context, c *app.RequestContext) {
|
return func(ctx context.Context, c *app.RequestContext) {
|
||||||
path := string(c.Request.URI().Path())
|
path := string(c.Request.URI().Path())
|
||||||
|
|
||||||
// 使用工具函数判断是否在白名单
|
|
||||||
if pathx.MatchPath(path, whitelistPaths) {
|
if pathx.MatchPath(path, whitelistPaths) {
|
||||||
c.Next(ctx)
|
c.Next(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 token
|
|
||||||
token := string(c.GetHeader("token"))
|
token := string(c.GetHeader("token"))
|
||||||
|
spaceId := string(c.GetHeader("x-space-id"))
|
||||||
|
|
||||||
if token == "" {
|
if token == "" {
|
||||||
response.Fail(c).Code(response.HttpCode.Unauthorized).Send()
|
response.Fail(c).Code(response.HttpCode.Unauthorized).Send()
|
||||||
@@ -41,28 +46,52 @@ func Auth() app.HandlerFunc {
|
|||||||
verifyToken := jwtx.VerifyToken(token)
|
verifyToken := jwtx.VerifyToken(token)
|
||||||
|
|
||||||
if verifyToken.IsValid {
|
if verifyToken.IsValid {
|
||||||
// 设置 userID 到 context
|
user := &ContextUser{
|
||||||
ctx = setUserID(ctx, verifyToken.Claims.UserID)
|
UserID: verifyToken.Claims.UserID,
|
||||||
|
SpaceID: 0,
|
||||||
|
}
|
||||||
|
if spaceId != "" {
|
||||||
|
i, err := strconv.ParseInt(spaceId, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
response.Fail(c).Message("Invalid x-space-id").Send()
|
||||||
|
c.Abort()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
user.SpaceID = i
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = setContextUser(ctx, user)
|
||||||
c.Next(ctx)
|
c.Next(ctx)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// token 无效
|
|
||||||
response.Fail(c).Code(response.HttpCode.RefreshToken).Send()
|
response.Fail(c).Code(response.HttpCode.RefreshToken).Send()
|
||||||
c.Abort()
|
c.Abort()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserID 从 context 中获取 user_id
|
// GetContextUser 从 context 获取用户信息
|
||||||
func GetUserID(ctx context.Context) int64 {
|
func GetContextUser(ctx context.Context) *ContextUser {
|
||||||
userID, ok := ctx.Value(ctxKeyUserID{}).(int64)
|
user, ok := ctx.Value(ctxKeyUser{}).(*ContextUser)
|
||||||
if !ok {
|
if !ok || user == nil {
|
||||||
return 0 // 或者返回 error,根据业务需求
|
return &ContextUser{}
|
||||||
}
|
}
|
||||||
return userID
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
// 内部中间件设置 user_id
|
// GetUserID 从 context 获取 user_id
|
||||||
func setUserID(ctx context.Context, userID int64) context.Context {
|
func GetUserID(ctx context.Context) int64 {
|
||||||
return context.WithValue(ctx, ctxKeyUserID{}, userID)
|
return GetContextUser(ctx).UserID
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSpaceID 从 context 获取 space_id,并返回是否有效
|
||||||
|
func GetSpaceID(ctx context.Context) (int64, bool) {
|
||||||
|
spaceID := GetContextUser(ctx).SpaceID
|
||||||
|
return spaceID, spaceID != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 内部中间件设置 ContextUser
|
||||||
|
func setContextUser(ctx context.Context, user *ContextUser) context.Context {
|
||||||
|
return context.WithValue(ctx, ctxKeyUser{}, user)
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,20 @@ WHERE mr.user_id = $1
|
|||||||
AND mr.record_time BETWEEN $2 AND $3
|
AND mr.record_time BETWEEN $2 AND $3
|
||||||
ORDER BY mr.record_time DESC, mr.create_time DESC;
|
ORDER BY mr.record_time DESC, mr.create_time DESC;
|
||||||
|
|
||||||
|
-- name: FindMoneyRecordsBySpace :many
|
||||||
|
SELECT
|
||||||
|
mr.*,
|
||||||
|
u.username AS username,
|
||||||
|
muc.name AS category_name,
|
||||||
|
muc.icon AS category_icon,
|
||||||
|
muc.type AS category_type
|
||||||
|
FROM money_record mr
|
||||||
|
LEFT JOIN money_user_category muc ON mr.category_id = muc.id
|
||||||
|
INNER JOIN space_user su ON mr.user_id = su.user_id AND su.space_id = $1
|
||||||
|
LEFT JOIN user_info u ON mr.user_id = u.id
|
||||||
|
WHERE mr.record_time BETWEEN $2 AND $3
|
||||||
|
ORDER BY mr.record_time DESC, mr.create_time DESC;
|
||||||
|
|
||||||
-- name: InsertMoneyRecord :one
|
-- name: InsertMoneyRecord :one
|
||||||
INSERT INTO money_record (
|
INSERT INTO money_record (
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -20,6 +20,75 @@ func (q *Queries) DeleteMoneyRecord(ctx context.Context, id int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const findMoneyRecordsBySpace = `-- name: FindMoneyRecordsBySpace :many
|
||||||
|
SELECT
|
||||||
|
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
|
||||||
|
u.username AS username,
|
||||||
|
muc.name AS category_name,
|
||||||
|
muc.icon AS category_icon,
|
||||||
|
muc.type AS category_type
|
||||||
|
FROM money_record mr
|
||||||
|
LEFT JOIN money_user_category muc ON mr.category_id = muc.id
|
||||||
|
INNER JOIN space_user su ON mr.user_id = su.user_id AND su.space_id = $1
|
||||||
|
LEFT JOIN user_info u ON mr.user_id = u.id
|
||||||
|
WHERE mr.record_time BETWEEN $2 AND $3
|
||||||
|
ORDER BY mr.record_time DESC, mr.create_time DESC
|
||||||
|
`
|
||||||
|
|
||||||
|
type FindMoneyRecordsBySpaceParams struct {
|
||||||
|
SpaceID int64
|
||||||
|
RecordTime pgtype.Timestamp
|
||||||
|
RecordTime_2 pgtype.Timestamp
|
||||||
|
}
|
||||||
|
|
||||||
|
type FindMoneyRecordsBySpaceRow struct {
|
||||||
|
ID int64
|
||||||
|
CategoryID int64
|
||||||
|
UserID int64
|
||||||
|
Amount pgtype.Numeric
|
||||||
|
Remark pgtype.Text
|
||||||
|
RecordTime pgtype.Timestamp
|
||||||
|
CreateTime pgtype.Timestamp
|
||||||
|
UpdateTime pgtype.Timestamp
|
||||||
|
Username pgtype.Text
|
||||||
|
CategoryName pgtype.Text
|
||||||
|
CategoryIcon pgtype.Text
|
||||||
|
CategoryType pgtype.Int4
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) FindMoneyRecordsBySpace(ctx context.Context, arg FindMoneyRecordsBySpaceParams) ([]FindMoneyRecordsBySpaceRow, error) {
|
||||||
|
rows, err := q.db.Query(ctx, findMoneyRecordsBySpace, arg.SpaceID, arg.RecordTime, arg.RecordTime_2)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
var items []FindMoneyRecordsBySpaceRow
|
||||||
|
for rows.Next() {
|
||||||
|
var i FindMoneyRecordsBySpaceRow
|
||||||
|
if err := rows.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CategoryID,
|
||||||
|
&i.UserID,
|
||||||
|
&i.Amount,
|
||||||
|
&i.Remark,
|
||||||
|
&i.RecordTime,
|
||||||
|
&i.CreateTime,
|
||||||
|
&i.UpdateTime,
|
||||||
|
&i.Username,
|
||||||
|
&i.CategoryName,
|
||||||
|
&i.CategoryIcon,
|
||||||
|
&i.CategoryType,
|
||||||
|
); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
items = append(items, i)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
const findUserMoneyRecords = `-- name: FindUserMoneyRecords :many
|
const findUserMoneyRecords = `-- name: FindUserMoneyRecords :many
|
||||||
SELECT
|
SELECT
|
||||||
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
|
mr.id, mr.category_id, mr.user_id, mr.amount, mr.remark, mr.record_time, mr.create_time, mr.update_time,
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ message MoneyRecordItem {
|
|||||||
string RecordTime = 6 [(api.body)="record_time"];
|
string RecordTime = 6 [(api.body)="record_time"];
|
||||||
string CreateTime = 7 [(api.body)="create_time"];
|
string CreateTime = 7 [(api.body)="create_time"];
|
||||||
string UpdateTime = 8 [(api.body)="update_time"];
|
string UpdateTime = 8 [(api.body)="update_time"];
|
||||||
|
string Username = 9 [(api.body)="username"];
|
||||||
|
int32 CategoryType = 10 [(api.body)="category_type"];
|
||||||
|
string CategoryIcon = 11 [(api.body)="category_icon"];
|
||||||
|
string CategoryName = 12 [(api.body)="category_name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同一天的记账记录分组
|
// 同一天的记账记录分组
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ message ExitSpaceResult {
|
|||||||
|
|
||||||
// 踢出成员
|
// 踢出成员
|
||||||
message RemoveSpaceUserParams {
|
message RemoveSpaceUserParams {
|
||||||
int64 SpaceId = 1 [(api.body) = "space_id",(api.vd)="$ != 0"];
|
int64 UserId = 1 [(api.body) = "user_id",(api.vd)="$ != 0"];
|
||||||
int64 UserId = 2 [(api.body) = "user_id",(api.vd)="$ != 0"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RemoveSpaceUserResult {
|
message RemoveSpaceUserResult {
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ func StringToTimestamp(s string) pgtype.Timestamp {
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
layouts := []string{
|
layouts := []string{
|
||||||
"2006-01-02 15:04:05",
|
"2006-01-02 15:04:05", // 完整时间
|
||||||
"2006-01-02",
|
"2006-01-02", // 仅日期也可解析
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, layout := range layouts {
|
for _, layout := range layouts {
|
||||||
@@ -104,3 +104,22 @@ func StringToTimestamp(s string) pgtype.Timestamp {
|
|||||||
|
|
||||||
return pgtype.Timestamp{Valid: false}
|
return pgtype.Timestamp{Valid: false}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StringToDate 将字符串解析为 pgtype.Date
|
||||||
|
// 支持格式:YYYY-MM-DD
|
||||||
|
// 解析失败或空字符串返回零值 Date
|
||||||
|
func StringToDate(s string) pgtype.Date {
|
||||||
|
if s == "" {
|
||||||
|
return pgtype.Date{Valid: false}
|
||||||
|
}
|
||||||
|
|
||||||
|
t, err := time.Parse("2006-01-02", s)
|
||||||
|
if err != nil {
|
||||||
|
return pgtype.Date{Valid: false}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pgtype.Date{
|
||||||
|
Time: t,
|
||||||
|
Valid: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user