This commit is contained in:
yumoqing 2025-08-24 12:29:29 +08:00
parent 4efc171c26
commit 4a5ae230ee

View File

@ -33,10 +33,12 @@ class DownloadMgr:
userid = await self.env.get_user() userid = await self.env.get_user()
dbname = self.env.get_module_dbname('downloadmgr') dbname = self.env.get_module_dbname('downloadmgr')
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
ts = timestampstr()
ns = { ns = {
"id": taskid, "id": taskid,
"userid": userid, "userid": userid,
"start_time": timestampstr() "finish_time": ts,
"start_time": ts
} }
await sor.C('download', ns) await sor.C('download', ns)
@ -47,7 +49,7 @@ class DownloadMgr:
async with db.sqlorContext(dbname) as sor: async with db.sqlorContext(dbname) as sor:
sql = """select * from download sql = """select * from download
where userid=${userid}$ where userid=${userid}$
and finish_time is NULL""" and finish_time = start_time"""
ns = { ns = {
'userid': userid 'userid': userid
} }
@ -93,7 +95,7 @@ and finish_time is NULL"""
async def get_task_status(self, tid): async def get_task_status(self, tid):
d = await self.uapicall('get_task_status', {'taskid':tid}) d = await self.uapicall('get_task_status', {'taskid':tid})
await self.check_downlaod_finished(d.result) await self.check_download_finished(d.result)
rzt = d.result rzt = d.result
rzt.filename = rzt.info.name rzt.filename = rzt.info.name
return rzt return rzt