diff --git a/index.js b/index.js index 2d7e6834fb6366b3120c7a37cc5f637bc4a33928..db0b75c97b4360244e90188d3507410642455849 100644 --- a/index.js +++ b/index.js @@ -1 +1,17 @@ -console.log("欢迎来到 InsCode"); \ No newline at end of file +function equalToken(model) { + let unitPrice = 1/1000000; // 1token 是多少钱 + if (model.currency === 'USD') { + const exchangeRate = 7; + return (model.price / unitPrice) / exchangeRate; + } + return model.price / unitPrice; +} + +const model = { + price: 0.0014, + currency: 'USD' +} + +const token = equalToken(model); + +console.log(token); \ No newline at end of file