(id int)
| 101 | } |
| 102 | |
| 103 | func GetRedemptionById(id int) (*Redemption, error) { |
| 104 | if id == 0 { |
| 105 | return nil, errors.New("id 为空!") |
| 106 | } |
| 107 | redemption := Redemption{Id: id} |
| 108 | var err error = nil |
| 109 | err = DB.First(&redemption, "id = ?", id).Error |
| 110 | return &redemption, err |
| 111 | } |
| 112 | |
| 113 | func Redeem(key string, userId int) (quota int, err error) { |
| 114 | if key == "" { |
no outgoing calls
no test coverage detected