Browse Source

12.25日生成service,编写查询拥有卡券的用户,删除用户卡券

mj-wq
lijikun 6 months ago
parent
commit
397071ea1a
  1. 19
      api/v1/couponusers/couponUsers.go
  2. 4
      internal/cmd/cmd.go
  3. 47
      internal/controller/couponusers/couponUsers.go
  4. 27
      internal/dao/coupon.go
  5. 27
      internal/dao/coupon_users.go
  6. 89
      internal/dao/internal/coupon.go
  7. 83
      internal/dao/internal/coupon_users.go
  8. 139
      internal/dao/internal/member_info.go
  9. 27
      internal/dao/member_info.go
  10. 113
      internal/logic/couponusers/couponUsers.go
  11. 8
      internal/logic/logic.go
  12. 24
      internal/model/do/coupon.go
  13. 20
      internal/model/do/coupon_users.go
  14. 49
      internal/model/do/member_info.go
  15. 22
      internal/model/entity/coupon.go
  16. 15
      internal/model/entity/coupon_users.go
  17. 47
      internal/model/entity/member_info.go
  18. 43
      internal/service/couponusers.go

19
api/v1/couponusers/couponUsers.go

@ -0,0 +1,19 @@
package couponusers
type GetCouponUsersReq struct {
CouponId int `json:"couponId" dc:"卡券id"`
Jwcode int `json:"jwcode" dc:"查询条件中的精网号"`
Name string `json:"name" dc:"查询条件中的名字"`
}
type GetCouponUsersRes struct {
Name string `json:"name" dc:"姓名"`
Jwcode int `json:"jwcode" dc:"精网号"`
DeptName string `json:"deptName" dc:"部门"`
ShopName string `json:"shopName" dc:"门店"`
}
type DelCouponUserByJwcodeReq struct {
CouponId int `json:"couponId" dc:"卡券id"`
Jwcode int `json:"jwcode" dc:"精网号"`
}

4
internal/cmd/cmd.go

@ -1,6 +1,7 @@
package cmd
import (
"CouponBackendGo/internal/controller/couponusers"
"context"
"github.com/gogf/gf/v2/frame/g"
@ -16,7 +17,8 @@ var (
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
s := g.Server()
s.Group("/api/coupon_backend", func(group *ghttp.RouterGroup) {
group.POST("/get-coupon-users", couponusers.NewCouponUsers().GetCouponUsers)
group.POST("delete-coupon-user", couponusers.NewCouponUsers().DeleteCouponUserByJwcode)
})
s.Run()
return nil

47
internal/controller/couponusers/couponUsers.go

@ -0,0 +1,47 @@
package couponusers
import (
"CouponBackendGo/api/v1/couponusers"
"CouponBackendGo/internal/model/dto"
"CouponBackendGo/internal/service"
"github.com/gogf/gf/v2/net/ghttp"
)
type CouponUsers struct{}
func NewCouponUsers() *CouponUsers {
return &CouponUsers{}
}
func (c *CouponUsers) GetCouponUsers(r *ghttp.Request) {
var req *couponusers.GetCouponUsersReq
if err := r.Parse(&req); err != nil {
r.Response.WriteJsonExit(dto.Error(err.Error()))
}
result, err := service.CouponUsers().GetCouponUsersByCondition(r.Context(), req.CouponId, req.Jwcode, req.Name)
if err != nil {
r.Response.WriteJsonExit(dto.Error(err.Error()))
}
if result == nil {
r.Response.WriteJsonExit(dto.Error("没有符合条件的用户"))
}
r.Response.WriteJsonExit(dto.SuccessWithData(result))
}
func (c *CouponUsers) DeleteCouponUserByJwcode(r *ghttp.Request) {
var req *couponusers.DelCouponUserByJwcodeReq
if err := r.Parse(&req); err != nil {
r.Response.WriteJsonExit(dto.Error(err.Error()))
}
result, err := service.CouponUsers().DeleteCouponUserByJwcode(r.Context(), req.CouponId, req.Jwcode)
if err != nil {
r.Response.WriteJsonExit(dto.Error(err.Error()))
}
affected, err := result.RowsAffected()
if affected == 0 {
r.Response.WriteJsonExit(dto.Error("删除失败,删除了0条"))
}
r.Response.WriteJsonExit(dto.SuccessWithMsg("删除成功"))
//r.Response.WriteJsonExit(dto.SuccessWithData(result))
}

27
internal/dao/coupon.go

@ -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.

27
internal/dao/coupon_users.go

@ -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.

89
internal/dao/internal/coupon.go

@ -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)
}

83
internal/dao/internal/coupon_users.go

@ -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)
}

139
internal/dao/internal/member_info.go

@ -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)
}

27
internal/dao/member_info.go

@ -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.

113
internal/logic/couponusers/couponUsers.go

@ -0,0 +1,113 @@
package couponusers
import (
"CouponBackendGo/api/v1/couponusers"
"CouponBackendGo/internal/dao"
"CouponBackendGo/internal/service"
"context"
"database/sql"
"encoding/json"
"errors"
"fmt"
"github.com/gogf/gf/v2/frame/g"
"strings"
)
type sCouponUsers struct{}
func init() {
service.RegisterCouponUsers(&sCouponUsers{})
}
// 根据优惠券id查看拥有优惠券的用户
func (s *sCouponUsers) GetCouponUsersByCondition(ctx context.Context, couponId, jwcode int, name string) (users []couponusers.GetCouponUsersRes, err error) {
//从redis中获取数据但不返回
value, _ := g.Redis().Get(ctx, fmt.Sprintf("%d CouponUsers", couponId))
if value.String() != "" {
err = json.Unmarshal(value.Bytes(), &users)
if err != nil {
return nil, errors.New("redis中数据解析失败")
}
} else {
/*查询所有数据*/
//在coupon_users中查询出对应的jwcode
err = dao.CouponUsers.Ctx(ctx).Fields("jwcode").
Where("coupon_id = ", couponId).Scan(&users)
if err != nil {
return nil, errors.New("根据卡券id搜索jwcode失败")
}
//根据jwcode查询用户信息
for i, userInfo := range users {
err = dao.MemberInfo.Ctx(ctx).Fields("jwcode", "name", "deptName", "shopName").
Where("jwcode = ?", userInfo.Jwcode).Scan(&users[i])
if err != nil {
return nil, errors.New("根据jwcode搜索用户信息失败")
}
}
/*查询所有数据*/
//将数据存入redis
UsersMarshal, _ := json.Marshal(users)
_, err = g.Redis().Set(ctx, fmt.Sprintf("%d CouponUsers", couponId), UsersMarshal)
if err != nil {
return nil, errors.New("将数据存入redis失败")
}
}
if jwcode != 0 && name == "" {
var result []couponusers.GetCouponUsersRes
for _, user := range users {
if user.Jwcode == jwcode {
result = append(result, user)
}
}
return result, err
} else if jwcode == 0 && name != "" {
var result []couponusers.GetCouponUsersRes
for _, user := range users {
if strings.Contains(user.Name, name) {
result = append(result, user)
}
}
return result, err
} else if jwcode != 0 && name != "" {
var result []couponusers.GetCouponUsersRes
for _, user := range users {
if user.Jwcode == jwcode && strings.Contains(user.Name, name) {
result = append(result, user)
}
}
return result, err
}
return users, err
}
// 根据jwcode,优惠券id删除用户
func (s *sCouponUsers) DeleteCouponUserByJwcode(ctx context.Context, couponId, jwcode int) (result sql.Result, err error) {
if jwcode == 0 {
return nil, errors.New("jwcode不能为空")
}
if couponId == 0 {
return nil, errors.New("couponId不能为空")
}
result, err = dao.CouponUsers.Ctx(ctx).Where("coupon_id = ?", couponId).Where("jwcode = ?", jwcode).Delete()
if err != nil {
return nil, errors.New("删除用户失败")
}
return result, err
}
// 通过excel导入精网号
func (s *sCouponUsers) InsertJwcodeByExcel(ctx context.Context) {
return
}
// 根据精网号发放用户优惠券
func (s *sCouponUsers) InsertCouponUserByJwcode(ctx context.Context) {
return
}

8
internal/logic/logic.go

@ -1 +1,9 @@
// ==========================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package logic
import (
_ "CouponBackendGo/internal/logic/couponusers"
)

24
internal/model/do/coupon.go

@ -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 //
}

20
internal/model/do/coupon_users.go

@ -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 已使用
}

49
internal/model/do/member_info.go

@ -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 //
}

22
internal/model/entity/coupon.go

@ -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:""` //
}

15
internal/model/entity/coupon_users.go

@ -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 string `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 已使用
}

47
internal/model/entity/member_info.go

@ -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:""` //
}

43
internal/service/couponusers.go

@ -0,0 +1,43 @@
// ================================================================================
// 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/api/v1/couponusers"
"context"
"database/sql"
)
type (
ICouponUsers interface {
// 根据优惠券id查看拥有优惠券的用户
GetCouponUsersByCondition(ctx context.Context, couponId int, jwcode int, name string) (users []couponusers.GetCouponUsersRes, err error)
// 根据jwcode,优惠券id删除用户
DeleteCouponUserByJwcode(ctx context.Context, couponId int, jwcode int) (result sql.Result, err error)
// 通过excel导入精网号
InsertJwcodeByExcel(ctx context.Context)
// 根据精网号发放用户优惠券
InsertCouponUserByJwcode(ctx context.Context)
// 原来的(不全)
// 根据优惠券id查看拥有优惠券的用户
GetCouponUsersByCondition1(ctx context.Context, couponId int, jwcode int, name string) (users []couponusers.GetCouponUsersRes, err error)
}
)
var (
localCouponUsers ICouponUsers
)
func CouponUsers() ICouponUsers {
if localCouponUsers == nil {
panic("implement not found for interface ICouponUsers, forgot register?")
}
return localCouponUsers
}
func RegisterCouponUsers(i ICouponUsers) {
localCouponUsers = i
}
Loading…
Cancel
Save