Skip to content

Commit

Permalink
fix: coupon list empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sjatsh committed Nov 8, 2023
1 parent 46ae857 commit d9dcc6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions dao/t_coupon_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (d *DbDao) FindCouponCodeList(cid string, page, pageSize int) (res []*table
}
return
}
if err = db.Where("status=?", tables.CouponStatusUsed).Count(&used).Error; err != nil {
if err = d.db.Model(&tables.CouponInfo{}).Where("cid=? and status=?", cid, tables.CouponStatusUsed).Count(&used).Error; err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) {
return
}
Expand All @@ -128,7 +128,6 @@ func (d *DbDao) FindCouponCodeList(cid string, page, pageSize int) (res []*table
}
return
}

for idx, v := range res {
res[idx].Code, err = encrypt.AesDecrypt(v.Code, config.Cfg.Das.Coupon.EncryptionKey)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion http_server/handle/check_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

type ReqCheckPermissions struct {
core.ChainTypeAddress
Account string `json:"account"`
Account string `json:"account" binding:"required"`
}

func (h *HttpHandle) CheckPermissions(ctx *gin.Context) {
Expand Down

0 comments on commit d9dcc6f

Please sign in to comment.