优惠卷新增了用户数据
This commit is contained in:
@@ -17,6 +17,7 @@ type UserCouponDto struct {
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
Coupon *CouponDto `json:"coupon"` // 优惠卷
|
||||
User *UserDto `json:"user"` // 用户
|
||||
}
|
||||
|
||||
// GetUserCouponDto 用户优惠卷详情
|
||||
@@ -60,6 +61,11 @@ func GetUserCouponListDto(m []*model.UserCoupon) []*UserCouponDto {
|
||||
response = response.LoadCoupon(v.Coupon)
|
||||
}
|
||||
|
||||
// 加载用户数据
|
||||
if v.User != nil {
|
||||
response = response.LoadCoupon(v.Coupon)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
@@ -80,3 +86,12 @@ func (r *UserCouponDto) LoadCoupon(m *model.Coupon) *UserCouponDto {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadUser 加载用户数据
|
||||
func (r *UserCouponDto) LoadUser(m *model.User) *UserCouponDto {
|
||||
if m != nil {
|
||||
r.User = GetUserDto(m)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user