-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
購物車金流相關調整 #23
購物車金流相關調整 #23
Conversation
const calculateTotalPrice = (courseData) => { | ||
let totalPrice = 0 | ||
|
||
courseData.forEach((course) => { | ||
if (course.price < course.originPrice) { | ||
totalPrice += course.price | ||
} else { | ||
totalPrice += course.originPrice | ||
} | ||
}) | ||
|
||
return totalPrice | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Controller 內部通常都放跟路由後續有關動作的 js
- calculateTotalPrice 的 function 應放在 src 下的 js 或 utils 內,可能需找個適當的 js 放入
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增 calculate.js
controllers/cartController/crypt.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
先前沒注意到 crypt.js 也應放在 src 下的 js 或者 utils 的資料夾下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移至 utils 資料夾
controllers/cartController/index.js
Outdated
@@ -8,71 +8,40 @@ const { | |||
create_mpg_sha_encrypt, | |||
create_mpg_aes_decrypt | |||
} = require('./crypt') | |||
const { getCourseData, calculateTotalPrice } = require('./cartOperations') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
路徑需跟著 cartOperations 位置改變而更動
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以調整
@ankazu 再麻煩修正了 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
檔案搬遷
@ankazu ok,再麻煩合併了🙏 |
cart 取得課程相關資料與總價計算,重複使用函式,另開新檔。
金流混淆參數增加 Name
order 新增 name 參數、商品詳細上限50字元。
createOrder 修改訂單參數、取得課程總價