Skip to content

Commit

Permalink
Merge pull request #25 from HSNM2/feature/20230610_John_cart_newebpay
Browse files Browse the repository at this point in the history
feat: 新增 金流結帳完成,增加課程購買人數
  • Loading branch information
paperhsiaooo committed Jun 10, 2023
2 parents cc74d7a + 50bc2d4 commit 111b239
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/cartController/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ exports.notify = {
if (user) {
for (const orderDetail of order.order_details) {
const courseId = orderDetail.courseId

const course = await Course.findByPk(courseId)
if (course) {
course.buyers = (course.buyers || 0) + 1
await course.save()
}

await user.addCourse(courseId)
}
}
Expand Down

0 comments on commit 111b239

Please sign in to comment.