浏览代码

fix: coupon type cannot display properly (#21)

pplulee 1 年之前
父节点
当前提交
f2bbafd764
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Models/UserCoupon.php

+ 1 - 1
src/Models/UserCoupon.php

@@ -29,7 +29,7 @@ final class UserCoupon extends Model
      */
     public function type(): string
     {
-        return match (json_decode($this->content)) {
+        return match (json_decode($this->content)->type ?? null) {
             'percentage' => '百分比',
             'fixed' => '固定金额',
             default => '未知',