25 lines
719 B
Python
25 lines
719 B
Python
|
|
import logging
|
||
|
|
from DbKit.Db import Db
|
||
|
|
|
||
|
|
logger = logging.getLogger("HaiBaoModel")
|
||
|
|
|
||
|
|
class HaiBaoModel:
|
||
|
|
def __init__(self):
|
||
|
|
self.db = Db()
|
||
|
|
|
||
|
|
async def insert_record(self, id, prompt, image_url, scheme_content, created_at):
|
||
|
|
"""插入生成记录"""
|
||
|
|
params = {
|
||
|
|
"id": id,
|
||
|
|
"prompt": prompt,
|
||
|
|
"image_url": image_url,
|
||
|
|
"scheme_content": scheme_content,
|
||
|
|
"created_at": created_at
|
||
|
|
}
|
||
|
|
return await self.db.execute_update("HaiBao.insertHistory", params)
|
||
|
|
|
||
|
|
async def get_history(self, limit=50):
|
||
|
|
"""获取历史记录"""
|
||
|
|
params = {"limit": limit}
|
||
|
|
return await self.db.find("HaiBao.getHistory", params)
|