sql数据流,amdin业务逻辑接入

This commit is contained in:
comlibmb
2026-02-05 10:11:09 +08:00
parent 859372ca5b
commit ac670cf5d8
81 changed files with 3547 additions and 1472 deletions

View File

@@ -64,8 +64,8 @@ export async function getCurrentUser() : Promise<UserProfile | null> {
state.userProfile = { username: '', email: '' }
state.isLoggedIn = false // 未登录
return null
} // 查询 ak_users 表补全 profile
const res = await supa.from('ak_users').select('*', {}).eq('id', userId).execute()
} // 查询 ak_users 表补全 profile权威关联字段auth_id = auth.uid()
const res = await supa.from('ak_users').select('*', {}).eq('auth_id', userId).execute()
console.log(res)
if (res.status >= 200 && res.status < 300 && (res.data != null)) {
let user : UTSJSONObject | null = null;
@@ -182,13 +182,11 @@ export function getUserStore() {
},
getUserRole() : string | null {
// Default role logic - can be enhanced based on your needs
const sessionInfo = supa.getSession()
if (sessionInfo.user == null) return null
// You can add role detection logic here
// For now, return a default role
return 'teacher' // or determine from user profile/database
const profile = state.userProfile
if (profile != null && profile.role != null) {
return profile.role
}
return null
},
getProfile() : UserProfile | null {