xcstream
V2EX  ›  Node.js

支付宝回调函数金额的判断,不知道有没有问题。

  •  
  •   xcstream · Jul 10, 2018 · 4784 views
    This topic created in 3046 days ago, the information mentioned may be changed or developed.
    等于号左边是支付宝传来的'0.01'这样的字符串,右边是一个数字表示分
    if(parseInt(parseFloat(req.body.total_fee) * 100) == amount ){

    }
    3 replies  •  2018-07-17 10:17:01 +08:00
    huoru
    huoru
    Jul 10, 2018
    1
    支付宝不用分来存这么 6 的吗
    xcstream
    xcstream
    OP
    Jul 11, 2018
    2
    parseInt 改成 Math.round 了
    cqu1980
    cqu1980
    Jul 17, 2018
    3
    @xcstream parseInt 会出问题,改 Math.round 比较好,主要是经常会出现 9999 的情况。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2198 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:47 · PVG 21:47 · LAX 05:47 · JFK 08:47
    ♥ Do have faith in what you're doing.