20261008
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
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: '非法请求'}
|
||||
|
||||
// 自动确认收货
|
||||
const autoConfirm = await vk.baseDao.findById({
|
||||
dbName: 'jjx-dict',
|
||||
id: "a72823ff65a4ea8e0730de3d2a14ba3f"
|
||||
})
|
||||
|
||||
const checkRes = await vk.baseDao.select({
|
||||
dbName: "jjx-order",
|
||||
whereJson: {
|
||||
orderStatus: _.in([2, 3]),
|
||||
expressTime: _.lte(
|
||||
vk.pubfn.getOffsetTime(new Date(), {
|
||||
day: parseInt(autoConfirm.content),
|
||||
mode: "before",
|
||||
}))
|
||||
}
|
||||
})
|
||||
console.log('checkRes', checkRes)
|
||||
console.log('checkResDate', vk.pubfn.getOffsetTime(new Date(), {
|
||||
day: parseInt(autoConfirm.content),
|
||||
mode: "before",
|
||||
}))
|
||||
|
||||
await vk.baseDao.update({
|
||||
dbName: "jjx-order",
|
||||
whereJson: {
|
||||
orderStatus: _.in([2, 3]),
|
||||
expressTime: _.lte(
|
||||
vk.pubfn.getOffsetTime(new Date(), {
|
||||
day: parseInt(autoConfirm.content),
|
||||
mode: "before",
|
||||
}))
|
||||
},
|
||||
dataJson: {
|
||||
orderStatus: 4
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
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: '非法请求'}
|
||||
|
||||
const certificateList = await vk.baseDao.select({
|
||||
dbName: "jjx-certificate",
|
||||
whereJson: {
|
||||
hasReport: false,
|
||||
paidConfirm: true
|
||||
}
|
||||
});
|
||||
// console.log('certificateList', certificateList)
|
||||
const url = 'https://tczapi.fadada.com/czapi/api/compliance-contract-report'
|
||||
// const url = 'https://czapi-test.fadada.com/evidence-api/api/compliance-contract-report'
|
||||
for (let i = 0; i < certificateList.rows.length; i++) {
|
||||
const certificate = certificateList.rows[i];
|
||||
const contract = await vk.baseDao.findById({
|
||||
dbName: "jjx-contract",
|
||||
id: certificate.contractId
|
||||
});
|
||||
// console.log('contract', contract)
|
||||
// console.log('deliveryMethods', certificate.deliveryMethods)
|
||||
if (certificate.deliveryMethods.paper) {
|
||||
const result = await pubFun.fadada(url, {
|
||||
contractNum: contract.transactionId,
|
||||
// contractNum: 'C2510141800348945357 ',
|
||||
evidenceType: 0,
|
||||
'reportExpressInfo.name': certificate.paperDelivery.receiver,
|
||||
'reportExpressInfo.mobile': certificate.paperDelivery.phone,
|
||||
'reportExpressInfo.address': certificate.paperDelivery.address,
|
||||
}, true)
|
||||
console.log('certificate', {
|
||||
contractNum: contract.transactionId,
|
||||
evidenceType: 0,
|
||||
'reportExpressInfo.name': certificate.paperDelivery.receiver,
|
||||
'reportExpressInfo.mobile': certificate.paperDelivery.phone,
|
||||
'reportExpressInfo.address': certificate.paperDelivery.address,
|
||||
})
|
||||
if (parseInt(result.code) === 1000) {
|
||||
await vk.baseDao.update({
|
||||
dbName: "jjx-certificate",
|
||||
whereJson: {
|
||||
contractId: certificate.contractId
|
||||
},
|
||||
dataJson: {
|
||||
hasReport: true,
|
||||
reportData: result.data
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const result = await pubFun.fadada(url, {
|
||||
contractNum: contract.transactionId,
|
||||
evidenceType: 2
|
||||
}, true)
|
||||
// console.log('compliance-contract-report', result)
|
||||
|
||||
if (parseInt(result.code) === 1000) {
|
||||
await vk.baseDao.update({
|
||||
dbName: "jjx-certificate",
|
||||
whereJson: {
|
||||
contractId: certificate.contractId
|
||||
},
|
||||
dataJson: {
|
||||
hasReport: true,
|
||||
downloadUrl: result.data.downloadUrl,
|
||||
reportData: result.data
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user