27 changed files with 755 additions and 1 deletions
-
0api/v1/.gitkeep
-
10api/v1/coupon/coupon.go
-
4internal/cmd/cmd.go
-
0internal/controller/.gitkeep
-
63internal/controller/coupon/coupon.go
-
0internal/dao/.gitkeep
-
27internal/dao/coupon.go
-
27internal/dao/coupon_users.go
-
89internal/dao/internal/coupon.go
-
83internal/dao/internal/coupon_users.go
-
139internal/dao/internal/member_info.go
-
27internal/dao/member_info.go
-
0internal/logic/.gitkeep
-
53internal/logic/coupon/coupon.go
-
8internal/logic/logic.go
-
0internal/model/.gitkeep
-
0internal/model/do/.gitkeep
-
24internal/model/do/coupon.go
-
20internal/model/do/coupon_users.go
-
49internal/model/do/member_info.go
-
15internal/model/dto/dto_coupon.go
-
0internal/model/entity/.gitkeep
-
22internal/model/entity/coupon.go
-
15internal/model/entity/coupon_users.go
-
47internal/model/entity/member_info.go
-
0internal/service/.gitkeep
-
34internal/service/coupon.go
@ -0,0 +1,10 @@ |
|||||
|
package coupon |
||||
|
|
||||
|
type GetCouponListReq struct { |
||||
|
PageNo int `v:"required#页码不能为空" dc:"页码"` |
||||
|
PageSize int `v:"required#页面大小不能为空" dc:"页面大小"` |
||||
|
} |
||||
|
|
||||
|
type GetCouponReq struct { |
||||
|
Id int `json:"id" v:"required#优惠券id不能为空" dc:"优惠券id"` |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package coupon |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/api/v1/coupon" |
||||
|
"CouponBackendGo/internal/model/dto" |
||||
|
"CouponBackendGo/internal/service" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
"github.com/gogf/gf/v2/net/ghttp" |
||||
|
) |
||||
|
|
||||
|
type cCoupon struct{} |
||||
|
|
||||
|
func Coupon() *cCoupon { |
||||
|
return &cCoupon{} |
||||
|
} |
||||
|
|
||||
|
func (c cCoupon) GetCouponList(r *ghttp.Request) { |
||||
|
var req *coupon.GetCouponListReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
res, err := service.Coupon().GetCouponList(r.Context(), req.PageNo, req.PageSize) |
||||
|
total, err := service.Coupon().GetCouponListTotal(r.Context()) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: g.Map{ |
||||
|
"list": res, |
||||
|
"total": total, |
||||
|
}, |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
func (c cCoupon) GetCoupon(r *ghttp.Request) { |
||||
|
var req *coupon.GetCouponReq |
||||
|
if err := r.Parse(&req); err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
res, err := service.Coupon().GetCoupon(r.Context(), req.Id) |
||||
|
if err != nil { |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 400, |
||||
|
Message: err.Error(), |
||||
|
}) |
||||
|
} |
||||
|
r.Response.WriteJsonExit(dto.Result{ |
||||
|
Code: 200, |
||||
|
Message: "success", |
||||
|
Data: res, |
||||
|
}) |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalCouponDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalCouponDao = *internal.CouponDao |
||||
|
|
||||
|
// couponDao is the data access object for table coupon.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type couponDao struct { |
||||
|
internalCouponDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// Coupon is globally public accessible object for table coupon operations.
|
||||
|
Coupon = couponDao{ |
||||
|
internal.NewCouponDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalCouponUsersDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalCouponUsersDao = *internal.CouponUsersDao |
||||
|
|
||||
|
// couponUsersDao is the data access object for table coupon_users.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type couponUsersDao struct { |
||||
|
internalCouponUsersDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// CouponUsers is globally public accessible object for table coupon_users operations.
|
||||
|
CouponUsers = couponUsersDao{ |
||||
|
internal.NewCouponUsersDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,89 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
package internal |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/database/gdb" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// CouponDao is the data access object for table coupon.
|
||||
|
type CouponDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns CouponColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// CouponColumns defines and stores column names for table coupon.
|
||||
|
type CouponColumns struct { |
||||
|
Id string //
|
||||
|
Title string // 名字
|
||||
|
Cover string // 封面小图片
|
||||
|
ImgUrl string // 放大看全图
|
||||
|
StartTime string // 有效期起始
|
||||
|
EndTime string // 有效期截止
|
||||
|
Deleted string // 是否删除?
|
||||
|
CreatedAt string // 创建时间
|
||||
|
UpdatedAt string // 更新时间
|
||||
|
} |
||||
|
|
||||
|
// couponColumns holds the columns for table coupon.
|
||||
|
var couponColumns = CouponColumns{ |
||||
|
Id: "id", |
||||
|
Title: "title", |
||||
|
Cover: "cover", |
||||
|
ImgUrl: "img_url", |
||||
|
StartTime: "start_time", |
||||
|
EndTime: "end_time", |
||||
|
Deleted: "deleted", |
||||
|
CreatedAt: "created_at", |
||||
|
UpdatedAt: "updated_at", |
||||
|
} |
||||
|
|
||||
|
// NewCouponDao creates and returns a new DAO object for table data access.
|
||||
|
func NewCouponDao() *CouponDao { |
||||
|
return &CouponDao{ |
||||
|
group: "default", |
||||
|
table: "coupon", |
||||
|
columns: couponColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *CouponDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *CouponDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *CouponDao) Columns() CouponColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *CouponDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *CouponDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *CouponDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -0,0 +1,83 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
package internal |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/database/gdb" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// CouponUsersDao is the data access object for table coupon_users.
|
||||
|
type CouponUsersDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns CouponUsersColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// CouponUsersColumns defines and stores column names for table coupon_users.
|
||||
|
type CouponUsersColumns struct { |
||||
|
Id string //
|
||||
|
Jwcode string //
|
||||
|
Time string // 领取时间
|
||||
|
CouponId string // 优惠券id
|
||||
|
Code string //
|
||||
|
State string // 0 未使用 1 已使用
|
||||
|
} |
||||
|
|
||||
|
// couponUsersColumns holds the columns for table coupon_users.
|
||||
|
var couponUsersColumns = CouponUsersColumns{ |
||||
|
Id: "id", |
||||
|
Jwcode: "jwcode", |
||||
|
Time: "time", |
||||
|
CouponId: "coupon_id", |
||||
|
Code: "code", |
||||
|
State: "state", |
||||
|
} |
||||
|
|
||||
|
// NewCouponUsersDao creates and returns a new DAO object for table data access.
|
||||
|
func NewCouponUsersDao() *CouponUsersDao { |
||||
|
return &CouponUsersDao{ |
||||
|
group: "default", |
||||
|
table: "coupon_users", |
||||
|
columns: couponUsersColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *CouponUsersDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *CouponUsersDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *CouponUsersDao) Columns() CouponUsersColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *CouponUsersDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *CouponUsersDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *CouponUsersDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -0,0 +1,139 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
package internal |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/database/gdb" |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// MemberInfoDao is the data access object for table member_info.
|
||||
|
type MemberInfoDao struct { |
||||
|
table string // table is the underlying table name of the DAO.
|
||||
|
group string // group is the database configuration group name of current DAO.
|
||||
|
columns MemberInfoColumns // columns contains all the column names of Table for convenient usage.
|
||||
|
} |
||||
|
|
||||
|
// MemberInfoColumns defines and stores column names for table member_info.
|
||||
|
type MemberInfoColumns struct { |
||||
|
Id string //
|
||||
|
Jwcode string //
|
||||
|
Name string //
|
||||
|
Sex string // 0:未知,1:男,2:女
|
||||
|
Avatar string // 用户头像
|
||||
|
Widget string // 头像挂件
|
||||
|
DeptId string //
|
||||
|
DeptName string //
|
||||
|
ShopId string //
|
||||
|
ShopName string //
|
||||
|
MembershipTime string //
|
||||
|
LiveLock string // 0:解锁 1:锁住
|
||||
|
LocMarket string // 用户市场归属
|
||||
|
Level string // 等级
|
||||
|
LevelIcon string // 等级图标
|
||||
|
Star string // 星级
|
||||
|
AccountOwner string //
|
||||
|
AccountOwnerText string //
|
||||
|
Employee string // 1:员工
|
||||
|
Dachang string // 0:不是大厂员工 1:是大厂员工
|
||||
|
BoguMember string // 1:博股会员
|
||||
|
LearningIcon string // 学习等级icon
|
||||
|
Mobile string // 手机号
|
||||
|
UserIdentity string // 0:无认证 1:红V 2:蓝V 3:黄V
|
||||
|
UserIdentityTitle string // 用户身份头衔
|
||||
|
Openid string // 微信openid
|
||||
|
UserRole string // 用户身份(1:网员 2:非网)
|
||||
|
IsBlacklist string // 是否是黑名单用户
|
||||
|
IsLecturer string // 讲师
|
||||
|
Shenqiangshou string // 神枪手
|
||||
|
Huanqiu string // 环球
|
||||
|
Age string // 年纪
|
||||
|
CreatedAt string //
|
||||
|
UpdatedAt string //
|
||||
|
} |
||||
|
|
||||
|
// memberInfoColumns holds the columns for table member_info.
|
||||
|
var memberInfoColumns = MemberInfoColumns{ |
||||
|
Id: "id", |
||||
|
Jwcode: "jwcode", |
||||
|
Name: "name", |
||||
|
Sex: "sex", |
||||
|
Avatar: "avatar", |
||||
|
Widget: "widget", |
||||
|
DeptId: "deptId", |
||||
|
DeptName: "deptName", |
||||
|
ShopId: "shopId", |
||||
|
ShopName: "shopName", |
||||
|
MembershipTime: "membership_time", |
||||
|
LiveLock: "live_lock", |
||||
|
LocMarket: "loc_market", |
||||
|
Level: "level", |
||||
|
LevelIcon: "level_icon", |
||||
|
Star: "star", |
||||
|
AccountOwner: "account_owner", |
||||
|
AccountOwnerText: "account_owner_text", |
||||
|
Employee: "employee", |
||||
|
Dachang: "dachang", |
||||
|
BoguMember: "bogu_member", |
||||
|
LearningIcon: "learning_icon", |
||||
|
Mobile: "mobile", |
||||
|
UserIdentity: "user_identity", |
||||
|
UserIdentityTitle: "user_identity_title", |
||||
|
Openid: "openid", |
||||
|
UserRole: "user_role", |
||||
|
IsBlacklist: "is_blacklist", |
||||
|
IsLecturer: "is_lecturer", |
||||
|
Shenqiangshou: "shenqiangshou", |
||||
|
Huanqiu: "huanqiu", |
||||
|
Age: "age", |
||||
|
CreatedAt: "created_at", |
||||
|
UpdatedAt: "updated_at", |
||||
|
} |
||||
|
|
||||
|
// NewMemberInfoDao creates and returns a new DAO object for table data access.
|
||||
|
func NewMemberInfoDao() *MemberInfoDao { |
||||
|
return &MemberInfoDao{ |
||||
|
group: "default", |
||||
|
table: "member_info", |
||||
|
columns: memberInfoColumns, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
|
func (dao *MemberInfoDao) DB() gdb.DB { |
||||
|
return g.DB(dao.group) |
||||
|
} |
||||
|
|
||||
|
// Table returns the table name of current dao.
|
||||
|
func (dao *MemberInfoDao) Table() string { |
||||
|
return dao.table |
||||
|
} |
||||
|
|
||||
|
// Columns returns all column names of current dao.
|
||||
|
func (dao *MemberInfoDao) Columns() MemberInfoColumns { |
||||
|
return dao.columns |
||||
|
} |
||||
|
|
||||
|
// Group returns the configuration group name of database of current dao.
|
||||
|
func (dao *MemberInfoDao) Group() string { |
||||
|
return dao.group |
||||
|
} |
||||
|
|
||||
|
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
|
func (dao *MemberInfoDao) Ctx(ctx context.Context) *gdb.Model { |
||||
|
return dao.DB().Model(dao.table).Safe().Ctx(ctx) |
||||
|
} |
||||
|
|
||||
|
// Transaction wraps the transaction logic using function f.
|
||||
|
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
|
// It commits the transaction and returns nil if function f returns nil.
|
||||
|
//
|
||||
|
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
|
// as it is automatically handled by this function.
|
||||
|
func (dao *MemberInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { |
||||
|
return dao.Ctx(ctx).Transaction(ctx, f) |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package dao |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/internal/dao/internal" |
||||
|
) |
||||
|
|
||||
|
// internalMemberInfoDao is internal type for wrapping internal DAO implements.
|
||||
|
type internalMemberInfoDao = *internal.MemberInfoDao |
||||
|
|
||||
|
// memberInfoDao is the data access object for table member_info.
|
||||
|
// You can define custom methods on it to extend its functionality as you wish.
|
||||
|
type memberInfoDao struct { |
||||
|
internalMemberInfoDao |
||||
|
} |
||||
|
|
||||
|
var ( |
||||
|
// MemberInfo is globally public accessible object for table member_info operations.
|
||||
|
MemberInfo = memberInfoDao{ |
||||
|
internal.NewMemberInfoDao(), |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
// Fill with you ideas below.
|
@ -0,0 +1,53 @@ |
|||||
|
package coupon |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/internal/dao" |
||||
|
"CouponBackendGo/internal/model/dto" |
||||
|
"CouponBackendGo/internal/service" |
||||
|
"context" |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
type ( |
||||
|
sCoupon struct{} |
||||
|
) |
||||
|
|
||||
|
func init() { |
||||
|
service.RegisterCoupon(New()) |
||||
|
} |
||||
|
|
||||
|
func New() service.ICoupon { |
||||
|
return &sCoupon{} |
||||
|
} |
||||
|
|
||||
|
func (s *sCoupon) GetCouponList(ctx context.Context, pageNo int, pageSize int) (couponList []*dto.DtoCoupon, err error) { |
||||
|
err = dao.Coupon.Ctx(ctx).Where("deleted", 0).Order("updated_at desc, end_time desc").Page(pageNo, pageSize).Scan(&couponList) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
func (s *sCoupon) GetCouponListTotal(ctx context.Context) (total int, err error) { |
||||
|
total, err = dao.Coupon.Ctx(ctx).Where("deleted", 0).Count() |
||||
|
if err != nil { |
||||
|
return 0, err |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
func (s *sCoupon) GetCoupon(ctx context.Context, id int) (coupon *dto.DtoCoupon, err error) { |
||||
|
err = dao.Coupon.Ctx(ctx).WherePri(id).Scan(&coupon) |
||||
|
coupon.Status = 0 //待使用期
|
||||
|
if coupon.StartTime.Unix() <= gtime.Now().Unix() { |
||||
|
if coupon.EndTime.Unix() <= gtime.Now().Unix() { |
||||
|
coupon.Status = 2 //使用期后
|
||||
|
} else { |
||||
|
coupon.Status = 1 //使用期中
|
||||
|
} |
||||
|
} |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
return |
||||
|
} |
@ -1 +1,9 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
package logic |
package logic |
||||
|
|
||||
|
import ( |
||||
|
_ "CouponBackendGo/internal/logic/coupon" |
||||
|
) |
@ -0,0 +1,24 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
// Coupon is the golang structure of table coupon for DAO operations like Where/Data.
|
||||
|
type Coupon struct { |
||||
|
g.Meta `orm:"table:coupon, do:true"` |
||||
|
Id interface{} //
|
||||
|
Title interface{} // 名字
|
||||
|
Cover interface{} // 封面小图片
|
||||
|
ImgUrl interface{} // 放大看全图
|
||||
|
StartTime interface{} // 有效期起始
|
||||
|
EndTime interface{} // 有效期截止
|
||||
|
Deleted interface{} // 是否删除?
|
||||
|
CreatedAt *gtime.Time // 创建时间
|
||||
|
UpdatedAt *gtime.Time // 更新时间
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
) |
||||
|
|
||||
|
// CouponUsers is the golang structure of table coupon_users for DAO operations like Where/Data.
|
||||
|
type CouponUsers struct { |
||||
|
g.Meta `orm:"table:coupon_users, do:true"` |
||||
|
Id interface{} //
|
||||
|
Jwcode interface{} //
|
||||
|
Time interface{} // 领取时间
|
||||
|
CouponId interface{} // 优惠券id
|
||||
|
Code interface{} //
|
||||
|
State interface{} // 0 未使用 1 已使用
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package do |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
// MemberInfo is the golang structure of table member_info for DAO operations like Where/Data.
|
||||
|
type MemberInfo struct { |
||||
|
g.Meta `orm:"table:member_info, do:true"` |
||||
|
Id interface{} //
|
||||
|
Jwcode interface{} //
|
||||
|
Name interface{} //
|
||||
|
Sex interface{} // 0:未知,1:男,2:女
|
||||
|
Avatar interface{} // 用户头像
|
||||
|
Widget interface{} // 头像挂件
|
||||
|
DeptId interface{} //
|
||||
|
DeptName interface{} //
|
||||
|
ShopId interface{} //
|
||||
|
ShopName interface{} //
|
||||
|
MembershipTime *gtime.Time //
|
||||
|
LiveLock interface{} // 0:解锁 1:锁住
|
||||
|
LocMarket interface{} // 用户市场归属
|
||||
|
Level interface{} // 等级
|
||||
|
LevelIcon interface{} // 等级图标
|
||||
|
Star interface{} // 星级
|
||||
|
AccountOwner interface{} //
|
||||
|
AccountOwnerText interface{} //
|
||||
|
Employee interface{} // 1:员工
|
||||
|
Dachang interface{} // 0:不是大厂员工 1:是大厂员工
|
||||
|
BoguMember interface{} // 1:博股会员
|
||||
|
LearningIcon interface{} // 学习等级icon
|
||||
|
Mobile interface{} // 手机号
|
||||
|
UserIdentity interface{} // 0:无认证 1:红V 2:蓝V 3:黄V
|
||||
|
UserIdentityTitle interface{} // 用户身份头衔
|
||||
|
Openid interface{} // 微信openid
|
||||
|
UserRole interface{} // 用户身份(1:网员 2:非网)
|
||||
|
IsBlacklist interface{} // 是否是黑名单用户
|
||||
|
IsLecturer interface{} // 讲师
|
||||
|
Shenqiangshou interface{} // 神枪手
|
||||
|
Huanqiu interface{} // 环球
|
||||
|
Age interface{} // 年纪
|
||||
|
CreatedAt *gtime.Time //
|
||||
|
UpdatedAt *gtime.Time //
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package dto |
||||
|
|
||||
|
import "github.com/gogf/gf/v2/os/gtime" |
||||
|
|
||||
|
type DtoCoupon struct { |
||||
|
Id uint `json:"id" orm:"db:default;table:coupon;column:id" description:"ID"` // ID
|
||||
|
Title string `json:"title" orm:"db:default;table:coupon;column:title" description:"名字"` // 名字
|
||||
|
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:"更新时间"` // 更新时间
|
||||
|
StartTime *gtime.Time `json:"startTime" description:"有效期起始"` // 有效期起始
|
||||
|
EndTime *gtime.Time `json:"endTime" description:"有效期截止"` // 有效期截止
|
||||
|
Status int `json:"status" description:"卡券状态"` // 卡券状态
|
||||
|
Count int `json:"count" description:"持有人数"` // 持有人数
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
// 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:"更新时间"` // 更新时间
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
// CouponUsers is the golang structure for table coupon_users.
|
||||
|
type CouponUsers struct { |
||||
|
Id uint `json:"id" orm:"id" description:""` //
|
||||
|
Jwcode int `json:"jwcode" orm:"jwcode" description:""` //
|
||||
|
Time int `json:"time" orm:"time" description:"领取时间"` // 领取时间
|
||||
|
CouponId int `json:"couponId" orm:"coupon_id" description:"优惠券id"` // 优惠券id
|
||||
|
Code string `json:"code" orm:"code" description:""` //
|
||||
|
State int `json:"state" orm:"state" description:"0 未使用 1 已使用"` // 0 未使用 1 已使用
|
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package entity |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/os/gtime" |
||||
|
) |
||||
|
|
||||
|
// MemberInfo is the golang structure for table member_info.
|
||||
|
type MemberInfo struct { |
||||
|
Id int `json:"id" orm:"id" description:""` //
|
||||
|
Jwcode int `json:"jwcode" orm:"jwcode" description:""` //
|
||||
|
Name string `json:"name" orm:"name" description:""` //
|
||||
|
Sex int `json:"sex" orm:"sex" description:"0:未知,1:男,2:女"` // 0:未知,1:男,2:女
|
||||
|
Avatar string `json:"avatar" orm:"avatar" description:"用户头像"` // 用户头像
|
||||
|
Widget string `json:"widget" orm:"widget" description:"头像挂件"` // 头像挂件
|
||||
|
DeptId string `json:"deptId" orm:"deptId" description:""` //
|
||||
|
DeptName string `json:"deptName" orm:"deptName" description:""` //
|
||||
|
ShopId string `json:"shopId" orm:"shopId" description:""` //
|
||||
|
ShopName string `json:"shopName" orm:"shopName" description:""` //
|
||||
|
MembershipTime *gtime.Time `json:"membershipTime" orm:"membership_time" description:""` //
|
||||
|
LiveLock int `json:"liveLock" orm:"live_lock" description:"0:解锁 1:锁住"` // 0:解锁 1:锁住
|
||||
|
LocMarket string `json:"locMarket" orm:"loc_market" description:"用户市场归属"` // 用户市场归属
|
||||
|
Level int `json:"level" orm:"level" description:"等级"` // 等级
|
||||
|
LevelIcon string `json:"levelIcon" orm:"level_icon" description:"等级图标"` // 等级图标
|
||||
|
Star int `json:"star" orm:"star" description:"星级"` // 星级
|
||||
|
AccountOwner string `json:"accountOwner" orm:"account_owner" description:""` //
|
||||
|
AccountOwnerText string `json:"accountOwnerText" orm:"account_owner_text" description:""` //
|
||||
|
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:博股会员
|
||||
|
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
|
||||
|
UserIdentityTitle string `json:"userIdentityTitle" orm:"user_identity_title" description:"用户身份头衔"` // 用户身份头衔
|
||||
|
Openid string `json:"openid" orm:"openid" description:"微信openid"` // 微信openid
|
||||
|
UserRole int `json:"userRole" orm:"user_role" description:"用户身份(1:网员 2:非网)"` // 用户身份(1:网员 2:非网)
|
||||
|
IsBlacklist int `json:"isBlacklist" orm:"is_blacklist" description:"是否是黑名单用户"` // 是否是黑名单用户
|
||||
|
IsLecturer int `json:"isLecturer" orm:"is_lecturer" description:"讲师"` // 讲师
|
||||
|
Shenqiangshou int `json:"shenqiangshou" orm:"shenqiangshou" description:"神枪手"` // 神枪手
|
||||
|
Huanqiu int `json:"huanqiu" orm:"huanqiu" description:"环球"` // 环球
|
||||
|
Age uint `json:"age" orm:"age" description:"年纪"` // 年纪
|
||||
|
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:""` //
|
||||
|
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:""` //
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
// ================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// You can delete these comments if you wish manually maintain this interface file.
|
||||
|
// ================================================================================
|
||||
|
|
||||
|
package service |
||||
|
|
||||
|
import ( |
||||
|
"CouponBackendGo/internal/model/dto" |
||||
|
"context" |
||||
|
) |
||||
|
|
||||
|
type ( |
||||
|
ICoupon interface { |
||||
|
GetCouponList(ctx context.Context, pageNo int, pageSize int) (couponList []*dto.DtoCoupon, err error) |
||||
|
GetCouponListTotal(ctx context.Context) (total int, err error) |
||||
|
GetCoupon(ctx context.Context, id int) (coupon *dto.DtoCoupon, err error) |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
var ( |
||||
|
localCoupon ICoupon |
||||
|
) |
||||
|
|
||||
|
func Coupon() ICoupon { |
||||
|
if localCoupon == nil { |
||||
|
panic("implement not found for interface ICoupon, forgot register?") |
||||
|
} |
||||
|
return localCoupon |
||||
|
} |
||||
|
|
||||
|
func RegisterCoupon(i ICoupon) { |
||||
|
localCoupon = i |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue