update
This commit is contained in:
parent
5ecf944bc6
commit
23e6aaea12
@ -69,10 +69,18 @@ async def affirmbz_order(ns={}):
|
|||||||
# 处理退订逻辑
|
# 处理退订逻辑
|
||||||
if order_type == 'REFUND':
|
if order_type == 'REFUND':
|
||||||
# 找到资源并更新时间
|
# 找到资源并更新时间
|
||||||
resource_find_sql = """select id from customer_goods where resourceid = '%s';""" % j['resourceids']
|
resource_find_sql = """select id, resourceid, expire_resourceid from customer_goods where FIND_IN_SET('%s', resourceid) and del_flg = '0';""" % j['resourceids']
|
||||||
resource_find_li = await sor.sqlExe(resource_find_sql, {})
|
resource_find_li = await sor.sqlExe(resource_find_sql, {})
|
||||||
resource_find_id = resource_find_li[0]['id']
|
resource_find_id = resource_find_li[0]['id']
|
||||||
await sor.U('customer_goods', {'id': resource_find_id, 'del_flg': '1'})
|
expire_resourceid = resource_find_li[0]['expire_resourceid']
|
||||||
|
expire_resourceid += expire_resourceid + ',' + j['resourceids'] if expire_resourceid else j['resourceids']
|
||||||
|
items_refund = resource_find_li[0]['resourceid'].split(',') if resource_find_li[0]['resourceid'] else []
|
||||||
|
filtered_items = [item for item in items_refund if item != j['resourceids']]
|
||||||
|
result = ','.join(filtered_items)
|
||||||
|
if not result:
|
||||||
|
await sor.U('customer_goods', {'id': resource_find_id, 'del_flg': '1'})
|
||||||
|
else:
|
||||||
|
await sor.U('customer_goods', {'id': resource_find_id, 'resourceid': result, 'expire_resourceid': expire_resourceid})
|
||||||
|
|
||||||
# 处理续费逻辑
|
# 处理续费逻辑
|
||||||
elif order_type == 'RENEW':
|
elif order_type == 'RENEW':
|
||||||
@ -411,6 +419,22 @@ async def get_baidu_orderlist(ns={}):
|
|||||||
nss['resourceids'] = ','.join(i['shortIds']) if i.get('shortIds') else ''
|
nss['resourceids'] = ','.join(i['shortIds']) if i.get('shortIds') else ''
|
||||||
nss['orderkey'] = i.get('key')
|
nss['orderkey'] = i.get('key')
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 保存配置configurations 存入specdata表中
|
||||||
|
if i.get('configurations'):
|
||||||
|
specdata = json.dumps(i['configurations'], ensure_ascii=False)
|
||||||
|
ns_specificdata = {
|
||||||
|
'id': uuid(),
|
||||||
|
'productid': product[0]['id'],
|
||||||
|
'spec_data': specdata,
|
||||||
|
}
|
||||||
|
nss['spec_id'] = ns_specificdata['id']
|
||||||
|
await sor.C('specificdata', ns_specificdata)
|
||||||
|
except Exception as e:
|
||||||
|
print('保存配置configurations失败', str(e))
|
||||||
|
with open('baidu_error.log', 'a') as f:
|
||||||
|
f.write('保存配置configurations失败' + str(e) + '\n')
|
||||||
|
|
||||||
# 如果是续费订单 由于没有返回日期, 重新计算日期
|
# 如果是续费订单 由于没有返回日期, 重新计算日期
|
||||||
if order_type == 'RENEW':
|
if order_type == 'RENEW':
|
||||||
history_time_sql = "select resourcestarttime, resourceendtime from order_goods where FIND_IN_SET('%s', resourceids) order by resourceendtime desc;" % \
|
history_time_sql = "select resourcestarttime, resourceendtime from order_goods where FIND_IN_SET('%s', resourceids) order by resourceendtime desc;" % \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user