fix: remove ServerEnv() usage in dspy script, change expires_at to expired_date
This commit is contained in:
parent
fb5a24c240
commit
09acce0637
@ -40,14 +40,11 @@ if not dappid:
|
|||||||
}, ensure_ascii=False)
|
}, ensure_ascii=False)
|
||||||
|
|
||||||
# 获取数据库连接
|
# 获取数据库连接
|
||||||
env = ServerEnv()
|
dbname = get_module_dbname('dapi')
|
||||||
dbname = env.get_module_dbname('dapi')
|
|
||||||
config = getConfig()
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
db.databases = config.databases
|
|
||||||
|
|
||||||
# 检查dapi模块是否提供了create_user_apikey函数
|
# 检查dapi模块是否提供了create_user_apikey函数
|
||||||
create_apikey_func = getattr(env, 'create_user_apikey', None)
|
create_apikey_func = create_user_apikey
|
||||||
|
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
if action == 'single':
|
if action == 'single':
|
||||||
@ -108,7 +105,7 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
'apikey': password_encode(apikey_value),
|
'apikey': password_encode(apikey_value),
|
||||||
'enabled': '1',
|
'enabled': '1',
|
||||||
'created_at': datetime.now().strftime('%Y-%m-%d'),
|
'created_at': datetime.now().strftime('%Y-%m-%d'),
|
||||||
'expires_at': '9999-12-31'
|
'expired_date': '9999-12-31'
|
||||||
}
|
}
|
||||||
|
|
||||||
await sor.C('downapikey', ns)
|
await sor.C('downapikey', ns)
|
||||||
@ -194,7 +191,7 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
'apikey': password_encode(apikey_value),
|
'apikey': password_encode(apikey_value),
|
||||||
'enabled': '1',
|
'enabled': '1',
|
||||||
'created_at': datetime.now().strftime('%Y-%m-%d'),
|
'created_at': datetime.now().strftime('%Y-%m-%d'),
|
||||||
'expires_at': '9999-12-31'
|
'expired_date': '9999-12-31'
|
||||||
}
|
}
|
||||||
|
|
||||||
await sor.C('downapikey', ns)
|
await sor.C('downapikey', ns)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user