Browse Source

3-18 增加卡券类型字段更新接口

majun
majun 4 months ago
parent
commit
ed5808bb14
  1. 15
      api/v1/coupon/coupon.go
  2. 2
      internal/dao/internal/coupon.go
  3. 2
      internal/dao/internal/member_info.go
  4. 2
      internal/logic/coupon/coupon.go
  5. 1
      internal/model/do/coupon.go
  6. 1
      internal/model/do/member_info.go
  7. 1
      internal/model/dto/dto_coupon.go
  8. 19
      internal/model/entity/coupon.go
  9. 1
      internal/model/entity/member_info.go

15
api/v1/coupon/coupon.go

@ -8,17 +8,18 @@ type GetCouponListReq struct {
}
type GetCouponReq struct {
Id int `v:"required#优惠券id不能为空" dc:"优惠券id"`
Id int `v:"required#卡券id不能为空" dc:"卡券id"`
}
type DeleteCouponReq struct {
Id int `v:"required#优惠券id不能为空" dc:"优惠券id"`
Id int `v:"required#卡券id不能为空" dc:"卡券id"`
}
type InsertCouponReq struct {
Id int `dc:"优惠券id"`
Title string `v:"required#优惠券名字不能为空" dc:"优惠券名字"`
Image string `v:"required#优惠券图片不能为空" dc:"优惠券图片"`
StartTime *gtime.Time `v:"required#优惠券生效时间不能为空" dc:"生效时间"`
EndTime *gtime.Time `v:"required#优惠券失效时间不能为空" dc:"失效时间"`
Id int `dc:"卡券id"`
Title string `v:"required#卡券名字不能为空" dc:"卡券名字"`
Image string `v:"required#卡券图片不能为空" dc:"卡券图片"`
Type int `v:"required#卡券类型不能为空" dc:"卡券类型"`
StartTime *gtime.Time `v:"required#卡券生效时间不能为空" dc:"生效时间"`
EndTime *gtime.Time `v:"required#卡券失效时间不能为空" dc:"失效时间"`
}

2
internal/dao/internal/coupon.go

@ -26,6 +26,7 @@ type CouponColumns struct {
ImgUrl string // 放大看全图
StartTime string // 有效期起始
EndTime string // 有效期截止
Type string // 类型(1:卡券 2:二维码)
Deleted string // 是否删除?
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
@ -39,6 +40,7 @@ var couponColumns = CouponColumns{
ImgUrl: "img_url",
StartTime: "start_time",
EndTime: "end_time",
Type: "type",
Deleted: "deleted",
CreatedAt: "created_at",
UpdatedAt: "updated_at",

2
internal/dao/internal/member_info.go

@ -41,6 +41,7 @@ type MemberInfoColumns struct {
Employee string // 1:员工
Dachang string // 0:不是大厂员工 1:是大厂员工
BoguMember string // 1:博股会员
LearningLevel string // 学习等级
LearningIcon string // 学习等级icon
Mobile string // 手机号
UserIdentity string // 0:无认证 1:红V 2:蓝V 3:黄V
@ -79,6 +80,7 @@ var memberInfoColumns = MemberInfoColumns{
Employee: "employee",
Dachang: "dachang",
BoguMember: "bogu_member",
LearningLevel: "learning_level",
LearningIcon: "learning_icon",
Mobile: "mobile",
UserIdentity: "user_identity",

2
internal/logic/coupon/coupon.go

@ -78,6 +78,7 @@ func (s *sCoupon) InsertCoupon(ctx context.Context, req *coupon.InsertCouponReq)
Title: req.Title,
Cover: req.Image,
ImgUrl: req.Image,
Type: req.Type,
StartTime: req.StartTime.Unix(),
EndTime: req.EndTime.Unix(),
}).Insert()
@ -86,6 +87,7 @@ func (s *sCoupon) InsertCoupon(ctx context.Context, req *coupon.InsertCouponReq)
Title: req.Title,
Cover: req.Image,
ImgUrl: req.Image,
Type: req.Type,
StartTime: req.StartTime.Unix(),
EndTime: req.EndTime.Unix(),
}).WherePri(req.Id).Update()

1
internal/model/do/coupon.go

@ -18,6 +18,7 @@ type Coupon struct {
ImgUrl interface{} // 放大看全图
StartTime interface{} // 有效期起始
EndTime interface{} // 有效期截止
Type interface{} // 类型(1:卡券 2:二维码)
Deleted interface{} // 是否删除?
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间

1
internal/model/do/member_info.go

@ -33,6 +33,7 @@ type MemberInfo struct {
Employee interface{} // 1:员工
Dachang interface{} // 0:不是大厂员工 1:是大厂员工
BoguMember interface{} // 1:博股会员
LearningLevel interface{} // 学习等级
LearningIcon interface{} // 学习等级icon
Mobile interface{} // 手机号
UserIdentity interface{} // 0:无认证 1:红V 2:蓝V 3:黄V

1
internal/model/dto/dto_coupon.go

@ -8,6 +8,7 @@ type DtoCoupon struct {
Cover string `json:"cover" orm:"db:default;table:coupon;column:cover" description:"封面小图片"` // 封面小图片
ImgUrl string `json:"imgUrl" orm:"db:default;table:coupon;column:img_url" description:"放大看全图"` // 放大看全图
UpdatedAt *gtime.Time `json:"updatedAt" orm:"db:default;table:coupon;column:updated_at" description:"更新时间"` // 更新时间
Type int `json:"type" orm:"db:default;table:coupon;column:type" description:"卡券类型"` // 卡券类型
StartTime *gtime.Time `json:"startTime" description:"有效期起始"` // 有效期起始
EndTime *gtime.Time `json:"endTime" description:"有效期截止"` // 有效期截止
Status int `json:"status" description:"卡券状态"` // 卡券状态

19
internal/model/entity/coupon.go

@ -10,13 +10,14 @@ import (
// Coupon is the golang structure for table coupon.
type Coupon struct {
Id uint `json:"id" orm:"id" description:""` //
Title string `json:"title" orm:"title" description:"名字"` // 名字
Cover string `json:"cover" orm:"cover" description:"封面小图片"` // 封面小图片
ImgUrl string `json:"imgUrl" orm:"img_url" description:"放大看全图"` // 放大看全图
StartTime int `json:"startTime" orm:"start_time" description:"有效期起始"` // 有效期起始
EndTime int `json:"endTime" orm:"end_time" description:"有效期截止"` // 有效期截止
Deleted int `json:"deleted" orm:"deleted" description:"是否删除?"` // 是否删除?
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
Id uint `json:"id" orm:"id" description:""` //
Title string `json:"title" orm:"title" description:"名字"` // 名字
Cover string `json:"cover" orm:"cover" description:"封面小图片"` // 封面小图片
ImgUrl string `json:"imgUrl" orm:"img_url" description:"放大看全图"` // 放大看全图
StartTime int `json:"startTime" orm:"start_time" description:"有效期起始"` // 有效期起始
EndTime int `json:"endTime" orm:"end_time" description:"有效期截止"` // 有效期截止
Type int `json:"type" orm:"type" description:"类型(1:卡券 2:二维码)"` // 类型(1:卡券 2:二维码)
Deleted int `json:"deleted" orm:"deleted" description:"是否删除?"` // 是否删除?
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
}

1
internal/model/entity/member_info.go

@ -31,6 +31,7 @@ type MemberInfo struct {
Employee int `json:"employee" orm:"employee" description:"1:员工"` // 1:员工
Dachang int `json:"dachang" orm:"dachang" description:"0:不是大厂员工 1:是大厂员工"` // 0:不是大厂员工 1:是大厂员工
BoguMember int `json:"boguMember" orm:"bogu_member" description:"1:博股会员"` // 1:博股会员
LearningLevel int `json:"learningLevel" orm:"learning_level" description:"学习等级"` // 学习等级
LearningIcon string `json:"learningIcon" orm:"learning_icon" description:"学习等级icon"` // 学习等级icon
Mobile string `json:"mobile" orm:"mobile" description:"手机号"` // 手机号
UserIdentity int `json:"userIdentity" orm:"user_identity" description:"0:无认证 1:红V 2:蓝V 3:黄V"` // 0:无认证 1:红V 2:蓝V 3:黄V

Loading…
Cancel
Save