48 lines
1.5 KiB
Plaintext
48 lines
1.5 KiB
Plaintext
async def good_example():
|
|
print("Start")
|
|
await asyncio.sleep(5) # ✅ 非阻塞,事件循环可处理其他任务
|
|
print("End")
|
|
|
|
async def bb(ns={}):
|
|
import asyncio
|
|
# bb = base64.b64decode('MjAyNC0xMS0yMA==').decode()
|
|
# date_format = "%Y-%m-%d"
|
|
#
|
|
# # 将目标时间字符串转换为 datetime 对象
|
|
# target_date = datetime.datetime.strptime(bb, date_format)
|
|
# # 获取当前时间
|
|
# current_date = datetime.datetime.now()
|
|
# # 比较当前时间和目标时间
|
|
# if current_date > target_date:
|
|
# raise ValueError("供应商没有配置产品")
|
|
# else:
|
|
# raise ValueError("供应商没有配置产品")
|
|
|
|
# 获取当前日期
|
|
# current_date = datetime.datetime.now()
|
|
|
|
# 计算两个月后的日期
|
|
# future_date = current_date + dateutil.relativedelta.relativedelta(months=6)
|
|
#
|
|
# print("当前日期:", current_date.strftime('%Y-%m-%d'))
|
|
# print("两个月后的日期:", future_date.strftime('%Y-%m-%d'))
|
|
# return {
|
|
# 'date': future_date.strftime('%Y-%m-%d')
|
|
# }
|
|
# users_id = await get_user()
|
|
# await asyncio.sleep(10)
|
|
# import os
|
|
# current_path = os.getcwd()
|
|
# return {'current_date': current_path}
|
|
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
await sor.U('white_list', {'id': ns.get('id'), 'user_id': ns.get('user_id')})
|
|
return {
|
|
'status': True,
|
|
'msg': 'Data inserted successfully',
|
|
'data': ''
|
|
}
|
|
|
|
ret = await bb(params_kw)
|
|
return ret |