Merge branch 'main' of git.opencomputing.cn:yumoqing/kboss
This commit is contained in:
commit
1b53d2cb82
@ -73,7 +73,7 @@ class KYYAliECS:
|
|||||||
destination_resource=ns.get('destination_resource'),
|
destination_resource=ns.get('destination_resource'),
|
||||||
spot_duration=ns.get('spot_duration'),
|
spot_duration=ns.get('spot_duration'),
|
||||||
spot_strategy=ns.get('spot_strategy'),
|
spot_strategy=ns.get('spot_strategy'),
|
||||||
instance_charge_type=ns.get('instance_charge_type')
|
#instance_charge_type=ns.get('instance_charge_type')
|
||||||
)
|
)
|
||||||
runtime = util_models.RuntimeOptions()
|
runtime = util_models.RuntimeOptions()
|
||||||
try:
|
try:
|
||||||
@ -122,7 +122,7 @@ class KYYAliECS:
|
|||||||
minimum_baseline_credit=ns.get('minimum_baseline_credit'),
|
minimum_baseline_credit=ns.get('minimum_baseline_credit'),
|
||||||
minimum_initial_credit=ns.get('minimum_initial_credit'),
|
minimum_initial_credit=ns.get('minimum_initial_credit'),
|
||||||
max_results=ns.get('max_results'),
|
max_results=ns.get('max_results'),
|
||||||
next_token=ns.get('next_token'),
|
#next_token=ns.get('next_token'),
|
||||||
)
|
)
|
||||||
runtime = util_models.RuntimeOptions()
|
runtime = util_models.RuntimeOptions()
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -777,6 +777,7 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
|
orderss = (await sor.R('bz_order', {'orderid': ns.get('order_id')}))[1]
|
||||||
users = await sor.R('baidu_users', {'user_id': ns['userid']})
|
users = await sor.R('baidu_users', {'user_id': ns['userid']})
|
||||||
ns['baidu_id'] = users[0]['baidu_id'] if users else None
|
ns['baidu_id'] = users[0]['baidu_id'] if users else None
|
||||||
if not ns['baidu_id']:
|
if not ns['baidu_id']:
|
||||||
@ -794,6 +795,7 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
refund_status_li = await sor.R('baidu_orders', {'orderid': order_id})
|
refund_status_li = await sor.R('baidu_orders', {'orderid': order_id})
|
||||||
|
refund_status_li_info = await sor.R('baidu_orders', {'orderid': order_id})[2]
|
||||||
refundstatus = refund_status_li[0]['refundstatus']
|
refundstatus = refund_status_li[0]['refundstatus']
|
||||||
refund_id = refund_status_li[0]['id']
|
refund_id = refund_status_li[0]['id']
|
||||||
|
|
||||||
@ -879,7 +881,7 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
|
|
||||||
# 分割
|
# 分割
|
||||||
# 增加延迟
|
# 增加延迟
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(10)
|
||||||
|
|
||||||
# 把 NEED_CONFIRM的本地库改为CREATED
|
# 把 NEED_CONFIRM的本地库改为CREATED
|
||||||
await update_baidu_order_list({'userid': ns.get('userid')})
|
await update_baidu_order_list({'userid': ns.get('userid')})
|
||||||
|
|||||||
@ -652,7 +652,7 @@ async def baidu_users_get_post_pay(ns={}):
|
|||||||
# if baidu_id != 'f61b662bcd684499b6403371365715b9':
|
# if baidu_id != 'f61b662bcd684499b6403371365715b9':
|
||||||
# continue
|
# continue
|
||||||
try:
|
try:
|
||||||
user_orgid = (await sor.R('users', {'id': userid}))[0]['orgid']
|
user_orgid = (await sor.R('users', {'id': userid}))[0]['orgid'][1]
|
||||||
user_parentid = (await sor.R('organization', {'id': user_orgid}))[0]['parentid']
|
user_parentid = (await sor.R('organization', {'id': user_orgid}))[0]['parentid']
|
||||||
await get_resourcechargeitem_billlist(userid=userid, baidu_id=baidu_id, user_orgid=user_orgid, user_parentid=user_parentid, pageno=1, sor=sor)
|
await get_resourcechargeitem_billlist(userid=userid, baidu_id=baidu_id, user_orgid=user_orgid, user_parentid=user_parentid, pageno=1, sor=sor)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
# 弃用接口 不再读取整个文件逻辑
|
||||||
async def user_action_record(ns={}):
|
async def user_action_record(ns={}):
|
||||||
ns_dic = {
|
ns_dic = {
|
||||||
'id': uuid(),
|
'id': uuid(),
|
||||||
@ -777,7 +778,8 @@ async def update_baidu_order_list(ns={}):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async def baidu_confirm_auto_renew_order(ns={}):
|
async def info_test_(ns={}):
|
||||||
|
# 弃用接口 不再读取整个文件逻辑
|
||||||
if ns.get('domain_name'):
|
if ns.get('domain_name'):
|
||||||
orgid_li = await sor.R('reseller', {'domain_name': ns.get('domain_name'), 'del_flg': '0'})
|
orgid_li = await sor.R('reseller', {'domain_name': ns.get('domain_name'), 'del_flg': '0'})
|
||||||
orgid = orgid_li[0]['orgid']
|
orgid = orgid_li[0]['orgid']
|
||||||
@ -811,7 +813,7 @@ async def baidu_confirm_auto_renew_order(ns={}):
|
|||||||
'log_level': 'ERROR',
|
'log_level': 'ERROR',
|
||||||
'log_content': '续费订单 %s 失败 %s' % (order_id, str(renew_status)),
|
'log_content': '续费订单 %s 失败 %s' % (order_id, str(renew_status)),
|
||||||
'user_id': user_id,
|
'user_id': user_id,
|
||||||
'request_url': '/baiduc/baidu_confirm_auto_renew_order.dspy'
|
'request_url': '/baiduc/info_test_.dspy'
|
||||||
}
|
}
|
||||||
await sor.C('warn_error_log', ns_err_log)
|
await sor.C('warn_error_log', ns_err_log)
|
||||||
|
|
||||||
@ -830,5 +832,5 @@ async def baidu_confirm_auto_renew_order(ns={}):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = await baidu_confirm_auto_renew_order(params_kw)
|
ret = await info_test_(params_kw)
|
||||||
return ret
|
return ret
|
||||||
@ -11,6 +11,8 @@ async def change_ecs_name(ns={}):
|
|||||||
"EcsId": ns.get("EcsId"),
|
"EcsId": ns.get("EcsId"),
|
||||||
"Name": ns.get("Name")
|
"Name": ns.get("Name")
|
||||||
}
|
}
|
||||||
|
print(body)
|
||||||
|
print(get_signature(action, method, ecs_url, param))
|
||||||
url = get_signature(action, method, ecs_url, param)
|
url = get_signature(action, method, ecs_url, param)
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.request(method, url, json=body) as response:
|
async with session.request(method, url, json=body) as response:
|
||||||
|
|||||||
@ -6,6 +6,10 @@ async def delete_eip(ns={}):
|
|||||||
param = {}
|
param = {}
|
||||||
url = get_signature(action, method, NETWORK_URL, param=param)
|
url = get_signature(action, method, NETWORK_URL, param=param)
|
||||||
body = {'EIPId': ns.get('EIPId')}
|
body = {'EIPId': ns.get('EIPId')}
|
||||||
|
|
||||||
|
print(body)
|
||||||
|
print(url)
|
||||||
|
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.request(method, url, json=body) as response:
|
async with session.request(method, url, json=body) as response:
|
||||||
resp = await response.text()
|
resp = await response.text()
|
||||||
|
|||||||
@ -28,6 +28,8 @@ async def describe_eip(ns={}):
|
|||||||
else:
|
else:
|
||||||
result['status'] = False
|
result['status'] = False
|
||||||
result['msg'] = result.pop('Message')
|
result['msg'] = result.pop('Message')
|
||||||
|
print(result)
|
||||||
|
result['price'] = 0.001
|
||||||
return result
|
return result
|
||||||
|
|
||||||
ret = await describe_eip(params_kw)
|
ret = await describe_eip(params_kw)
|
||||||
|
|||||||
@ -31,6 +31,12 @@ async def model_management_pin_top(ns={}):
|
|||||||
if current_order <= min_order:
|
if current_order <= min_order:
|
||||||
return {'status': True, 'msg': 'already at top', 'data': {'sort_order': current_order}}
|
return {'status': True, 'msg': 'already at top', 'data': {'sort_order': current_order}}
|
||||||
|
|
||||||
|
if current_order == 'min_order':
|
||||||
|
return {'status': True, 'msg': 'already at top', 'data': {'sort_order': current_order}}
|
||||||
|
|
||||||
|
if current_order == 'max_order':
|
||||||
|
return {'status': True, 'msg': 'already at bottom', 'data': {'sort_order': current_order}}
|
||||||
|
|
||||||
new_order = min_order - 1
|
new_order = min_order - 1
|
||||||
update_sql = """
|
update_sql = """
|
||||||
UPDATE model_management SET sort_order = %s WHERE id = '%s';
|
UPDATE model_management SET sort_order = %s WHERE id = '%s';
|
||||||
|
|||||||
@ -61,6 +61,18 @@ class ChatApiClient:
|
|||||||
path = path if path.startswith("/") else f"/{path}"
|
path = path if path.startswith("/") else f"/{path}"
|
||||||
return f"{self.base_url}{path}"
|
return f"{self.base_url}{path}"
|
||||||
|
|
||||||
|
def _auth_headers(self, extra: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
||||||
|
headers: Dict[str, Any] = {}
|
||||||
|
if USERID:
|
||||||
|
headers["X-User-Id"] = USERID
|
||||||
|
if API_KEY:
|
||||||
|
headers["X-Api-Key"] = API_KEY
|
||||||
|
if API_URL:
|
||||||
|
headers["X-Api-Url"] = API_URL
|
||||||
|
if extra:
|
||||||
|
headers.update(extra)
|
||||||
|
return headers
|
||||||
|
|
||||||
def _auth(self, extra: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
def _auth(self, extra: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
||||||
params: Dict[str, Any] = {}
|
params: Dict[str, Any] = {}
|
||||||
if USERID:
|
if USERID:
|
||||||
|
|||||||
@ -2,6 +2,12 @@ async def addinvitecode(ns):
|
|||||||
"""
|
"""
|
||||||
生成邀请码
|
生成邀请码
|
||||||
"""
|
"""
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
start_of_day = now.replace(hour=0, minute=0, second=0, microsecond=0)
|
||||||
|
end_of_day = now.replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||||
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
if ns['promotingid'] and ns['iusserid']:
|
if ns['promotingid'] and ns['iusserid']:
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
async def get_customer_mailcode(ns):
|
async def get_customer_mailcode(ns):
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
|
||||||
|
if now.hour < 10:
|
||||||
|
print('now.hour < 10')
|
||||||
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
user = await sor.R('users', {'id': ns.get('user_id')})
|
user = await sor.R('users', {'id': ns.get('user_id')})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user