feat: 完成....
This commit is contained in:
25
tonesc-red-packet/app/server/actions/get-red-packet.ts
Normal file
25
tonesc-red-packet/app/server/actions/get-red-packet.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
"use server"
|
||||
|
||||
import { db } from "@/app/server/db"
|
||||
import { redPackets } from "@/app/server/schema/red-packet"
|
||||
import { eq } from "drizzle-orm"
|
||||
|
||||
export async function getRedPacketByPublicId(id: string) {
|
||||
const rows = await db
|
||||
.select()
|
||||
.from(redPackets)
|
||||
.where(eq(redPackets.publicId, id))
|
||||
.limit(1)
|
||||
|
||||
return rows[0] ?? null
|
||||
}
|
||||
|
||||
export async function getRedPacketByAdminId(id: string) {
|
||||
const rows = await db
|
||||
.select()
|
||||
.from(redPackets)
|
||||
.where(eq(redPackets.adminId, id))
|
||||
.limit(1)
|
||||
|
||||
return rows[0] ?? null
|
||||
}
|
||||
Reference in New Issue
Block a user