调整表结构

This commit is contained in:
2025-06-05 14:58:58 +08:00
parent fdf5152bd2
commit 77067adf33
83 changed files with 137 additions and 2662 deletions

View File

@ -1,19 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package menu
import (
"context"
"server/api/menu/v1"
)
type IMenuV1 interface {
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error)
}

View File

@ -1,78 +0,0 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
// ListReq 获取菜单列表请求
type ListReq struct {
g.Meta `path:"/menu" method:"get" tags:"Menu" summary:"(系统管理员)获取菜单列表"`
Page int `json:"page" dc:"页数"`
Size int `json:"size" dc:"每页数量"`
Status int `json:"status" dc:"状态1=启用2=禁用"`
}
// ListRes 获取菜单列表响应
type ListRes struct {
List interface{} `json:"list" dc:"菜单列表"`
Total int `json:"total" dc:"总数"`
}
// CreateReq 创建菜单请求
type CreateReq struct {
g.Meta `path:"/menu" method:"post" tags:"Menu" summary:"(系统管理员)创建菜单"`
Name string `json:"name" v:"required" dc:"菜单名称"`
ParentId int64 `json:"parent_id" dc:"父级菜单ID"`
Path string `json:"path" v:"required" dc:"前端路由路径"`
Component string `json:"component" dc:"前端组件路径"`
Type int `json:"type" v:"required" dc:"类型1=目录2=菜单"`
Icon string `json:"icon" dc:"图标"`
Sort int `json:"sort" dc:"排序"`
Hidden bool `json:"hidden" dc:"是否隐藏0=显示1=隐藏"`
Status int `json:"status" v:"required" dc:"状态1=启用2=禁用"`
}
// CreateRes 创建菜单响应
type CreateRes struct {
Id int64 `json:"id" dc:"菜单ID"`
}
// UpdateReq 更新菜单请求
type UpdateReq struct {
g.Meta `path:"/menu" method:"put" tags:"Menu" summary:"(系统管理员)更新菜单"`
Id int64 `json:"id" v:"required" dc:"菜单ID"`
Name string `json:"name" v:"required" dc:"菜单名称"`
ParentId int64 `json:"parent_id" dc:"父级菜单ID"`
Path string `json:"path" v:"required" dc:"前端路由路径"`
Component string `json:"component" dc:"前端组件路径"`
Type int `json:"type" v:"required" dc:"类型1=目录2=菜单"`
Icon string `json:"icon" dc:"图标"`
Sort int `json:"sort" dc:"排序"`
Hidden bool `json:"hidden" dc:"是否隐藏0=显示1=隐藏"`
Status int `json:"status" v:"required" dc:"状态1=启用2=禁用"`
}
// UpdateRes 更新菜单响应
type UpdateRes struct {
Success bool `json:"success" dc:"是否成功"`
}
// DeleteReq 删除菜单请求
type DeleteReq struct {
g.Meta `path:"/menu/{id}" method:"delete" tags:"Menu" summary:"(系统管理员)删除菜单"`
Id int64 `json:"id" v:"required" dc:"菜单ID"`
}
// DeleteRes 删除菜单响应
type DeleteRes struct {
Success bool `json:"success" dc:"是否成功"`
}
// BatchDeleteReq 批量删除菜单请求
type BatchDeleteReq struct {
g.Meta `path:"/menu" method:"delete" tags:"Menu" summary:"(系统管理员)批量删除菜单"`
Ids []int `json:"ids" v:"required" dc:"菜单ID列表"`
}
// BatchDeleteRes 批量删除菜单响应
type BatchDeleteRes struct {
Ids []int `json:"ids" dc:"返回未删除的 id 数组"`
}

View File

@ -15,5 +15,4 @@ type IStoreV1 interface {
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error)
} }

View File

@ -42,7 +42,3 @@ type DeleteReq struct {
type DeleteRes struct { type DeleteRes struct {
Success bool `json:"success" dc:"是否成功"` Success bool `json:"success" dc:"是否成功"`
} }
type BatchDeleteReq struct {
g.Meta `path:"/store/batch" method:"delete" tags:"Store" summary:"(商户管理员)批量删除门店"`
Ids []int `json:"ids" v:"required" dc:"门店ID"`
}

1
go.mod
View File

@ -4,6 +4,7 @@ go 1.24.2
require ( require (
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/bwmarrin/snowflake v0.3.0
github.com/casbin/casbin/v2 v2.105.0 github.com/casbin/casbin/v2 v2.105.0
github.com/go-resty/resty/v2 v2.16.5 github.com/go-resty/resty/v2 v2.16.5
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0

2
go.sum
View File

@ -8,6 +8,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
github.com/casbin/casbin/v2 v2.105.0 h1:dLj5P6pLApBRat9SADGiLxLZjiDPvA1bsPkyV4PGx6I= github.com/casbin/casbin/v2 v2.105.0 h1:dLj5P6pLApBRat9SADGiLxLZjiDPvA1bsPkyV4PGx6I=
github.com/casbin/casbin/v2 v2.105.0/go.mod h1:Ee33aqGrmES+GNL17L0h9X28wXuo829wnNUnS0edAco= github.com/casbin/casbin/v2 v2.105.0/go.mod h1:Ee33aqGrmES+GNL17L0h9X28wXuo829wnNUnS0edAco=
github.com/casbin/govaluate v1.3.0 h1:VA0eSY0M2lA86dYd5kPPuNZMUD9QkWnOCnavGrw9myc= github.com/casbin/govaluate v1.3.0 h1:VA0eSY0M2lA86dYd5kPPuNZMUD9QkWnOCnavGrw9myc=

View File

@ -7,7 +7,6 @@ import (
"github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gcmd"
"server/internal/controller/admin" "server/internal/controller/admin"
"server/internal/controller/auth" "server/internal/controller/auth"
"server/internal/controller/menu"
"server/internal/controller/merchant" "server/internal/controller/merchant"
"server/internal/controller/rewardType" "server/internal/controller/rewardType"
"server/internal/controller/role" "server/internal/controller/role"
@ -35,7 +34,6 @@ var (
group.Bind( group.Bind(
admin.NewV1(), admin.NewV1(),
role.NewV1(), role.NewV1(),
menu.NewV1(),
merchant.NewV1(), merchant.NewV1(),
rewardType.NewV1(), rewardType.NewV1(),
) )

View File

@ -1,5 +0,0 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package menu

View File

@ -1,15 +0,0 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package menu
import (
"server/api/menu"
)
type ControllerV1 struct{}
func NewV1() menu.IMenuV1 {
return &ControllerV1{}
}

View File

@ -1,17 +0,0 @@
package menu
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/menu/v1"
)
func (c *ControllerV1) BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) {
out, err := service.Menu().BatchDelete(ctx, &model.BatchDeleteIn{Ids: req.Ids})
if err != nil {
return nil, err
}
return &v1.BatchDeleteRes{Ids: out.Ids}, nil
}

View File

@ -1,29 +0,0 @@
package menu
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/menu/v1"
)
func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) {
out, err := service.Menu().Create(ctx, &model.MenuCreateInput{
Component: req.Component,
Hidden: req.Hidden,
Icon: req.Icon,
Name: req.Name,
ParentId: req.ParentId,
Path: req.Path,
Sort: req.Sort,
Status: req.Status,
Type: req.Type,
})
if err != nil {
return nil, err
}
return &v1.CreateRes{
Id: out.Id,
}, nil
}

View File

@ -1,17 +0,0 @@
package menu
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/menu/v1"
)
func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) {
out, err := service.Menu().Delete(ctx, &model.MenuDeleteInput{Id: req.Id})
if err != nil {
return nil, err
}
return &v1.DeleteRes{Success: out.Success}, nil
}

View File

@ -1,20 +0,0 @@
package menu
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/menu/v1"
)
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
out, err := service.Menu().List(ctx, &model.MenuListInput{Page: req.Page, Size: req.Size, Status: req.Status})
if err != nil {
return nil, err
}
return &v1.ListRes{
List: out.List,
Total: out.Total,
}, nil
}

View File

@ -1,30 +0,0 @@
package menu
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/menu/v1"
)
func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) {
out, err := service.Menu().Update(ctx, &model.MenuUpdateInput{
Id: req.Id,
Component: req.Component,
Hidden: req.Hidden,
Icon: req.Icon,
Name: req.Name,
ParentId: req.ParentId,
Path: req.Path,
Sort: req.Sort,
Status: req.Status,
Type: req.Type,
})
if err != nil {
return nil, err
}
return &v1.UpdateRes{
Success: out.Success,
}, nil
}

View File

@ -1,14 +0,0 @@
package store
import (
"context"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"server/api/store/v1"
)
func (c *ControllerV1) BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}

View File

@ -2,13 +2,19 @@ package store
import ( import (
"context" "context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"server/api/store/v1" "server/api/store/v1"
"server/internal/model"
"server/internal/service"
) )
func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) { func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented) fromCtx := g.RequestFromCtx(ctx)
operatorId := fromCtx.GetCtxVar("id").Int64()
operatorRole := fromCtx.GetCtxVar("role").String()
out, err := service.Store().Create(ctx, &model.StoreCreateIn{OperatorId: operatorId, OperatorRole: operatorRole, Name: req.Name})
if err != nil {
return nil, err
}
return &v1.CreateRes{Id: out.Id}, nil
} }

View File

@ -2,13 +2,19 @@ package store
import ( import (
"context" "context"
"github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"server/internal/model"
"server/internal/service"
"server/api/store/v1" "server/api/store/v1"
) )
func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) { func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) {
fromCtx := g.RequestFromCtx(ctx)
operatorId := fromCtx.GetCtxVar("id").Int()
OperatorRole := fromCtx.GetCtxVar("role").String()
_, err = service.Store().Delete(ctx, &model.StoreDeleteIn{Id: req.Id, OperatorId: operatorId, OperatorRole: OperatorRole})
return nil, gerror.NewCode(gcode.CodeNotImplemented) return nil, gerror.NewCode(gcode.CodeNotImplemented)
} }

View File

@ -2,13 +2,20 @@ package store
import ( import (
"context" "context"
"server/internal/model"
"github.com/gogf/gf/v2/errors/gcode" "server/internal/service"
"github.com/gogf/gf/v2/errors/gerror"
"server/api/store/v1" "server/api/store/v1"
) )
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) { func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented) out, err := service.Store().List(ctx, &model.StoreListIn{MerchantId: req.MerchantId, Page: req.Page, Size: req.Size})
if err != nil {
return nil, err
}
return &v1.ListRes{
List: out.List,
Total: out.Total,
}, nil
} }

View File

@ -2,13 +2,20 @@ package store
import ( import (
"context" "context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/errors/gcode" "server/internal/model"
"github.com/gogf/gf/v2/errors/gerror" "server/internal/service"
"server/api/store/v1" "server/api/store/v1"
) )
func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) { func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented) fromCtx := g.RequestFromCtx(ctx)
operatorId := fromCtx.Get("id").Int64()
operatorRole := fromCtx.Get("role").String()
out, err := service.Store().Update(ctx, &model.StoreUpdateIn{OperatorRole: operatorRole, OperatorId: operatorId})
if err != nil {
return nil, err
}
return &v1.UpdateRes{Success: out.Success}, nil
} }

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalCompetitionAwardsDao is an internal type for wrapping the internal DAO implementation.
type internalCompetitionAwardsDao = *internal.CompetitionAwardsDao
// competitionAwardsDao is the data access object for the table competition_awards.
// You can define custom methods on it to extend its functionality as needed.
type competitionAwardsDao struct {
internalCompetitionAwardsDao
}
var (
// CompetitionAwards is a globally accessible object for table competition_awards operations.
CompetitionAwards = competitionAwardsDao{
internal.NewCompetitionAwardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalCompetitionParticipantsDao is an internal type for wrapping the internal DAO implementation.
type internalCompetitionParticipantsDao = *internal.CompetitionParticipantsDao
// competitionParticipantsDao is the data access object for the table competition_participants.
// You can define custom methods on it to extend its functionality as needed.
type competitionParticipantsDao struct {
internalCompetitionParticipantsDao
}
var (
// CompetitionParticipants is a globally accessible object for table competition_participants operations.
CompetitionParticipants = competitionParticipantsDao{
internal.NewCompetitionParticipantsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalCompetitionsDao is an internal type for wrapping the internal DAO implementation.
type internalCompetitionsDao = *internal.CompetitionsDao
// competitionsDao is the data access object for the table competitions.
// You can define custom methods on it to extend its functionality as needed.
type competitionsDao struct {
internalCompetitionsDao
}
var (
// Competitions is a globally accessible object for table competitions operations.
Competitions = competitionsDao{
internal.NewCompetitionsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,93 +0,0 @@
// ==========================================================================
// 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"
)
// CompetitionAwardsDao is the data access object for the table competition_awards.
type CompetitionAwardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns CompetitionAwardsColumns // columns contains all the column names of Table for convenient usage.
}
// CompetitionAwardsColumns defines and stores column names for the table competition_awards.
type CompetitionAwardsColumns struct {
Id string // 赛事获奖ID
CompetitionId string // 赛事ID
UserId string // 获奖用户ID
AwardRank string // 获奖名次1:冠军2:亚军3:季军,依次类推)
RewardType string // 奖励类型1=平台奖励2=门店奖励
RewardId string // 对应奖励ID
Amount string // 奖励数量
IssuedAt string // 奖励发放时间
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
}
// competitionAwardsColumns holds the columns for the table competition_awards.
var competitionAwardsColumns = CompetitionAwardsColumns{
Id: "id",
CompetitionId: "competition_id",
UserId: "user_id",
AwardRank: "award_rank",
RewardType: "reward_type",
RewardId: "reward_id",
Amount: "amount",
IssuedAt: "issued_at",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewCompetitionAwardsDao creates and returns a new DAO object for table data access.
func NewCompetitionAwardsDao() *CompetitionAwardsDao {
return &CompetitionAwardsDao{
group: "default",
table: "competition_awards",
columns: competitionAwardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *CompetitionAwardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *CompetitionAwardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *CompetitionAwardsDao) Columns() CompetitionAwardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *CompetitionAwardsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *CompetitionAwardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *CompetitionAwardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,87 +0,0 @@
// ==========================================================================
// 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"
)
// CompetitionParticipantsDao is the data access object for the table competition_participants.
type CompetitionParticipantsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns CompetitionParticipantsColumns // columns contains all the column names of Table for convenient usage.
}
// CompetitionParticipantsColumns defines and stores column names for the table competition_participants.
type CompetitionParticipantsColumns struct {
Id string // 参赛记录ID
CompetitionId string // 赛事ID
UserId string // 参赛用户ID
RegistrationTime string // 报名时间
Status string // 参赛状态1=已报名2=已取消3=已禁赛
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
}
// competitionParticipantsColumns holds the columns for the table competition_participants.
var competitionParticipantsColumns = CompetitionParticipantsColumns{
Id: "id",
CompetitionId: "competition_id",
UserId: "user_id",
RegistrationTime: "registration_time",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewCompetitionParticipantsDao creates and returns a new DAO object for table data access.
func NewCompetitionParticipantsDao() *CompetitionParticipantsDao {
return &CompetitionParticipantsDao{
group: "default",
table: "competition_participants",
columns: competitionParticipantsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *CompetitionParticipantsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *CompetitionParticipantsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *CompetitionParticipantsDao) Columns() CompetitionParticipantsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *CompetitionParticipantsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *CompetitionParticipantsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *CompetitionParticipantsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,99 +0,0 @@
// ==========================================================================
// 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"
)
// CompetitionsDao is the data access object for the table competitions.
type CompetitionsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns CompetitionsColumns // columns contains all the column names of Table for convenient usage.
}
// CompetitionsColumns defines and stores column names for the table competitions.
type CompetitionsColumns struct {
Id string // 赛事唯一标识符
Name string // 赛事名称
Description string // 赛事描述
GameMode string // 游戏模式
Conditions string // 赛事条件
Rules string // 赛事规则说明
StartTime string // 赛事开始时间
EndTime string // 赛事结束时间
IsActive string // 赛事是否启用
MerchantId string // 所属商户ID
StoreId string // 所属门店ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// competitionsColumns holds the columns for the table competitions.
var competitionsColumns = CompetitionsColumns{
Id: "id",
Name: "name",
Description: "description",
GameMode: "game_mode",
Conditions: "conditions",
Rules: "rules",
StartTime: "start_time",
EndTime: "end_time",
IsActive: "is_active",
MerchantId: "merchant_id",
StoreId: "store_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewCompetitionsDao creates and returns a new DAO object for table data access.
func NewCompetitionsDao() *CompetitionsDao {
return &CompetitionsDao{
group: "default",
table: "competitions",
columns: competitionsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *CompetitionsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *CompetitionsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *CompetitionsDao) Columns() CompetitionsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *CompetitionsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *CompetitionsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *CompetitionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,97 +0,0 @@
// ==========================================================================
// 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"
)
// MenusDao is the data access object for the table menus.
type MenusDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns MenusColumns // columns contains all the column names of Table for convenient usage.
}
// MenusColumns defines and stores column names for the table menus.
type MenusColumns struct {
Id string // 菜单ID
ParentId string // 父级菜单ID
Name string // 菜单名称
Path string // 前端路由路径
Component string // 前端组件路径
Type string // 类型1=目录父级菜单2=菜单(功能页面)
Icon string // 图标
Sort string // 排序
Hidden string // 是否隐藏0=显示1=隐藏
Status string // 状态1=启用2=禁用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// menusColumns holds the columns for the table menus.
var menusColumns = MenusColumns{
Id: "id",
ParentId: "parent_id",
Name: "name",
Path: "path",
Component: "component",
Type: "type",
Icon: "icon",
Sort: "sort",
Hidden: "hidden",
Status: "status",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewMenusDao creates and returns a new DAO object for table data access.
func NewMenusDao() *MenusDao {
return &MenusDao{
group: "default",
table: "menus",
columns: menusColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *MenusDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *MenusDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *MenusDao) Columns() MenusColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *MenusDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MenusDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *MenusDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,93 +0,0 @@
// ==========================================================================
// 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"
)
// NoticesDao is the data access object for the table notices.
type NoticesDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns NoticesColumns // columns contains all the column names of Table for convenient usage.
}
// NoticesColumns defines and stores column names for the table notices.
type NoticesColumns struct {
Id string // 通知ID
Title string // 通知标题
Content string // 通知内容
Type string // 通知类型1=系统公告2=活动通知3=维护通知
Status string // 状态0=关闭1=发布
VisibleTo string // 可见范围1=所有人2=仅门店3=仅用户
MerchantId string // 所属商户ID
StoreId string // 所属门店ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// noticesColumns holds the columns for the table notices.
var noticesColumns = NoticesColumns{
Id: "id",
Title: "title",
Content: "content",
Type: "type",
Status: "status",
VisibleTo: "visible_to",
MerchantId: "merchant_id",
StoreId: "store_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewNoticesDao creates and returns a new DAO object for table data access.
func NewNoticesDao() *NoticesDao {
return &NoticesDao{
group: "default",
table: "notices",
columns: noticesColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *NoticesDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *NoticesDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *NoticesDao) Columns() NoticesColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *NoticesDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *NoticesDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *NoticesDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,97 +0,0 @@
// ==========================================================================
// 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"
)
// RewardDistributionsDao is the data access object for the table reward_distributions.
type RewardDistributionsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RewardDistributionsColumns // columns contains all the column names of Table for convenient usage.
}
// RewardDistributionsColumns defines and stores column names for the table reward_distributions.
type RewardDistributionsColumns struct {
Id string // 奖励下发记录ID
UserId string // 接收奖励的用户ID
TaskId string // 触发该奖励的任务ID
RewardId string // 奖励ID
RewardSource string // 奖励来源1=平台2=门店
Amount string // 奖励数量
StoreId string // 所属门店ID
Status string // 发放状态0=待发放1=已发放2=失败
IssuedAt string // 实际发放时间
Remark string // 备注信息
CreatedAt string // 记录创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// rewardDistributionsColumns holds the columns for the table reward_distributions.
var rewardDistributionsColumns = RewardDistributionsColumns{
Id: "id",
UserId: "user_id",
TaskId: "task_id",
RewardId: "reward_id",
RewardSource: "reward_source",
Amount: "amount",
StoreId: "store_id",
Status: "status",
IssuedAt: "issued_at",
Remark: "remark",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewRewardDistributionsDao creates and returns a new DAO object for table data access.
func NewRewardDistributionsDao() *RewardDistributionsDao {
return &RewardDistributionsDao{
group: "default",
table: "reward_distributions",
columns: rewardDistributionsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RewardDistributionsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RewardDistributionsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RewardDistributionsDao) Columns() RewardDistributionsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RewardDistributionsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardDistributionsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *RewardDistributionsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,83 +0,0 @@
// ==========================================================================
// 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"
)
// RoleMenusDao is the data access object for the table role_menus.
type RoleMenusDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns RoleMenusColumns // columns contains all the column names of Table for convenient usage.
}
// RoleMenusColumns defines and stores column names for the table role_menus.
type RoleMenusColumns struct {
Id string // ID
RoleId string // 角色ID
MenuId string // 菜单ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// roleMenusColumns holds the columns for the table role_menus.
var roleMenusColumns = RoleMenusColumns{
Id: "id",
RoleId: "role_id",
MenuId: "menu_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewRoleMenusDao creates and returns a new DAO object for table data access.
func NewRoleMenusDao() *RoleMenusDao {
return &RoleMenusDao{
group: "default",
table: "role_menus",
columns: roleMenusColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *RoleMenusDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *RoleMenusDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *RoleMenusDao) Columns() RoleMenusColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *RoleMenusDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RoleMenusDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *RoleMenusDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,91 +0,0 @@
// ==========================================================================
// 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"
)
// StoreRewardsDao is the data access object for the table store_rewards.
type StoreRewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreRewardsColumns // columns contains all the column names of Table for convenient usage.
}
// StoreRewardsColumns defines and stores column names for the table store_rewards.
type StoreRewardsColumns struct {
Id string // 门店奖励ID
StoreId string // 所属门店ID
RewardTypeId string // 奖励类型ID
RewardName string // 奖励名称
Amount string // 奖励数量
Total string // 该奖励总库存NULL 表示无限)
MerchantId string // 所属商户ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// storeRewardsColumns holds the columns for the table store_rewards.
var storeRewardsColumns = StoreRewardsColumns{
Id: "id",
StoreId: "store_id",
RewardTypeId: "reward_type_id",
RewardName: "reward_name",
Amount: "amount",
Total: "total",
MerchantId: "merchant_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewStoreRewardsDao creates and returns a new DAO object for table data access.
func NewStoreRewardsDao() *StoreRewardsDao {
return &StoreRewardsDao{
group: "default",
table: "store_rewards",
columns: storeRewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *StoreRewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *StoreRewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *StoreRewardsDao) Columns() StoreRewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *StoreRewardsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *StoreRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,87 +0,0 @@
// ==========================================================================
// 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"
)
// StoreTaskRewardsDao is the data access object for the table store_task_rewards.
type StoreTaskRewardsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
}
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
type StoreTaskRewardsColumns struct {
Id string // 门店奖励记录ID
StoreId string // 门店ID
TaskId string // 任务ID
StoreRewardId string // 门店奖励ID
IsEnabled string // 是否启用
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// storeTaskRewardsColumns holds the columns for the table store_task_rewards.
var storeTaskRewardsColumns = StoreTaskRewardsColumns{
Id: "id",
StoreId: "store_id",
TaskId: "task_id",
StoreRewardId: "store_reward_id",
IsEnabled: "is_enabled",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
return &StoreTaskRewardsDao{
group: "default",
table: "store_task_rewards",
columns: storeTaskRewardsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *StoreTaskRewardsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *StoreTaskRewardsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *StoreTaskRewardsDao) Columns() StoreTaskRewardsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *StoreTaskRewardsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *StoreTaskRewardsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,111 +0,0 @@
// ==========================================================================
// 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"
)
// SystemOperationLogsDao is the data access object for the table system_operation_logs.
type SystemOperationLogsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns SystemOperationLogsColumns // columns contains all the column names of Table for convenient usage.
}
// SystemOperationLogsColumns defines and stores column names for the table system_operation_logs.
type SystemOperationLogsColumns struct {
Id string // 日志ID
OperatorType string // 操作者类型1=系统管理员2=商户管理员3=门店管理员4=普通用户
OperatorId string // 操作者ID
MerchantId string // 所属商户ID
StoreId string // 所属门店ID
Module string // 操作模块
Action string // 操作类型
TargetType string // 操作对象类型
TargetId string // 操作对象ID
Content string // 操作内容描述
RequestMethod string // 请求方法
RequestUrl string // 请求URL
RequestParams string // 请求参数
ResponseCode string // 响应状态码
ResponseMessage string // 响应信息
IpAddress string // 操作IP地址
UserAgent string // 用户代理信息
CreatedAt string // 操作时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// systemOperationLogsColumns holds the columns for the table system_operation_logs.
var systemOperationLogsColumns = SystemOperationLogsColumns{
Id: "id",
OperatorType: "operator_type",
OperatorId: "operator_id",
MerchantId: "merchant_id",
StoreId: "store_id",
Module: "module",
Action: "action",
TargetType: "target_type",
TargetId: "target_id",
Content: "content",
RequestMethod: "request_method",
RequestUrl: "request_url",
RequestParams: "request_params",
ResponseCode: "response_code",
ResponseMessage: "response_message",
IpAddress: "ip_address",
UserAgent: "user_agent",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewSystemOperationLogsDao creates and returns a new DAO object for table data access.
func NewSystemOperationLogsDao() *SystemOperationLogsDao {
return &SystemOperationLogsDao{
group: "default",
table: "system_operation_logs",
columns: systemOperationLogsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *SystemOperationLogsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *SystemOperationLogsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *SystemOperationLogsDao) Columns() SystemOperationLogsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *SystemOperationLogsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *SystemOperationLogsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *SystemOperationLogsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,81 +0,0 @@
// ==========================================================================
// 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"
)
// TasksDao is the data access object for the table tasks.
type TasksDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns TasksColumns // columns contains all the column names of Table for convenient usage.
}
// TasksColumns defines and stores column names for the table tasks.
type TasksColumns struct {
Id string // 任务ID
QqTaskId string // QQ网吧任务ID
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// tasksColumns holds the columns for the table tasks.
var tasksColumns = TasksColumns{
Id: "id",
QqTaskId: "qq_task_id",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewTasksDao creates and returns a new DAO object for table data access.
func NewTasksDao() *TasksDao {
return &TasksDao{
group: "default",
table: "tasks",
columns: tasksColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *TasksDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *TasksDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *TasksDao) Columns() TasksColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *TasksDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *TasksDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,93 +0,0 @@
// ==========================================================================
// 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"
)
// UserLoginRecordsDao is the data access object for the table user_login_records.
type UserLoginRecordsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UserLoginRecordsColumns // columns contains all the column names of Table for convenient usage.
}
// UserLoginRecordsColumns defines and stores column names for the table user_login_records.
type UserLoginRecordsColumns struct {
Id string // 记录ID
UserId string // 用户ID
StoreId string // 登录门店ID
LoginIp string // 登录IP地址
LoginPlatform string // 登录平台1=PC
LoginType string // 登录方式1=微信2=手机号3=账号密码4=其他
LoginStatus string // 登录状态1=成功2=失败
FailReason string // 失败原因
CreatedAt string // 登录时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
}
// userLoginRecordsColumns holds the columns for the table user_login_records.
var userLoginRecordsColumns = UserLoginRecordsColumns{
Id: "id",
UserId: "user_id",
StoreId: "store_id",
LoginIp: "login_ip",
LoginPlatform: "login_platform",
LoginType: "login_type",
LoginStatus: "login_status",
FailReason: "fail_reason",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewUserLoginRecordsDao creates and returns a new DAO object for table data access.
func NewUserLoginRecordsDao() *UserLoginRecordsDao {
return &UserLoginRecordsDao{
group: "default",
table: "user_login_records",
columns: userLoginRecordsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *UserLoginRecordsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *UserLoginRecordsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *UserLoginRecordsDao) Columns() UserLoginRecordsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *UserLoginRecordsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UserLoginRecordsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *UserLoginRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,91 +0,0 @@
// ==========================================================================
// 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"
)
// UserTaskRecordsDao is the data access object for the table user_task_records.
type UserTaskRecordsDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO.
columns UserTaskRecordsColumns // columns contains all the column names of Table for convenient usage.
}
// UserTaskRecordsColumns defines and stores column names for the table user_task_records.
type UserTaskRecordsColumns struct {
Id string // 任务记录ID
UserId string // 用户ID
TaskId string // 任务ID
Status string // 任务状态1=未开始2=进行中3=已完成4=已领取奖励
Progress string // 任务进度
FinishedAt string // 完成时间
RewardReceivedAt string // 领取奖励时间
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间
}
// userTaskRecordsColumns holds the columns for the table user_task_records.
var userTaskRecordsColumns = UserTaskRecordsColumns{
Id: "id",
UserId: "user_id",
TaskId: "task_id",
Status: "status",
Progress: "progress",
FinishedAt: "finished_at",
RewardReceivedAt: "reward_received_at",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
}
// NewUserTaskRecordsDao creates and returns a new DAO object for table data access.
func NewUserTaskRecordsDao() *UserTaskRecordsDao {
return &UserTaskRecordsDao{
group: "default",
table: "user_task_records",
columns: userTaskRecordsColumns,
}
}
// DB retrieves and returns the underlying raw database management object of the current DAO.
func (dao *UserTaskRecordsDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of the current DAO.
func (dao *UserTaskRecordsDao) Table() string {
return dao.table
}
// Columns returns all column names of the current DAO.
func (dao *UserTaskRecordsDao) Columns() UserTaskRecordsColumns {
return dao.columns
}
// Group returns the database configuration group name of the current DAO.
func (dao *UserTaskRecordsDao) Group() string {
return dao.group
}
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UserTaskRecordsDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rolls back the transaction and returns the error if function f returns a non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note: Do not commit or roll back the transaction in function f,
// as it is automatically handled by this function.
func (dao *UserTaskRecordsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalMenusDao is an internal type for wrapping the internal DAO implementation.
type internalMenusDao = *internal.MenusDao
// menusDao is the data access object for the table menus.
// You can define custom methods on it to extend its functionality as needed.
type menusDao struct {
internalMenusDao
}
var (
// Menus is a globally accessible object for table menus operations.
Menus = menusDao{
internal.NewMenusDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalNoticesDao is an internal type for wrapping the internal DAO implementation.
type internalNoticesDao = *internal.NoticesDao
// noticesDao is the data access object for the table notices.
// You can define custom methods on it to extend its functionality as needed.
type noticesDao struct {
internalNoticesDao
}
var (
// Notices is a globally accessible object for table notices operations.
Notices = noticesDao{
internal.NewNoticesDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalRewardDistributionsDao is an internal type for wrapping the internal DAO implementation.
type internalRewardDistributionsDao = *internal.RewardDistributionsDao
// rewardDistributionsDao is the data access object for the table reward_distributions.
// You can define custom methods on it to extend its functionality as needed.
type rewardDistributionsDao struct {
internalRewardDistributionsDao
}
var (
// RewardDistributions is a globally accessible object for table reward_distributions operations.
RewardDistributions = rewardDistributionsDao{
internal.NewRewardDistributionsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalRoleMenusDao is an internal type for wrapping the internal DAO implementation.
type internalRoleMenusDao = *internal.RoleMenusDao
// roleMenusDao is the data access object for the table role_menus.
// You can define custom methods on it to extend its functionality as needed.
type roleMenusDao struct {
internalRoleMenusDao
}
var (
// RoleMenus is a globally accessible object for table role_menus operations.
RoleMenus = roleMenusDao{
internal.NewRoleMenusDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalStoreRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalStoreRewardsDao = *internal.StoreRewardsDao
// storeRewardsDao is the data access object for the table store_rewards.
// You can define custom methods on it to extend its functionality as needed.
type storeRewardsDao struct {
internalStoreRewardsDao
}
var (
// StoreRewards is a globally accessible object for table store_rewards operations.
StoreRewards = storeRewardsDao{
internal.NewStoreRewardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalStoreTaskRewardsDao is an internal type for wrapping the internal DAO implementation.
type internalStoreTaskRewardsDao = *internal.StoreTaskRewardsDao
// storeTaskRewardsDao is the data access object for the table store_task_rewards.
// You can define custom methods on it to extend its functionality as needed.
type storeTaskRewardsDao struct {
internalStoreTaskRewardsDao
}
var (
// StoreTaskRewards is a globally accessible object for table store_task_rewards operations.
StoreTaskRewards = storeTaskRewardsDao{
internal.NewStoreTaskRewardsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalSystemOperationLogsDao is an internal type for wrapping the internal DAO implementation.
type internalSystemOperationLogsDao = *internal.SystemOperationLogsDao
// systemOperationLogsDao is the data access object for the table system_operation_logs.
// You can define custom methods on it to extend its functionality as needed.
type systemOperationLogsDao struct {
internalSystemOperationLogsDao
}
var (
// SystemOperationLogs is a globally accessible object for table system_operation_logs operations.
SystemOperationLogs = systemOperationLogsDao{
internal.NewSystemOperationLogsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalTasksDao is an internal type for wrapping the internal DAO implementation.
type internalTasksDao = *internal.TasksDao
// tasksDao is the data access object for the table tasks.
// You can define custom methods on it to extend its functionality as needed.
type tasksDao struct {
internalTasksDao
}
var (
// Tasks is a globally accessible object for table tasks operations.
Tasks = tasksDao{
internal.NewTasksDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalUserLoginRecordsDao is an internal type for wrapping the internal DAO implementation.
type internalUserLoginRecordsDao = *internal.UserLoginRecordsDao
// userLoginRecordsDao is the data access object for the table user_login_records.
// You can define custom methods on it to extend its functionality as needed.
type userLoginRecordsDao struct {
internalUserLoginRecordsDao
}
var (
// UserLoginRecords is a globally accessible object for table user_login_records operations.
UserLoginRecords = userLoginRecordsDao{
internal.NewUserLoginRecordsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -1,27 +0,0 @@
// =================================================================================
// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
// =================================================================================
package dao
import (
"server/internal/dao/internal"
)
// internalUserTaskRecordsDao is an internal type for wrapping the internal DAO implementation.
type internalUserTaskRecordsDao = *internal.UserTaskRecordsDao
// userTaskRecordsDao is the data access object for the table user_task_records.
// You can define custom methods on it to extend its functionality as needed.
type userTaskRecordsDao struct {
internalUserTaskRecordsDao
}
var (
// UserTaskRecords is a globally accessible object for table user_task_records operations.
UserTaskRecords = userTaskRecordsDao{
internal.NewUserTaskRecordsDao(),
}
)
// Add your custom methods and functionality below.

View File

@ -6,7 +6,6 @@ package logic
import ( import (
_ "server/internal/logic/admin" _ "server/internal/logic/admin"
_ "server/internal/logic/menu"
_ "server/internal/logic/merchant" _ "server/internal/logic/merchant"
_ "server/internal/logic/merchantAdmin" _ "server/internal/logic/merchantAdmin"
_ "server/internal/logic/rewardType" _ "server/internal/logic/rewardType"

View File

@ -1,189 +0,0 @@
package menu
import (
"context"
"server/internal/dao"
"server/internal/model"
"server/internal/model/do"
"server/internal/model/entity"
"server/internal/service"
"server/utility/ecode"
)
type sMenu struct {
}
func New() service.IMenu {
return &sMenu{}
}
func init() {
service.RegisterMenu(New())
}
// Create 创建菜单
func (s *sMenu) Create(ctx context.Context, in *model.MenuCreateInput) (out *model.CreateOut, err error) {
// 检查菜单名称是否已存在
exist, err := dao.Menus.Ctx(ctx).Where(do.Menus{Name: in.Name}).Exist()
if err != nil {
return nil, ecode.Fail.Sub("插入菜单查重出现异常")
}
if exist {
return nil, ecode.Params.Sub("菜单名称已存在")
}
id, err := dao.Menus.Ctx(ctx).InsertAndGetId(do.Menus{
ParentId: in.ParentId,
Name: in.Name,
Path: in.Path,
Component: in.Component,
Type: in.Type,
Icon: in.Icon,
Sort: in.Sort,
Hidden: in.Hidden,
Status: in.Status,
})
if err != nil {
return nil, err
}
return &model.CreateOut{Id: id}, nil
}
// Delete 删除菜单
func (s *sMenu) Delete(ctx context.Context, in *model.MenuDeleteInput) (out *model.DeleteOut, err error) {
// 检查是否存在子菜单
count, err := dao.Menus.Ctx(ctx).Where(do.Menus{ParentId: in.Id}).Count()
if err != nil {
return nil, err
}
if count > 0 {
return nil, ecode.Params.Sub("存在子菜单,请先删除子菜单")
}
// 删除菜单
_, err = dao.Menus.Ctx(ctx).Where(do.Menus{Id: in.Id}).Delete()
if err != nil {
return nil, err
}
return &model.DeleteOut{}, nil
}
// BatchDelete 批量删除菜单
func (s *sMenu) BatchDelete(ctx context.Context, in *model.BatchDeleteIn) (out *model.BatchDeleteOut, err error) {
// 检查是否存在子菜单
var menus []*entity.Menus
err = dao.Menus.Ctx(ctx).WhereIn(dao.Menus.Columns().ParentId, in.Ids).Scan(&menus)
if err != nil {
return nil, err
}
// 获取有子菜单的ID
hasChildrenIds := make(map[int]bool)
for _, menu := range menus {
hasChildrenIds[int(menu.ParentId)] = true
}
// 找出可以删除的ID
var deletableIds []int
var undeletableIds []int
for _, id := range in.Ids {
if hasChildrenIds[id] {
undeletableIds = append(undeletableIds, id)
} else {
deletableIds = append(deletableIds, id)
}
}
// 如果有可删除的ID执行删除操作
if len(deletableIds) > 0 {
_, err = dao.Menus.Ctx(ctx).WhereIn(dao.Menus.Columns().Id, deletableIds).Delete()
if err != nil {
return nil, err
}
}
return &model.BatchDeleteOut{
Ids: undeletableIds,
}, nil
}
// Update 更新菜单
func (s *sMenu) Update(ctx context.Context, in *model.MenuUpdateInput) (out *model.UpdateOut, err error) {
// 检查菜单是否存在
exist, err := dao.Menus.Ctx(ctx).WherePri(in.Id).Exist()
if err != nil {
return nil, ecode.Fail.Sub("查询菜单失败")
}
if !exist {
return nil, ecode.Params.Sub("菜单不存在")
}
exist, err = dao.Menus.Ctx(ctx).Where(do.Menus{Name: in.Name}).WhereNot(dao.Menus.Columns().Id, in.Id).Exist()
if err != nil {
return nil, ecode.Fail.Sub("查询菜单失败")
}
if exist {
return nil, ecode.Params.Sub("菜单名称已存在")
}
// 更新菜单
_, err = dao.Menus.Ctx(ctx).Where(do.Menus{
Id: in.Id,
}).Update(do.Menus{
ParentId: in.ParentId,
Name: in.Name,
Path: in.Path,
Component: in.Component,
Type: in.Type,
Icon: in.Icon,
Sort: in.Sort,
Hidden: in.Hidden,
Status: in.Status,
})
if err != nil {
return nil, err
}
return &model.UpdateOut{}, nil
}
// List 获取菜单列表
func (s *sMenu) List(ctx context.Context, in *model.MenuListInput) (out *model.MenuListOutput, err error) {
m := dao.Menus.Ctx(ctx)
// 构建查询条件
if in.ParentId > 0 {
m = m.Where(do.Menus{
ParentId: in.ParentId,
})
}
if in.Name != "" {
m = m.WhereLike(dao.Menus.Columns().Name, "%"+in.Name+"%")
}
if in.Path != "" {
m = m.WhereLike(dao.Menus.Columns().Path, "%"+in.Path+"%")
}
if in.Type > 0 {
m = m.Where(do.Menus{
Type: in.Type,
})
}
if in.Status > 0 {
m = m.Where(do.Menus{
Status: in.Status,
})
}
// 分页查询
list := make([]model.Menu, 0)
var total int
err = m.Page(in.Page, in.Size).OrderAsc(dao.Menus.Columns().Sort).ScanAndCount(&list, &total, false)
if err != nil {
return nil, err
}
return &model.MenuListOutput{
List: list,
Total: total,
}, nil
}

View File

@ -17,6 +17,7 @@ import (
"server/utility/ecode" "server/utility/ecode"
utility "server/utility/encrypt" utility "server/utility/encrypt"
"server/utility/jwt" "server/utility/jwt"
"server/utility/snowid"
) )
type sMerchantAdmin struct { type sMerchantAdmin struct {
@ -150,8 +151,13 @@ func (s *sMerchantAdmin) Register(ctx context.Context, in *model.MerchantAdminRe
} }
if err = dao.MerchantAdmins.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { if err = dao.MerchantAdmins.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
// 插入商户数据 // 插入商户数据
generateCode, err := snowid.GetSnowClient().GenerateMerchantCode()
if err != nil {
return ecode.Fail.Sub("生成商户编号失败")
}
id, err := tx.Model(dao.Merchants.Table()).Data(do.Merchants{ id, err := tx.Model(dao.Merchants.Table()).Data(do.Merchants{
Name: fmt.Sprintf("%s的商铺", in.Username), MerchantCode: generateCode,
Name: fmt.Sprintf("%s代理", in.Username),
CreatedByType: consts.MerchantRegisterByAdmin, CreatedByType: consts.MerchantRegisterByAdmin,
Status: consts.MerchantDisabledStatus, Status: consts.MerchantDisabledStatus,
AuditStatus: consts.MerchantPendingReview, AuditStatus: consts.MerchantPendingReview,

View File

@ -9,6 +9,7 @@ import (
"server/internal/model/do" "server/internal/model/do"
"server/internal/service" "server/internal/service"
"server/utility/ecode" "server/utility/ecode"
"server/utility/snowid"
) )
type sStore struct { type sStore struct {
@ -39,21 +40,29 @@ func (s *sStore) Create(ctx context.Context, in *model.StoreCreateIn) (out *mode
// 2. 使用事务处理数据插入 // 2. 使用事务处理数据插入
if err = dao.Stores.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { if err = dao.Stores.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) {
// 2.1 根据商户 id 获取所属的商户 // 2.1 根据商户 id 获取所属的商户
value, err := dao.MerchantAdmins.Ctx(ctx).WherePri(in.MerchantAdminId).Fields(dao.MerchantAdmins.Columns().MerchantId).Value() value, err := dao.MerchantAdmins.Ctx(ctx).WherePri(in.OperatorId).Fields(dao.MerchantAdmins.Columns().MerchantId).Value()
if err != nil { if err != nil {
return ecode.Fail.Sub("获取商户ID出现异常") return ecode.Fail.Sub("获取商户ID出现异常")
} }
// 2,2 生成门店的相关信息 // 2,2 生成门店的相关信息
code, err := snowid.GetSnowClient().GenerateStoreCode()
if err != nil {
return ecode.Fail.Sub("生成门店ID出现异常")
}
// 2.3 插入门店数据 // 2.3 插入门店数据
id, err := tx.Model(dao.Stores.Table()).Data(do.Stores{ id, err := tx.Model(dao.Stores.Table()).Data(do.Stores{
MerchantId: value.Int64(), MerchantId: value.Int(),
StoreCode: code,
Name: in.Name,
Address: in.Address,
ContactName: in.ContactName,
ContactPhone: in.ContactPhone,
}).InsertAndGetId() }).InsertAndGetId()
if err != nil { if err != nil {
return ecode.Fail.Sub("新增门店出现异常") return ecode.Fail.Sub("新增门店出现异常")
} }
//2.4 生成门店主管理账号 // TODO 生成门店主管理账号,密码通知方式
// 2.5 插入门店管理员数据 // 2.5 插入门店管理员数据
_, err = tx.Model(dao.StoreAdmins.Table()).Data(do.StoreAdmins{ _, err = tx.Model(dao.StoreAdmins.Table()).Data(do.StoreAdmins{
@ -62,11 +71,11 @@ func (s *sStore) Create(ctx context.Context, in *model.StoreCreateIn) (out *mode
if err != nil { if err != nil {
return ecode.Fail.Sub("新增门店管理员出现异常") return ecode.Fail.Sub("新增门店管理员出现异常")
} }
out.Id = id
return nil return nil
}); err != nil { }); err != nil {
return nil, err return nil, err
} }
return return
} }

View File

@ -98,6 +98,9 @@ func (s *sUser) Login(ctx context.Context, in *model.UserLoginIn) (out *model.Us
} }
return return
} }
func (s *sUser) WeChatLogin(ctx context.Context, in *model.WeChatLogin) (out *model.WeChatLoginOut, err error) {
return
}
func (s *sUser) Info(ctx context.Context, in *model.UserInfoIn) (out *model.UserInfoOut, err error) { func (s *sUser) Info(ctx context.Context, in *model.UserInfoIn) (out *model.UserInfoOut, err error) {
exist, err := dao.Users.Ctx(ctx).Where(do.Users{WxOpenId: in.OpenId, Id: in.Id}).OmitEmptyWhere().Exist() exist, err := dao.Users.Ctx(ctx).Where(do.Users{WxOpenId: in.OpenId, Id: in.Id}).OmitEmptyWhere().Exist()

View File

@ -1,26 +0,0 @@
// =================================================================================
// 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"
)
// CompetitionAwards is the golang structure of table competition_awards for DAO operations like Where/Data.
type CompetitionAwards struct {
g.Meta `orm:"table:competition_awards, do:true"`
Id interface{} // 赛事获奖ID
CompetitionId interface{} // 赛事ID
UserId interface{} // 获奖用户ID
AwardRank interface{} // 获奖名次1:冠军2:亚军3:季军,依次类推)
RewardType interface{} // 奖励类型1=平台奖励2=门店奖励
RewardId interface{} // 对应奖励ID
Amount interface{} // 奖励数量
IssuedAt *gtime.Time // 奖励发放时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@ -1,23 +0,0 @@
// =================================================================================
// 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"
)
// CompetitionParticipants is the golang structure of table competition_participants for DAO operations like Where/Data.
type CompetitionParticipants struct {
g.Meta `orm:"table:competition_participants, do:true"`
Id interface{} // 参赛记录ID
CompetitionId interface{} // 赛事ID
UserId interface{} // 参赛用户ID
RegistrationTime *gtime.Time // 报名时间
Status interface{} // 参赛状态1=已报名2=已取消3=已禁赛
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@ -1,29 +0,0 @@
// =================================================================================
// 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"
)
// Competitions is the golang structure of table competitions for DAO operations like Where/Data.
type Competitions struct {
g.Meta `orm:"table:competitions, do:true"`
Id interface{} // 赛事唯一标识符
Name interface{} // 赛事名称
Description interface{} // 赛事描述
GameMode interface{} // 游戏模式
Conditions interface{} // 赛事条件
Rules interface{} // 赛事规则说明
StartTime *gtime.Time // 赛事开始时间
EndTime *gtime.Time // 赛事结束时间
IsActive interface{} // 赛事是否启用
MerchantId interface{} // 所属商户ID
StoreId interface{} // 所属门店ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,28 +0,0 @@
// =================================================================================
// 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"
)
// Menus is the golang structure of table menus for DAO operations like Where/Data.
type Menus struct {
g.Meta `orm:"table:menus, do:true"`
Id interface{} // 菜单ID
ParentId interface{} // 父级菜单ID
Name interface{} // 菜单名称
Path interface{} // 前端路由路径
Component interface{} // 前端组件路径
Type interface{} // 类型1=目录父级菜单2=菜单(功能页面)
Icon interface{} // 图标
Sort interface{} // 排序
Hidden interface{} // 是否隐藏0=显示1=隐藏
Status interface{} // 状态1=启用2=禁用
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -33,4 +33,5 @@ type Merchants struct {
AuditAt *gtime.Time // 审核时间 AuditAt *gtime.Time // 审核时间
AuditRemark interface{} // 审核备注 AuditRemark interface{} // 审核备注
RejectReason interface{} // 拒绝原因 RejectReason interface{} // 拒绝原因
MerchantCode interface{} // 商户编号
} }

View File

@ -1,26 +0,0 @@
// =================================================================================
// 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"
)
// Notices is the golang structure of table notices for DAO operations like Where/Data.
type Notices struct {
g.Meta `orm:"table:notices, do:true"`
Id interface{} // 通知ID
Title interface{} // 通知标题
Content interface{} // 通知内容
Type interface{} // 通知类型1=系统公告2=活动通知3=维护通知
Status interface{} // 状态0=关闭1=发布
VisibleTo interface{} // 可见范围1=所有人2=仅门店3=仅用户
MerchantId interface{} // 所属商户ID
StoreId interface{} // 所属门店ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,28 +0,0 @@
// =================================================================================
// 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"
)
// RewardDistributions is the golang structure of table reward_distributions for DAO operations like Where/Data.
type RewardDistributions struct {
g.Meta `orm:"table:reward_distributions, do:true"`
Id interface{} // 奖励下发记录ID
UserId interface{} // 接收奖励的用户ID
TaskId interface{} // 触发该奖励的任务ID
RewardId interface{} // 奖励ID
RewardSource interface{} // 奖励来源1=平台2=门店
Amount interface{} // 奖励数量
StoreId interface{} // 所属门店ID
Status interface{} // 发放状态0=待发放1=已发放2=失败
IssuedAt *gtime.Time // 实际发放时间
Remark interface{} // 备注信息
CreatedAt *gtime.Time // 记录创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,21 +0,0 @@
// =================================================================================
// 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"
)
// RoleMenus is the golang structure of table role_menus for DAO operations like Where/Data.
type RoleMenus struct {
g.Meta `orm:"table:role_menus, do:true"`
Id interface{} // ID
RoleId interface{} // 角色ID
MenuId interface{} // 菜单ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,25 +0,0 @@
// =================================================================================
// 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"
)
// StoreRewards is the golang structure of table store_rewards for DAO operations like Where/Data.
type StoreRewards struct {
g.Meta `orm:"table:store_rewards, do:true"`
Id interface{} // 门店奖励ID
StoreId interface{} // 所属门店ID
RewardTypeId interface{} // 奖励类型ID
RewardName interface{} // 奖励名称
Amount interface{} // 奖励数量
Total interface{} // 该奖励总库存NULL 表示无限)
MerchantId interface{} // 所属商户ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,23 +0,0 @@
// =================================================================================
// 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"
)
// StoreTaskRewards is the golang structure of table store_task_rewards for DAO operations like Where/Data.
type StoreTaskRewards struct {
g.Meta `orm:"table:store_task_rewards, do:true"`
Id interface{} // 门店奖励记录ID
StoreId interface{} // 门店ID
TaskId interface{} // 任务ID
StoreRewardId interface{} // 门店奖励ID
IsEnabled interface{} // 是否启用
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,35 +0,0 @@
// =================================================================================
// 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"
)
// SystemOperationLogs is the golang structure of table system_operation_logs for DAO operations like Where/Data.
type SystemOperationLogs struct {
g.Meta `orm:"table:system_operation_logs, do:true"`
Id interface{} // 日志ID
OperatorType interface{} // 操作者类型1=系统管理员2=商户管理员3=门店管理员4=普通用户
OperatorId interface{} // 操作者ID
MerchantId interface{} // 所属商户ID
StoreId interface{} // 所属门店ID
Module interface{} // 操作模块
Action interface{} // 操作类型
TargetType interface{} // 操作对象类型
TargetId interface{} // 操作对象ID
Content interface{} // 操作内容描述
RequestMethod interface{} // 请求方法
RequestUrl interface{} // 请求URL
RequestParams interface{} // 请求参数
ResponseCode interface{} // 响应状态码
ResponseMessage interface{} // 响应信息
IpAddress interface{} // 操作IP地址
UserAgent interface{} // 用户代理信息
CreatedAt *gtime.Time // 操作时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,20 +0,0 @@
// =================================================================================
// 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"
)
// Tasks is the golang structure of table tasks for DAO operations like Where/Data.
type Tasks struct {
g.Meta `orm:"table:tasks, do:true"`
Id interface{} // 任务ID
QqTaskId interface{} // QQ网吧任务ID
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,26 +0,0 @@
// =================================================================================
// 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"
)
// UserLoginRecords is the golang structure of table user_login_records for DAO operations like Where/Data.
type UserLoginRecords struct {
g.Meta `orm:"table:user_login_records, do:true"`
Id interface{} // 记录ID
UserId interface{} // 用户ID
StoreId interface{} // 登录门店ID
LoginIp interface{} // 登录IP地址
LoginPlatform interface{} // 登录平台1=PC
LoginType interface{} // 登录方式1=微信2=手机号3=账号密码4=其他
LoginStatus interface{} // 登录状态1=成功2=失败
FailReason interface{} // 失败原因
CreatedAt *gtime.Time // 登录时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
}

View File

@ -1,25 +0,0 @@
// =================================================================================
// 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"
)
// UserTaskRecords is the golang structure of table user_task_records for DAO operations like Where/Data.
type UserTaskRecords struct {
g.Meta `orm:"table:user_task_records, do:true"`
Id interface{} // 任务记录ID
UserId interface{} // 用户ID
TaskId interface{} // 任务ID
Status interface{} // 任务状态1=未开始2=进行中3=已完成4=已领取奖励
Progress interface{} // 任务进度
FinishedAt *gtime.Time // 完成时间
RewardReceivedAt *gtime.Time // 领取奖励时间
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间
}

View File

@ -1,24 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// CompetitionAwards is the golang structure for table competition_awards.
type CompetitionAwards struct {
Id int64 `json:"id" orm:"id" description:"赛事获奖ID"` // 赛事获奖ID
CompetitionId int64 `json:"competitionId" orm:"competition_id" description:"赛事ID"` // 赛事ID
UserId int64 `json:"userId" orm:"user_id" description:"获奖用户ID"` // 获奖用户ID
AwardRank int `json:"awardRank" orm:"award_rank" description:"获奖名次1:冠军2:亚军3:季军,依次类推)"` // 获奖名次1:冠军2:亚军3:季军,依次类推)
RewardType int `json:"rewardType" orm:"reward_type" description:"奖励类型1=平台奖励2=门店奖励"` // 奖励类型1=平台奖励2=门店奖励
RewardId int64 `json:"rewardId" orm:"reward_id" description:"对应奖励ID"` // 对应奖励ID
Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量
IssuedAt *gtime.Time `json:"issuedAt" orm:"issued_at" description:"奖励发放时间"` // 奖励发放时间
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
}

View File

@ -1,21 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// CompetitionParticipants is the golang structure for table competition_participants.
type CompetitionParticipants struct {
Id int64 `json:"id" orm:"id" description:"参赛记录ID"` // 参赛记录ID
CompetitionId int64 `json:"competitionId" orm:"competition_id" description:"赛事ID"` // 赛事ID
UserId int64 `json:"userId" orm:"user_id" description:"参赛用户ID"` // 参赛用户ID
RegistrationTime *gtime.Time `json:"registrationTime" orm:"registration_time" description:"报名时间"` // 报名时间
Status int `json:"status" orm:"status" description:"参赛状态1=已报名2=已取消3=已禁赛"` // 参赛状态1=已报名2=已取消3=已禁赛
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
}

View File

@ -1,27 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Competitions is the golang structure for table competitions.
type Competitions struct {
Id int64 `json:"id" orm:"id" description:"赛事唯一标识符"` // 赛事唯一标识符
Name string `json:"name" orm:"name" description:"赛事名称"` // 赛事名称
Description string `json:"description" orm:"description" description:"赛事描述"` // 赛事描述
GameMode string `json:"gameMode" orm:"game_mode" description:"游戏模式"` // 游戏模式
Conditions string `json:"conditions" orm:"conditions" description:"赛事条件"` // 赛事条件
Rules string `json:"rules" orm:"rules" description:"赛事规则说明"` // 赛事规则说明
StartTime *gtime.Time `json:"startTime" orm:"start_time" description:"赛事开始时间"` // 赛事开始时间
EndTime *gtime.Time `json:"endTime" orm:"end_time" description:"赛事结束时间"` // 赛事结束时间
IsActive int `json:"isActive" orm:"is_active" description:"赛事是否启用"` // 赛事是否启用
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,26 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Menus is the golang structure for table menus.
type Menus struct {
Id int64 `json:"id" orm:"id" description:"菜单ID"` // 菜单ID
ParentId int64 `json:"parentId" orm:"parent_id" description:"父级菜单ID"` // 父级菜单ID
Name string `json:"name" orm:"name" description:"菜单名称"` // 菜单名称
Path string `json:"path" orm:"path" description:"前端路由路径"` // 前端路由路径
Component string `json:"component" orm:"component" description:"前端组件路径"` // 前端组件路径
Type int `json:"type" orm:"type" description:"类型1=目录父级菜单2=菜单(功能页面)"` // 类型1=目录父级菜单2=菜单(功能页面)
Icon string `json:"icon" orm:"icon" description:"图标"` // 图标
Sort int `json:"sort" orm:"sort" description:"排序"` // 排序
Hidden int `json:"hidden" orm:"hidden" description:"是否隐藏0=显示1=隐藏"` // 是否隐藏0=显示1=隐藏
Status int `json:"status" orm:"status" description:"状态1=启用2=禁用"` // 状态1=启用2=禁用
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -31,4 +31,5 @@ type Merchants struct {
AuditAt *gtime.Time `json:"auditAt" orm:"audit_at" description:"审核时间"` // 审核时间 AuditAt *gtime.Time `json:"auditAt" orm:"audit_at" description:"审核时间"` // 审核时间
AuditRemark string `json:"auditRemark" orm:"audit_remark" description:"审核备注"` // 审核备注 AuditRemark string `json:"auditRemark" orm:"audit_remark" description:"审核备注"` // 审核备注
RejectReason string `json:"rejectReason" orm:"reject_reason" description:"拒绝原因"` // 拒绝原因 RejectReason string `json:"rejectReason" orm:"reject_reason" description:"拒绝原因"` // 拒绝原因
MerchantCode string `json:"merchantCode" orm:"merchant_code" description:"商户编号"` // 商户编号
} }

View File

@ -1,24 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Notices is the golang structure for table notices.
type Notices struct {
Id int64 `json:"id" orm:"id" description:"通知ID"` // 通知ID
Title string `json:"title" orm:"title" description:"通知标题"` // 通知标题
Content string `json:"content" orm:"content" description:"通知内容"` // 通知内容
Type int `json:"type" orm:"type" description:"通知类型1=系统公告2=活动通知3=维护通知"` // 通知类型1=系统公告2=活动通知3=维护通知
Status int `json:"status" orm:"status" description:"状态0=关闭1=发布"` // 状态0=关闭1=发布
VisibleTo int `json:"visibleTo" orm:"visible_to" description:"可见范围1=所有人2=仅门店3=仅用户"` // 可见范围1=所有人2=仅门店3=仅用户
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,26 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// RewardDistributions is the golang structure for table reward_distributions.
type RewardDistributions struct {
Id int64 `json:"id" orm:"id" description:"奖励下发记录ID"` // 奖励下发记录ID
UserId int64 `json:"userId" orm:"user_id" description:"接收奖励的用户ID"` // 接收奖励的用户ID
TaskId int64 `json:"taskId" orm:"task_id" description:"触发该奖励的任务ID"` // 触发该奖励的任务ID
RewardId int64 `json:"rewardId" orm:"reward_id" description:"奖励ID"` // 奖励ID
RewardSource int `json:"rewardSource" orm:"reward_source" description:"奖励来源1=平台2=门店"` // 奖励来源1=平台2=门店
Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
Status int `json:"status" orm:"status" description:"发放状态0=待发放1=已发放2=失败"` // 发放状态0=待发放1=已发放2=失败
IssuedAt *gtime.Time `json:"issuedAt" orm:"issued_at" description:"实际发放时间"` // 实际发放时间
Remark string `json:"remark" orm:"remark" description:"备注信息"` // 备注信息
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"记录创建时间"` // 记录创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,19 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// RoleMenus is the golang structure for table role_menus.
type RoleMenus struct {
Id int64 `json:"id" orm:"id" description:"ID"` // ID
RoleId int64 `json:"roleId" orm:"role_id" description:"角色ID"` // 角色ID
MenuId int64 `json:"menuId" orm:"menu_id" description:"菜单ID"` // 菜单ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,23 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// StoreRewards is the golang structure for table store_rewards.
type StoreRewards struct {
Id int64 `json:"id" orm:"id" description:"门店奖励ID"` // 门店奖励ID
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
RewardTypeId int64 `json:"rewardTypeId" orm:"reward_type_id" description:"奖励类型ID"` // 奖励类型ID
RewardName string `json:"rewardName" orm:"reward_name" description:"奖励名称"` // 奖励名称
Amount int `json:"amount" orm:"amount" description:"奖励数量"` // 奖励数量
Total int `json:"total" orm:"total" description:"该奖励总库存NULL 表示无限)"` // 该奖励总库存NULL 表示无限)
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,21 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// StoreTaskRewards is the golang structure for table store_task_rewards.
type StoreTaskRewards struct {
Id int64 `json:"id" orm:"id" description:"门店奖励记录ID"` // 门店奖励记录ID
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID
TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
StoreRewardId int64 `json:"storeRewardId" orm:"store_reward_id" description:"门店奖励ID"` // 门店奖励ID
IsEnabled int `json:"isEnabled" orm:"is_enabled" description:"是否启用"` // 是否启用
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,33 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// SystemOperationLogs is the golang structure for table system_operation_logs.
type SystemOperationLogs struct {
Id int64 `json:"id" orm:"id" description:"日志ID"` // 日志ID
OperatorType int `json:"operatorType" orm:"operator_type" description:"操作者类型1=系统管理员2=商户管理员3=门店管理员4=普通用户"` // 操作者类型1=系统管理员2=商户管理员3=门店管理员4=普通用户
OperatorId int64 `json:"operatorId" orm:"operator_id" description:"操作者ID"` // 操作者ID
MerchantId int64 `json:"merchantId" orm:"merchant_id" description:"所属商户ID"` // 所属商户ID
StoreId int64 `json:"storeId" orm:"store_id" description:"所属门店ID"` // 所属门店ID
Module string `json:"module" orm:"module" description:"操作模块"` // 操作模块
Action string `json:"action" orm:"action" description:"操作类型"` // 操作类型
TargetType string `json:"targetType" orm:"target_type" description:"操作对象类型"` // 操作对象类型
TargetId int64 `json:"targetId" orm:"target_id" description:"操作对象ID"` // 操作对象ID
Content string `json:"content" orm:"content" description:"操作内容描述"` // 操作内容描述
RequestMethod string `json:"requestMethod" orm:"request_method" description:"请求方法"` // 请求方法
RequestUrl string `json:"requestUrl" orm:"request_url" description:"请求URL"` // 请求URL
RequestParams string `json:"requestParams" orm:"request_params" description:"请求参数"` // 请求参数
ResponseCode int `json:"responseCode" orm:"response_code" description:"响应状态码"` // 响应状态码
ResponseMessage string `json:"responseMessage" orm:"response_message" description:"响应信息"` // 响应信息
IpAddress string `json:"ipAddress" orm:"ip_address" description:"操作IP地址"` // 操作IP地址
UserAgent string `json:"userAgent" orm:"user_agent" description:"用户代理信息"` // 用户代理信息
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"操作时间"` // 操作时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,18 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// Tasks is the golang structure for table tasks.
type Tasks struct {
Id int64 `json:"id" orm:"id" description:"任务ID"` // 任务ID
QqTaskId string `json:"qqTaskId" orm:"qq_task_id" description:"QQ网吧任务ID"` // QQ网吧任务ID
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,24 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserLoginRecords is the golang structure for table user_login_records.
type UserLoginRecords struct {
Id int64 `json:"id" orm:"id" description:"记录ID"` // 记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
StoreId int64 `json:"storeId" orm:"store_id" description:"登录门店ID"` // 登录门店ID
LoginIp string `json:"loginIp" orm:"login_ip" description:"登录IP地址"` // 登录IP地址
LoginPlatform int `json:"loginPlatform" orm:"login_platform" description:"登录平台1=PC"` // 登录平台1=PC
LoginType int `json:"loginType" orm:"login_type" description:"登录方式1=微信2=手机号3=账号密码4=其他"` // 登录方式1=微信2=手机号3=账号密码4=其他
LoginStatus int `json:"loginStatus" orm:"login_status" description:"登录状态1=成功2=失败"` // 登录状态1=成功2=失败
FailReason string `json:"failReason" orm:"fail_reason" description:"失败原因"` // 失败原因
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"登录时间"` // 登录时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
}

View File

@ -1,23 +0,0 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// UserTaskRecords is the golang structure for table user_task_records.
type UserTaskRecords struct {
Id int64 `json:"id" orm:"id" description:"任务记录ID"` // 任务记录ID
UserId int64 `json:"userId" orm:"user_id" description:"用户ID"` // 用户ID
TaskId int64 `json:"taskId" orm:"task_id" description:"任务ID"` // 任务ID
Status int `json:"status" orm:"status" description:"任务状态1=未开始2=进行中3=已完成4=已领取奖励"` // 任务状态1=未开始2=进行中3=已完成4=已领取奖励
Progress int `json:"progress" orm:"progress" description:"任务进度"` // 任务进度
FinishedAt *gtime.Time `json:"finishedAt" orm:"finished_at" description:"完成时间"` // 完成时间
RewardReceivedAt *gtime.Time `json:"rewardReceivedAt" orm:"reward_received_at" description:"领取奖励时间"` // 领取奖励时间
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间"` // 软删除时间
}

View File

@ -17,8 +17,12 @@ type Store struct {
} }
type StoreCreateIn struct { type StoreCreateIn struct {
MerchantAdminId int64 OperatorId int64
Name string OperatorRole string
Name string // 门店名称
Address string // 门店地址
ContactName string // 联系人姓名
ContactPhone string // 联系人电话
} }
type StoreUpdateIn struct { type StoreUpdateIn struct {
@ -50,7 +54,7 @@ type StoreInfoOut struct {
} }
type StoreDeleteIn struct { type StoreDeleteIn struct {
Id int Id int64
OperatorId int OperatorId int
OperatorRole string OperatorRole string
} }

View File

@ -58,6 +58,12 @@ type LoginCache struct {
type UserLoginIn struct { type UserLoginIn struct {
OpenId string OpenId string
} }
type WeChatLogin struct {
UUID string // 使用的是微信的唯一 id而不是openid保证微信服务号小程序绑定的系统用户为同一个
}
type WeChatLoginOut struct {
Token string
}
type UserLoginOut struct { type UserLoginOut struct {
Token string Token string
} }

View File

@ -4,5 +4,6 @@ import (
_ "github.com/gogf/gf/contrib/drivers/mysql/v2" _ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2" _ "github.com/gogf/gf/contrib/nosql/redis/v2"
_ "server/utility/myCasbin" _ "server/utility/myCasbin"
_ "server/utility/snowid"
_ "server/utility/wechat" _ "server/utility/wechat"
) )

View File

@ -13,7 +13,9 @@ import (
type ( type (
IUser interface { IUser interface {
Login(ctx context.Context, in *model.UserLoginIn) (out *model.UserLoginOut, err error) Login(ctx context.Context, in *model.UserLoginIn) (out *model.UserLoginOut, err error)
WeChatLogin(ctx context.Context, in *model.WeChatLogin) (out *model.WeChatLoginOut, err error)
Info(ctx context.Context, in *model.UserInfoIn) (out *model.UserInfoOut, err error) Info(ctx context.Context, in *model.UserInfoIn) (out *model.UserInfoOut, err error)
Code(ctx context.Context, in *model.UserCodeIn) (out *model.UserCodeOut, err error)
Update(ctx context.Context, in *model.UserUpdateIn) (out *model.UpdateOut, err error) Update(ctx context.Context, in *model.UserUpdateIn) (out *model.UpdateOut, err error)
BindPhone(ctx context.Context, in *model.UserBindPhoneIn) (out *model.UpdateOut, err error) BindPhone(ctx context.Context, in *model.UserBindPhoneIn) (out *model.UpdateOut, err error)
List(ctx context.Context, in *model.UserListIn) (out *model.UserListOut, err error) List(ctx context.Context, in *model.UserListIn) (out *model.UserListOut, err error)

52
utility/snowid/snowid.go Normal file
View File

@ -0,0 +1,52 @@
package snowid
import (
"context"
"fmt"
"github.com/bwmarrin/snowflake"
"github.com/gogf/gf/v2/frame/g"
"sync"
)
var (
once sync.Once
instance *snowClient
)
type snowClient struct {
node *snowflake.Node
}
func init() {
ctx := context.Background()
once.Do(func() {
instance = &snowClient{}
instance.node, _ = snowflake.NewNode(g.Config().MustGet(ctx, "snowId.workerId").Int64())
})
}
func GetSnowClient() *snowClient {
return instance
}
// GenerateMerchantCode 生成商户编号
func (c *snowClient) GenerateMerchantCode() (string, error) {
return c.generateCodeWithPrefix("M")
}
// GenerateStoreCode 生成门店编号
func (c *snowClient) GenerateStoreCode() (string, error) {
return c.generateCodeWithPrefix("S")
}
// GenerateUserCode 生成用户编号
func (c *snowClient) GenerateUserCode() (string, error) {
return c.generateCodeWithPrefix("U")
}
func (c *snowClient) generateCodeWithPrefix(prefix string) (string, error) {
if c.node == nil {
return "", fmt.Errorf("雪花节点未初始化")
}
id := c.node.Generate().Int64()
return fmt.Sprintf("%s%d", prefix, id), nil
}