从一次支付状态建模说起 早些年写支付结果,我习惯用一个 enum 加一堆 if: enum PayStatus { SUCCESS, FAILED, PENDING, REFUNDED } void handle(PayStatus s) { if (s == SUCCESS) { ...