Files
2026-10-08 18:18:21 +08:00

42 lines
1.3 KiB
JavaScript

'use strict';
const dayjs = require("dayjs");
module.exports = {
/**
* XXXnameXXX
* @url client/timedTask/pub/task 前端调用的url参数地址
* data 请求参数
* @param {String} params1 参数1
*/
main: async (event) => {
let {data = {}, userInfo, util, filterResponse, originalParam} = event;
let {customUtil, uniID, config, pubFun, vk, db, _} = util;
let {uid} = data;
let res = {code: 0, msg: ""};
// 业务逻辑开始-----------------------------------------------------------
if (data.key !== 'lsgjoksdjf') return {code: 1, msg: '非法请求'}
// 取消超时未支付订单
res = await vk.baseDao.select({
dbName: "jjx-old",
whereJson: {
status: 0,
},
})
for (const row of res.rows) {
if (dayjs(row.expiredTime).isBefore(dayjs())) {
await vk.baseDao.updateById({
dbName: "jjx-old",
id: row._id,
dataJson: {
status: -1,
},
})
}
}
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}