1、新增旧货市场

2、新增用户等级
This commit is contained in:
2023-12-10 14:53:07 +08:00
parent a45d185c64
commit 17b2d8f117
112 changed files with 10795 additions and 6362 deletions
@@ -41,14 +41,18 @@ var cloudObject = {
let res = {code: 0, msg: ''};
// 业务逻辑开始-----------------------------------------------------------
console.log('pay notify res', data)
const order = await vk.baseDao.findByWhereJson({
dbName: "jjx-order",
whereJson: {
orderNo: data.billNo,
}
});
console.log('order', order)
// type 0: 商品
// type 1: 自营
// type 2: 保证金
// type 3: 会员升级
if (order && order.orderStatus === 0 && data.billStatus === 'PAID') {
const billPayment = JSON.parse(data.billPayment)
await vk.baseDao.updateById({
@@ -61,6 +65,65 @@ var cloudObject = {
payNo: billPayment.paySeqId,
}
});
if (order.type === 2) {
await vk.baseDao.updateById({
dbName: "uni-id-users",
id: order.uid,
dataJson: {
paidEnsure: _.inc(parseFloat(billPayment.receiptAmount) / 100),
}
});
} else if (order.type === 3) {
const goods = await vk.baseDao.findByWhereJson({
dbName: "jjx-goods",
whereJson: {
orderId: order._id,
}
});
await vk.baseDao.updateById({
dbName: "uni-id-users",
id: order.uid,
dataJson: {
userLevel: goods.goodsId,
userGrade: 0
}
});
const user = await vk.baseDao.findById({
dbName: "uni-id-users",
id: order.uid
});
if (user.inviter_uid && user.inviter_uid.length > 0) {
await vk.baseDao.updateById({
dbName: "uni-id-users",
id: user.inviter_uid[0],
dataJson: {
inviteNum: _.inc(1)
}
});
}
const messageConfig = await vk.baseDao.find({
dbName: "jjx-message-config",
dataJson: {
uid: order.uid
}
});
if (!messageConfig) {
await vk.baseDao.add({
dbName: "jjx-message-config",
dataJson: {
uid: order.uid,
article: true,
process: true,
old: true,
enquiry: true,
productList: [],
addressRegion: {}
}
})
}
}
}
// 业务逻辑结束-----------------------------------------------------------
return res;