From 48a66d55e69e650f2790a1d71dcb69eeb76b822f Mon Sep 17 00:00:00 2001 From: Aresn Date: Wed, 9 Apr 2025 08:57:00 +0800 Subject: [PATCH] Wed Apr 9 08:57:00 CST 2025 inscode --- index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2d7e683..db0b75c 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 -- GitLab