Merge branch 'main' of https://git.opencomputing.cn/yumoqing/kboss
This commit is contained in:
commit
dc514871b6
@ -110,7 +110,7 @@ async def affirmbz_order(ns={}):
|
|||||||
return {'status': True, 'msg': '支付成功'}
|
return {'status': True, 'msg': '支付成功'}
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
await sor.rollback()
|
await sor.rollback()
|
||||||
raise error
|
return {'status': False, 'msg': str(error)}
|
||||||
|
|
||||||
async def baidu_new_update_resouce(ns={}):
|
async def baidu_new_update_resouce(ns={}):
|
||||||
|
|
||||||
@ -235,10 +235,10 @@ async def get_baidu_orderlist(ns={}):
|
|||||||
serviceType = orders[0]['orderItems']
|
serviceType = orders[0]['orderItems']
|
||||||
|
|
||||||
# 可能获取得到的是延迟订单
|
# 可能获取得到的是延迟订单
|
||||||
if orders[0]['type'] == 'REFUND' and orders[0]['status'] != 'CREATED':
|
# if orders[0]['type'] == 'REFUND' and orders[0]['status'] != 'CREATED':
|
||||||
await update_baidu_order_list({'userid': ns.get('userid')})
|
# await update_baidu_order_list({'userid': ns.get('userid')})
|
||||||
res_refund = await baidu_confirm_refund_order({'order_id': ns.get('order_id'), 'baidu_id': baidu_users[0]['baidu_id'], 'user_id': ns.get('userid')})
|
# res_refund = await baidu_confirm_refund_order({'order_id': ns.get('order_id'), 'baidu_id': baidu_users[0]['baidu_id'], 'user_id': ns.get('userid')})
|
||||||
return res_refund
|
# return res_refund
|
||||||
|
|
||||||
# 避免重复退订
|
# 避免重复退订
|
||||||
if orders[0]['type'] == 'REFUND' and orders[0]['status'] == 'CREATED':
|
if orders[0]['type'] == 'REFUND' and orders[0]['status'] == 'CREATED':
|
||||||
@ -617,7 +617,7 @@ async def get_baidu_orderlist(ns={}):
|
|||||||
# await baidu_new_update_resouce(ns)
|
# await baidu_new_update_resouce(ns)
|
||||||
return {
|
return {
|
||||||
'status': True,
|
'status': True,
|
||||||
'orderid': bz_ns['id'],
|
'orderid': bz_ns.get('id'),
|
||||||
'originalprice': bz_ns.get('originalprice'),
|
'originalprice': bz_ns.get('originalprice'),
|
||||||
'servicename': bz_ns.get('servicename'),
|
'servicename': bz_ns.get('servicename'),
|
||||||
'amount': total_price
|
'amount': total_price
|
||||||
@ -713,7 +713,7 @@ async def update_baidu_order_list(ns={}):
|
|||||||
|
|
||||||
async def baidu_confirm_refund_order(ns={}):
|
async def baidu_confirm_refund_order(ns={}):
|
||||||
# ns = {
|
# ns = {
|
||||||
# 'order_id': ["03ee8d08da79458b8f8d3157d3498330", "e711729606024080bf9613d975294616"],
|
# 'order_id': ["13f3518648054796abf7f3d00ed611bf"],
|
||||||
# 'userid': 'KsKhCUPizQyGiw3L1WVRy'
|
# 'userid': 'KsKhCUPizQyGiw3L1WVRy'
|
||||||
# }
|
# }
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -739,6 +739,10 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
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']
|
||||||
|
|
||||||
|
ns_record_li = await sor.R('user_action', {'orderid': order_id})
|
||||||
|
ns_record_id = ns_record_li[0]['id'] if ns_record_li else None
|
||||||
|
ns_record = {'id': ns_record_id} if ns_record_id else None
|
||||||
|
|
||||||
if not refundstatus:
|
if not refundstatus:
|
||||||
# data_ = {}
|
# data_ = {}
|
||||||
# 调用支付订单接口
|
# 调用支付订单接口
|
||||||
@ -771,7 +775,15 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
await sor.U('baidu_orders', {'id': refund_id, 'refundstatus': '1'})
|
await sor.U('baidu_orders', {'id': refund_id, 'refundstatus': '1'})
|
||||||
|
|
||||||
# 增加延迟
|
# 增加延迟
|
||||||
await asyncio.sleep(2)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
|
# 延迟2-3秒还是获取到 ready状态的订单,那就重复请求一次,目的是尽快刷新状态
|
||||||
|
async with aiohttp_client.request(
|
||||||
|
method=method,
|
||||||
|
url=url,
|
||||||
|
headers=header,
|
||||||
|
json=paydata) as res:
|
||||||
|
await res.json()
|
||||||
|
|
||||||
# 把 NEED_CONFIRM的本地库改为CREATED
|
# 把 NEED_CONFIRM的本地库改为CREATED
|
||||||
await update_baidu_order_list({'userid': ns.get('userid')})
|
await update_baidu_order_list({'userid': ns.get('userid')})
|
||||||
@ -800,7 +812,8 @@ async def baidu_confirm_refund_order(ns={}):
|
|||||||
if local_refund_status.get('status'):
|
if local_refund_status.get('status'):
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
await sor.U('baidu_orders', {'id': refund_id, 'refundstatus': '2'})
|
baidu_orders_status_update = """update baidu_orders set refundstatus='2' where id='%s';""" % refund_id
|
||||||
|
await sor.sqlExe(baidu_orders_status_update, {})
|
||||||
await sor.U('user_action', {'id': ns_record.get('id'), 'ordertype': 'REFUND', 'reason': '远程退款成功, 本地客户退款成功'})
|
await sor.U('user_action', {'id': ns_record.get('id'), 'ordertype': 'REFUND', 'reason': '远程退款成功, 本地客户退款成功'})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
*/20 * * * * curl https://dev.kaiyuancloud.cn/zj/zj_get_order.dspy
|
*/20 * * * * curl https://dev.kaiyuancloud.cn/zj/zj_get_order.dspy
|
||||||
49 9-10 * * * curl https://dev.kaiyuancloud.cn/zj/zj_get_bill.dspy
|
49 9-10 * * * curl https://dev.kaiyuancloud.cn/zj/zj_get_bill.dspy
|
||||||
|
|
||||||
*/20 * * * * curl https://www.kaiyuancloud.cn/dev/hpc/GetUserBill.dspy > /d/zhc/crontab_dev.log 2>&1
|
#*/20 * * * * curl https://www.kaiyuancloud.cn/dev/hpc/GetUserBill.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
0 0 * * * curl https://www.kaiyuancloud.cn/dev/lease/update_stock.dspy > /d/zhc/crontab_dev.log 2>&1
|
0 0 * * * curl https://www.kaiyuancloud.cn/dev/lease/update_stock.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
# 30 9 * * * curl https://www.kaiyuancloud.cn/dev/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_dev.log 2>&1
|
# 30 9 * * * curl https://www.kaiyuancloud.cn/dev/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
# 0 1 * * * curl https://www.kaiyuancloud.cn/dev/handover/params_time.dspy > /d/zhc/crontab_dev.log 2>&1
|
# 0 1 * * * curl https://www.kaiyuancloud.cn/dev/handover/params_time.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* * * * * curl https://www.kaiyuancloud.cn/dev/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_dev.log 2>&1
|
* * * * * curl https://www.kaiyuancloud.cn/dev/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
#* * * * * curl https://www.kaiyuancloud.cn/dev/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1
|
#* * * * * curl https://www.kaiyuancloud.cn/dev/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
|
|
||||||
*/20 * * * * curl https://dev.opencomputing.cn/hpc/GetUserBill.dspy > /d/zhc/crontab_dev.log 2>&1
|
#*/20 * * * * curl https://dev.opencomputing.cn/hpc/GetUserBill.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
0 0 * * * curl https://dev.opencomputing.cn/lease/update_stock.dspy > /d/zhc/crontab_dev.log 2>&1
|
0 0 * * * curl https://dev.opencomputing.cn/lease/update_stock.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
# 30 9 * * * curl https://dev.opencomputing.cn/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_dev.log 2>&1
|
# 30 9 * * * curl https://dev.opencomputing.cn/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
# 0 1 * * * curl https://dev.opencomputing.cn/handover/params_time.dspy > /d/zhc/crontab_dev.log 2>&1
|
# 0 1 * * * curl https://dev.opencomputing.cn/handover/params_time.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
@ -24,7 +24,7 @@
|
|||||||
* * * * * curl https://dev.opencomputing.cn/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_dev.log 2>&1
|
* * * * * curl https://dev.opencomputing.cn/baiduc/baidu_new_update_resouce.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
#* * * * * curl https://dev.opencomputing.cn/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1
|
#* * * * * curl https://dev.opencomputing.cn/baiduc/baidu_sms_kafka_consumer.dspy > /d/zhc/crontab_dev.log 2>&1
|
||||||
|
|
||||||
*/20 * * * * curl https://www.opencomputing.cn/hpc/GetUserBill.dspy > /d/zhc/crontab_prod.log 2>&1
|
#*/20 * * * * curl https://www.opencomputing.cn/hpc/GetUserBill.dspy > /d/zhc/crontab_prod.log 2>&1
|
||||||
0 0 * * * curl https://www.opencomputing.cn/lease/update_stock.dspy > /d/zhc/crontab_prod.log 2>&1
|
0 0 * * * curl https://www.opencomputing.cn/lease/update_stock.dspy > /d/zhc/crontab_prod.log 2>&1
|
||||||
# 30 9 * * * curl https://www.opencomputing.cn/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_prod.log 2>&1
|
# 30 9 * * * curl https://www.opencomputing.cn/provider_settle/auto_provider_settle_cron_job.dspy > /d/zhc/crontab_prod.log 2>&1
|
||||||
# 0 1 * * * curl https://www.opencomputing.cn/handover/params_time.dspy > /d/zhc/crontab_prod.log 2>&1
|
# 0 1 * * * curl https://www.opencomputing.cn/handover/params_time.dspy > /d/zhc/crontab_prod.log 2>&1
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
<!-- 添加全屏加载效果 -->
|
||||||
<iframe v-loading="loading" v-if="url" :src="url" frameborder="0" class="baidu-style">
|
<div v-loading="loading" class="loading-container">
|
||||||
|
<iframe v-if="url" :src="url" frameborder="0" class="baidu-style">
|
||||||
</iframe>
|
</iframe>
|
||||||
<div v-else>
|
<div v-else class="login-prompt">
|
||||||
<p>请先登录百度云账号</p>
|
<p>请先登录百度云账号</p>
|
||||||
<button @click="getToken">重试</button>
|
<button @click="getToken">重试</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -22,7 +24,6 @@ export default {
|
|||||||
url: '',
|
url: '',
|
||||||
loading: true,
|
loading: true,
|
||||||
userid: '',
|
userid: '',
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@ -62,24 +63,12 @@ export default {
|
|||||||
console.log('接收到消息:', event);
|
console.log('接收到消息:', event);
|
||||||
const data = event.data;
|
const data = event.data;
|
||||||
console.log('接收到的 data 是:', data);
|
console.log('接收到的 data 是:', data);
|
||||||
// 1. 检查数据结构和来源 (可选但推荐)
|
|
||||||
// const expectedOrigin = 'https://console.vcp.baidu.com';
|
|
||||||
// if (event.origin !== expectedOrigin) {
|
|
||||||
// console.warn('Received message from unexpected origin:', event.origin);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 2. 检查是否存在 refundInfo 和 uuidList
|
// 2. 检查是否存在 refundInfo 和 uuidList
|
||||||
if (data && data.refundInfo && Array.isArray(data.refundInfo.uuidList) && data.refundInfo.uuidList.length > 0) {
|
if (data && data.refundInfo && Array.isArray(data.refundInfo.uuidList) && data.refundInfo.uuidList.length > 0) {
|
||||||
const uuidListArray = data.refundInfo.uuidList; // 这是一个数组
|
const uuidListArray = data.refundInfo.uuidList; // 这是一个数组
|
||||||
|
|
||||||
// 3. 提取订单ID (这里假设取第一个,或者根据需要处理整个数组)
|
console.log('提取到的订单ID:', uuidListArray);
|
||||||
// 如果只需要一个订单ID进行退订
|
|
||||||
const orderId = uuidListArray;
|
|
||||||
// 如果需要处理多个订单ID,可以用逗号连接
|
|
||||||
// const orderId = uuidListArray.join(',');
|
|
||||||
|
|
||||||
console.log('提取到的订单ID:', orderId);
|
|
||||||
|
|
||||||
// 4. 获取用户ID
|
// 4. 获取用户ID
|
||||||
this.userid = sessionStorage.getItem('userId');
|
this.userid = sessionStorage.getItem('userId');
|
||||||
@ -91,7 +80,7 @@ export default {
|
|||||||
|
|
||||||
// 5. 构造请求参数
|
// 5. 构造请求参数
|
||||||
const payload = {
|
const payload = {
|
||||||
order_id: orderId,
|
order_id: uuidListArray,
|
||||||
userid: this.userid
|
userid: this.userid
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,9 +93,9 @@ export default {
|
|||||||
console.log("调用 reqBaiduJudgePrice 接口返回:", res);
|
console.log("调用 reqBaiduJudgePrice 接口返回:", res);
|
||||||
if (res.status) { // 假设 status 为 true 表示成功
|
if (res.status) { // 假设 status 为 true 表示成功
|
||||||
this.$message.success('退订成功');
|
this.$message.success('退订成功');
|
||||||
// 跳转页面
|
// 修复页面跳转 - 使用 path 而不是 url
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
url: '/BaiduNetdisk',
|
path: '/BaiduNetdisk',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 显示后端返回的错误信息
|
// 显示后端返回的错误信息
|
||||||
@ -124,7 +113,6 @@ export default {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('接收到的消息不包含有效的退款信息或 uuidList 为空');
|
console.log('接收到的消息不包含有效的退款信息或 uuidList 为空');
|
||||||
// 根据需要决定是否提示用户
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,11 +125,19 @@ export default {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-prompt {
|
||||||
|
text-align: center;
|
||||||
|
padding: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
.baidu-style {
|
.baidu-style {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100vh - 100px);
|
height: calc(100vh - 100px);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user