解决合并代码后的报错问题
This commit is contained in:
@@ -205,6 +205,61 @@ export async function saveSignInConfig(config : SignInConfig) : Promise<boolean>
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到配置模型(含模式、提醒、积分、经验)
|
||||
*/
|
||||
export type CheckinConfig = {
|
||||
id ?: string
|
||||
merchant_id ?: string
|
||||
is_open : boolean
|
||||
mode : string // 'none' | 'week' | 'month'
|
||||
notice_enabled : boolean
|
||||
integral_reward : number
|
||||
exp_reward : number
|
||||
updated_at ?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签到配置(扩展版)
|
||||
*/
|
||||
export async function fetchCheckinConfig() : Promise<CheckinConfig | null> {
|
||||
const { data, error } = await supa
|
||||
.from('ak_signin_configs')
|
||||
.select('*')
|
||||
.eq('id', 'signin_config')
|
||||
.single()
|
||||
.execute()
|
||||
|
||||
if (error != null) {
|
||||
return null
|
||||
}
|
||||
return data as CheckinConfig | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存签到配置(扩展版)
|
||||
*/
|
||||
export async function saveCheckinConfig(config : CheckinConfig) : Promise<boolean> {
|
||||
const uid = getCurrentUid()
|
||||
if (uid == null) return false
|
||||
|
||||
const { error } = await supa
|
||||
.from('ak_signin_configs')
|
||||
.upsert({
|
||||
...config,
|
||||
id: 'signin_config',
|
||||
merchant_id: uid,
|
||||
updated_at: new Date().toISOString()
|
||||
})
|
||||
.execute()
|
||||
|
||||
if (error != null) {
|
||||
console.error('保存签到配置(扩展)失败:', error)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换优惠券状态
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user