update
This commit is contained in:
parent
ada80cf936
commit
737878beb9
@ -645,8 +645,8 @@ async def baidu_users_get_post_pay(ns={}):
|
||||
userid = baidu_user['user_id']
|
||||
baidu_id = baidu_user['baidu_id']
|
||||
|
||||
# if baidu_id != 'dcf0fa1519d24de893b186e52d733bd2':
|
||||
# continue
|
||||
if baidu_id != 'a6f0dbc20f074ea18b4d3ac3ec77d537':
|
||||
continue
|
||||
try:
|
||||
user_orgid = (await sor.R('users', {'id': userid}))[0]['orgid']
|
||||
user_parentid = (await sor.R('organization', {'id': user_orgid}))[0]['parentid']
|
||||
|
||||
53
b/baiduc/update_user_orders_interval.dspy
Normal file
53
b/baiduc/update_user_orders_interval.dspy
Normal file
@ -0,0 +1,53 @@
|
||||
async def update_user_orders_interval(ns={}):
|
||||
"""
|
||||
更新用户订单列表
|
||||
"""
|
||||
domain_name = ns.get('domain_name')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext('kboss') as sor:
|
||||
sql = """select bo.orderid, bs.user_id from baidu_orders as bo inner join baidu_users as bs on bo.accountid = bs.baidu_id inner join users as u on bs.user_id = u.id inner join organization as o on o.id = u.orgid where o.parentid = '%s' and bo.ordertype = 'RENEW' and bo.status = 'NEED_CONFIRM' and bo.del_flg = '0';""" % ns.get('orgid')
|
||||
order_list = await sor.sqlExe(sql, {})
|
||||
try:
|
||||
for order in order_list:
|
||||
orderid = order['orderid']
|
||||
user_id = order['user_id']
|
||||
url = 'https://%s/baiducloud/get_baidu_orderlist.dspy' % domain_name
|
||||
params = {
|
||||
'order_id': orderid,
|
||||
'userid': user_id
|
||||
}
|
||||
method = 'POST'
|
||||
async with aiohttp_client.request(
|
||||
method=method,
|
||||
url=url,
|
||||
json=params) as res:
|
||||
order_result = await res.text()
|
||||
with open('update_baidu_renew.log', 'a+') as f:
|
||||
# 行首添加时间
|
||||
f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + orderid + ':' + order_result + '\n')
|
||||
|
||||
url_update = 'https://%s/baiduc/update_baidu_order_list.dspy' % domain_name
|
||||
params_update = {
|
||||
'orgid': ns.get('orgid')
|
||||
}
|
||||
method = 'POST'
|
||||
async with aiohttp_client.request(
|
||||
method=method,
|
||||
url=url_update,
|
||||
json=params_update) as res:
|
||||
data_text = await res.text()
|
||||
with open('update_baidu_renew.log', 'a+') as f:
|
||||
# 行首添加时间
|
||||
f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + data_text + '\n')
|
||||
return {
|
||||
'status': True,
|
||||
'msg': '更新成功'
|
||||
}
|
||||
except Exception as e:
|
||||
import traceback
|
||||
with open('update_baidu_renew.log', 'a+') as f:
|
||||
f.write(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ' ' + str(e) + traceback.format_exc() + '\n')
|
||||
traceback.print_exc()
|
||||
|
||||
ret = await update_user_orders_interval(params_kw)
|
||||
return ret
|
||||
Loading…
x
Reference in New Issue
Block a user