From ed5808bb14f6040d5c2c89351e706d5b0301c625 Mon Sep 17 00:00:00 2001 From: majun <3060162534@qq.com> Date: Tue, 18 Mar 2025 17:10:04 +0800 Subject: [PATCH] =?UTF-8?q?3-18=20=E5=A2=9E=E5=8A=A0=E5=8D=A1=E5=88=B8?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E6=9B=B4=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/coupon/coupon.go | 15 ++++++++------- internal/dao/internal/coupon.go | 2 ++ internal/dao/internal/member_info.go | 2 ++ internal/logic/coupon/coupon.go | 2 ++ internal/model/do/coupon.go | 1 + internal/model/do/member_info.go | 1 + internal/model/dto/dto_coupon.go | 1 + internal/model/entity/coupon.go | 19 ++++++++++--------- internal/model/entity/member_info.go | 1 + 9 files changed, 28 insertions(+), 16 deletions(-) diff --git a/api/v1/coupon/coupon.go b/api/v1/coupon/coupon.go index fa36d49..1065229 100644 --- a/api/v1/coupon/coupon.go +++ b/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:"失效时间"` } diff --git a/internal/dao/internal/coupon.go b/internal/dao/internal/coupon.go index 09c0b2a..3ee02c4 100644 --- a/internal/dao/internal/coupon.go +++ b/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", diff --git a/internal/dao/internal/member_info.go b/internal/dao/internal/member_info.go index 6e3d9f5..f53b19d 100644 --- a/internal/dao/internal/member_info.go +++ b/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", diff --git a/internal/logic/coupon/coupon.go b/internal/logic/coupon/coupon.go index e131d02..8248384 100644 --- a/internal/logic/coupon/coupon.go +++ b/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() diff --git a/internal/model/do/coupon.go b/internal/model/do/coupon.go index 47254e0..41cb8d2 100644 --- a/internal/model/do/coupon.go +++ b/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 // 更新时间 diff --git a/internal/model/do/member_info.go b/internal/model/do/member_info.go index 28988d6..f5ec56f 100644 --- a/internal/model/do/member_info.go +++ b/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 diff --git a/internal/model/dto/dto_coupon.go b/internal/model/dto/dto_coupon.go index dad97df..8568ce7 100644 --- a/internal/model/dto/dto_coupon.go +++ b/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:"卡券状态"` // 卡券状态 diff --git a/internal/model/entity/coupon.go b/internal/model/entity/coupon.go index 7c90e7c..f67df4a 100644 --- a/internal/model/entity/coupon.go +++ b/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:"更新时间"` // 更新时间 } diff --git a/internal/model/entity/member_info.go b/internal/model/entity/member_info.go index 0fd0368..ac183ba 100644 --- a/internal/model/entity/member_info.go +++ b/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