chore: 初始化仓库基线(AGENTS.md、git 规范、敏感文件排除)

This commit is contained in:
weijuesen
2026-08-10 22:30:53 +08:00
commit 84abf4454c
358 changed files with 75993 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import Taro from '@tarojs/taro'
const isWeapp = process.env.TARO_ENV === 'weapp'
export async function callFunction<T = any>(
name: string,
data?: Record<string, any>
): Promise<T> {
if (!isWeapp) {
const mockModule = await import(`../data/${name}`)
return mockModule.default(data) as T
}
const res = await Taro.cloud.callFunction({ name, data })
const result = res.result as { code: number; message: string; data: T }
if (result.code !== 0) {
console.error(`[Cloud] ${name} failed:`, result.message)
throw new Error(result.message || '请求失败')
}
return result.data
}
export function getDatabase() {
if (!isWeapp) {
return null
}
return Taro.cloud.database()
}