From 77067adf33a45b930087897e99f0ee0a09cd6f64 Mon Sep 17 00:00:00 2001 From: denghui <1016848185@qq.com> Date: Thu, 5 Jun 2025 14:58:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/menu/menu.go | 19 -- api/menu/v1/menu.go | 78 -------- api/store/store.go | 1 - api/store/v1/store.go | 4 - go.mod | 1 + go.sum | 2 + internal/cmd/cmd.go | 2 - internal/controller/menu/menu.go | 5 - internal/controller/menu/menu_new.go | 15 -- .../controller/menu/menu_v1_batch_delete.go | 17 -- internal/controller/menu/menu_v1_create.go | 29 --- internal/controller/menu/menu_v1_delete.go | 17 -- internal/controller/menu/menu_v1_list.go | 20 -- internal/controller/menu/menu_v1_update.go | 30 --- .../controller/store/store_v1_batch_delete.go | 14 -- internal/controller/store/store_v1_create.go | 16 +- internal/controller/store/store_v1_delete.go | 8 +- internal/controller/store/store_v1_list.go | 15 +- internal/controller/store/store_v1_update.go | 15 +- internal/dao/competition_awards.go | 27 --- internal/dao/competition_participants.go | 27 --- internal/dao/competitions.go | 27 --- internal/dao/internal/competition_awards.go | 93 --------- .../dao/internal/competition_participants.go | 87 -------- internal/dao/internal/competitions.go | 99 --------- internal/dao/internal/menus.go | 97 --------- internal/dao/internal/notices.go | 93 --------- internal/dao/internal/reward_distributions.go | 97 --------- internal/dao/internal/role_menus.go | 83 -------- internal/dao/internal/store_rewards.go | 91 --------- internal/dao/internal/store_task_rewards.go | 87 -------- .../dao/internal/system_operation_logs.go | 111 ---------- internal/dao/internal/tasks.go | 81 -------- internal/dao/internal/user_login_records.go | 93 --------- internal/dao/internal/user_task_records.go | 91 --------- internal/dao/menus.go | 27 --- internal/dao/notices.go | 27 --- internal/dao/reward_distributions.go | 27 --- internal/dao/role_menus.go | 27 --- internal/dao/store_rewards.go | 27 --- internal/dao/store_task_rewards.go | 27 --- internal/dao/system_operation_logs.go | 27 --- internal/dao/tasks.go | 27 --- internal/dao/user_login_records.go | 27 --- internal/dao/user_task_records.go | 27 --- internal/logic/logic.go | 1 - internal/logic/menu/menu.go | 189 ------------------ internal/logic/merchantAdmin/merchantAdmin.go | 8 +- internal/logic/store/store.go | 19 +- internal/logic/user/user.go | 3 + internal/model/do/competition_awards.go | 26 --- internal/model/do/competition_participants.go | 23 --- internal/model/do/competitions.go | 29 --- internal/model/do/menus.go | 28 --- internal/model/do/merchants.go | 1 + internal/model/do/notices.go | 26 --- internal/model/do/reward_distributions.go | 28 --- internal/model/do/role_menus.go | 21 -- internal/model/do/store_rewards.go | 25 --- internal/model/do/store_task_rewards.go | 23 --- internal/model/do/system_operation_logs.go | 35 ---- internal/model/do/tasks.go | 20 -- internal/model/do/user_login_records.go | 26 --- internal/model/do/user_task_records.go | 25 --- internal/model/entity/competition_awards.go | 24 --- .../model/entity/competition_participants.go | 21 -- internal/model/entity/competitions.go | 27 --- internal/model/entity/menus.go | 26 --- internal/model/entity/merchants.go | 1 + internal/model/entity/notices.go | 24 --- internal/model/entity/reward_distributions.go | 26 --- internal/model/entity/role_menus.go | 19 -- internal/model/entity/store_rewards.go | 23 --- internal/model/entity/store_task_rewards.go | 21 -- .../model/entity/system_operation_logs.go | 33 --- internal/model/entity/tasks.go | 18 -- internal/model/entity/user_login_records.go | 24 --- internal/model/entity/user_task_records.go | 23 --- internal/model/store.go | 10 +- internal/model/user.go | 6 + internal/packed/packed.go | 1 + internal/service/user.go | 2 + utility/snowid/snowid.go | 52 +++++ 83 files changed, 137 insertions(+), 2662 deletions(-) delete mode 100644 api/menu/menu.go delete mode 100644 api/menu/v1/menu.go delete mode 100644 internal/controller/menu/menu.go delete mode 100644 internal/controller/menu/menu_new.go delete mode 100644 internal/controller/menu/menu_v1_batch_delete.go delete mode 100644 internal/controller/menu/menu_v1_create.go delete mode 100644 internal/controller/menu/menu_v1_delete.go delete mode 100644 internal/controller/menu/menu_v1_list.go delete mode 100644 internal/controller/menu/menu_v1_update.go delete mode 100644 internal/controller/store/store_v1_batch_delete.go delete mode 100644 internal/dao/competition_awards.go delete mode 100644 internal/dao/competition_participants.go delete mode 100644 internal/dao/competitions.go delete mode 100644 internal/dao/internal/competition_awards.go delete mode 100644 internal/dao/internal/competition_participants.go delete mode 100644 internal/dao/internal/competitions.go delete mode 100644 internal/dao/internal/menus.go delete mode 100644 internal/dao/internal/notices.go delete mode 100644 internal/dao/internal/reward_distributions.go delete mode 100644 internal/dao/internal/role_menus.go delete mode 100644 internal/dao/internal/store_rewards.go delete mode 100644 internal/dao/internal/store_task_rewards.go delete mode 100644 internal/dao/internal/system_operation_logs.go delete mode 100644 internal/dao/internal/tasks.go delete mode 100644 internal/dao/internal/user_login_records.go delete mode 100644 internal/dao/internal/user_task_records.go delete mode 100644 internal/dao/menus.go delete mode 100644 internal/dao/notices.go delete mode 100644 internal/dao/reward_distributions.go delete mode 100644 internal/dao/role_menus.go delete mode 100644 internal/dao/store_rewards.go delete mode 100644 internal/dao/store_task_rewards.go delete mode 100644 internal/dao/system_operation_logs.go delete mode 100644 internal/dao/tasks.go delete mode 100644 internal/dao/user_login_records.go delete mode 100644 internal/dao/user_task_records.go delete mode 100644 internal/logic/menu/menu.go delete mode 100644 internal/model/do/competition_awards.go delete mode 100644 internal/model/do/competition_participants.go delete mode 100644 internal/model/do/competitions.go delete mode 100644 internal/model/do/menus.go delete mode 100644 internal/model/do/notices.go delete mode 100644 internal/model/do/reward_distributions.go delete mode 100644 internal/model/do/role_menus.go delete mode 100644 internal/model/do/store_rewards.go delete mode 100644 internal/model/do/store_task_rewards.go delete mode 100644 internal/model/do/system_operation_logs.go delete mode 100644 internal/model/do/tasks.go delete mode 100644 internal/model/do/user_login_records.go delete mode 100644 internal/model/do/user_task_records.go delete mode 100644 internal/model/entity/competition_awards.go delete mode 100644 internal/model/entity/competition_participants.go delete mode 100644 internal/model/entity/competitions.go delete mode 100644 internal/model/entity/menus.go delete mode 100644 internal/model/entity/notices.go delete mode 100644 internal/model/entity/reward_distributions.go delete mode 100644 internal/model/entity/role_menus.go delete mode 100644 internal/model/entity/store_rewards.go delete mode 100644 internal/model/entity/store_task_rewards.go delete mode 100644 internal/model/entity/system_operation_logs.go delete mode 100644 internal/model/entity/tasks.go delete mode 100644 internal/model/entity/user_login_records.go delete mode 100644 internal/model/entity/user_task_records.go create mode 100644 utility/snowid/snowid.go diff --git a/api/menu/menu.go b/api/menu/menu.go deleted file mode 100644 index 2452f61..0000000 --- a/api/menu/menu.go +++ /dev/null @@ -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) -} diff --git a/api/menu/v1/menu.go b/api/menu/v1/menu.go deleted file mode 100644 index ba4ec01..0000000 --- a/api/menu/v1/menu.go +++ /dev/null @@ -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 数组"` -} diff --git a/api/store/store.go b/api/store/store.go index 8dace67..4286374 100644 --- a/api/store/store.go +++ b/api/store/store.go @@ -15,5 +15,4 @@ type IStoreV1 interface { 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) } diff --git a/api/store/v1/store.go b/api/store/v1/store.go index 4278a3a..9b4018e 100644 --- a/api/store/v1/store.go +++ b/api/store/v1/store.go @@ -42,7 +42,3 @@ type DeleteReq struct { type DeleteRes struct { 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"` -} diff --git a/go.mod b/go.mod index d295aa3..c26eec1 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.24.2 require ( 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/go-resty/resty/v2 v2.16.5 github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.0 diff --git a/go.sum b/go.sum index 8cc4620..47e423a 100644 --- a/go.sum +++ b/go.sum @@ -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/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= 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/go.mod h1:Ee33aqGrmES+GNL17L0h9X28wXuo829wnNUnS0edAco= github.com/casbin/govaluate v1.3.0 h1:VA0eSY0M2lA86dYd5kPPuNZMUD9QkWnOCnavGrw9myc= diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 6f7a76f..2739cac 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -7,7 +7,6 @@ import ( "github.com/gogf/gf/v2/os/gcmd" "server/internal/controller/admin" "server/internal/controller/auth" - "server/internal/controller/menu" "server/internal/controller/merchant" "server/internal/controller/rewardType" "server/internal/controller/role" @@ -35,7 +34,6 @@ var ( group.Bind( admin.NewV1(), role.NewV1(), - menu.NewV1(), merchant.NewV1(), rewardType.NewV1(), ) diff --git a/internal/controller/menu/menu.go b/internal/controller/menu/menu.go deleted file mode 100644 index a31abe9..0000000 --- a/internal/controller/menu/menu.go +++ /dev/null @@ -1,5 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package menu diff --git a/internal/controller/menu/menu_new.go b/internal/controller/menu/menu_new.go deleted file mode 100644 index bb736ad..0000000 --- a/internal/controller/menu/menu_new.go +++ /dev/null @@ -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{} -} diff --git a/internal/controller/menu/menu_v1_batch_delete.go b/internal/controller/menu/menu_v1_batch_delete.go deleted file mode 100644 index 81328ea..0000000 --- a/internal/controller/menu/menu_v1_batch_delete.go +++ /dev/null @@ -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 -} diff --git a/internal/controller/menu/menu_v1_create.go b/internal/controller/menu/menu_v1_create.go deleted file mode 100644 index 7c5bc16..0000000 --- a/internal/controller/menu/menu_v1_create.go +++ /dev/null @@ -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 -} diff --git a/internal/controller/menu/menu_v1_delete.go b/internal/controller/menu/menu_v1_delete.go deleted file mode 100644 index 2a809c0..0000000 --- a/internal/controller/menu/menu_v1_delete.go +++ /dev/null @@ -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 -} diff --git a/internal/controller/menu/menu_v1_list.go b/internal/controller/menu/menu_v1_list.go deleted file mode 100644 index 50141ac..0000000 --- a/internal/controller/menu/menu_v1_list.go +++ /dev/null @@ -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 -} diff --git a/internal/controller/menu/menu_v1_update.go b/internal/controller/menu/menu_v1_update.go deleted file mode 100644 index fae5639..0000000 --- a/internal/controller/menu/menu_v1_update.go +++ /dev/null @@ -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 -} diff --git a/internal/controller/store/store_v1_batch_delete.go b/internal/controller/store/store_v1_batch_delete.go deleted file mode 100644 index 021be95..0000000 --- a/internal/controller/store/store_v1_batch_delete.go +++ /dev/null @@ -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) -} diff --git a/internal/controller/store/store_v1_create.go b/internal/controller/store/store_v1_create.go index fb7c63f..aa0c1ed 100644 --- a/internal/controller/store/store_v1_create.go +++ b/internal/controller/store/store_v1_create.go @@ -2,13 +2,19 @@ package store import ( "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - + "github.com/gogf/gf/v2/frame/g" "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) { - 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 } diff --git a/internal/controller/store/store_v1_delete.go b/internal/controller/store/store_v1_delete.go index a9bb75f..7792cef 100644 --- a/internal/controller/store/store_v1_delete.go +++ b/internal/controller/store/store_v1_delete.go @@ -2,13 +2,19 @@ package store import ( "context" - "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "server/internal/model" + "server/internal/service" "server/api/store/v1" ) 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) } diff --git a/internal/controller/store/store_v1_list.go b/internal/controller/store/store_v1_list.go index 43846ef..45d1bf2 100644 --- a/internal/controller/store/store_v1_list.go +++ b/internal/controller/store/store_v1_list.go @@ -2,13 +2,20 @@ package store import ( "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" + "server/internal/model" + "server/internal/service" "server/api/store/v1" ) 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 + } diff --git a/internal/controller/store/store_v1_update.go b/internal/controller/store/store_v1_update.go index 90d7abe..f117813 100644 --- a/internal/controller/store/store_v1_update.go +++ b/internal/controller/store/store_v1_update.go @@ -2,13 +2,20 @@ package store import ( "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "server/internal/model" + "server/internal/service" "server/api/store/v1" ) 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 } diff --git a/internal/dao/competition_awards.go b/internal/dao/competition_awards.go deleted file mode 100644 index 0820a29..0000000 --- a/internal/dao/competition_awards.go +++ /dev/null @@ -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. diff --git a/internal/dao/competition_participants.go b/internal/dao/competition_participants.go deleted file mode 100644 index 251707a..0000000 --- a/internal/dao/competition_participants.go +++ /dev/null @@ -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. diff --git a/internal/dao/competitions.go b/internal/dao/competitions.go deleted file mode 100644 index a3c50d6..0000000 --- a/internal/dao/competitions.go +++ /dev/null @@ -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. diff --git a/internal/dao/internal/competition_awards.go b/internal/dao/internal/competition_awards.go deleted file mode 100644 index a20551b..0000000 --- a/internal/dao/internal/competition_awards.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/competition_participants.go b/internal/dao/internal/competition_participants.go deleted file mode 100644 index 515d13c..0000000 --- a/internal/dao/internal/competition_participants.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/competitions.go b/internal/dao/internal/competitions.go deleted file mode 100644 index 0642e30..0000000 --- a/internal/dao/internal/competitions.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/menus.go b/internal/dao/internal/menus.go deleted file mode 100644 index 1636080..0000000 --- a/internal/dao/internal/menus.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/notices.go b/internal/dao/internal/notices.go deleted file mode 100644 index 5cc451a..0000000 --- a/internal/dao/internal/notices.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/reward_distributions.go b/internal/dao/internal/reward_distributions.go deleted file mode 100644 index 52937b1..0000000 --- a/internal/dao/internal/reward_distributions.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/role_menus.go b/internal/dao/internal/role_menus.go deleted file mode 100644 index 4747f79..0000000 --- a/internal/dao/internal/role_menus.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/store_rewards.go b/internal/dao/internal/store_rewards.go deleted file mode 100644 index d73c126..0000000 --- a/internal/dao/internal/store_rewards.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/store_task_rewards.go b/internal/dao/internal/store_task_rewards.go deleted file mode 100644 index 6baa6c1..0000000 --- a/internal/dao/internal/store_task_rewards.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/system_operation_logs.go b/internal/dao/internal/system_operation_logs.go deleted file mode 100644 index 2ab3be3..0000000 --- a/internal/dao/internal/system_operation_logs.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/tasks.go b/internal/dao/internal/tasks.go deleted file mode 100644 index 298c5f8..0000000 --- a/internal/dao/internal/tasks.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/user_login_records.go b/internal/dao/internal/user_login_records.go deleted file mode 100644 index 9fc2e0b..0000000 --- a/internal/dao/internal/user_login_records.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/internal/user_task_records.go b/internal/dao/internal/user_task_records.go deleted file mode 100644 index 36cd480..0000000 --- a/internal/dao/internal/user_task_records.go +++ /dev/null @@ -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) -} diff --git a/internal/dao/menus.go b/internal/dao/menus.go deleted file mode 100644 index ffc6e1d..0000000 --- a/internal/dao/menus.go +++ /dev/null @@ -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. diff --git a/internal/dao/notices.go b/internal/dao/notices.go deleted file mode 100644 index 872ffbb..0000000 --- a/internal/dao/notices.go +++ /dev/null @@ -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. diff --git a/internal/dao/reward_distributions.go b/internal/dao/reward_distributions.go deleted file mode 100644 index b82d143..0000000 --- a/internal/dao/reward_distributions.go +++ /dev/null @@ -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. diff --git a/internal/dao/role_menus.go b/internal/dao/role_menus.go deleted file mode 100644 index ad3e6fc..0000000 --- a/internal/dao/role_menus.go +++ /dev/null @@ -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. diff --git a/internal/dao/store_rewards.go b/internal/dao/store_rewards.go deleted file mode 100644 index d925850..0000000 --- a/internal/dao/store_rewards.go +++ /dev/null @@ -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. diff --git a/internal/dao/store_task_rewards.go b/internal/dao/store_task_rewards.go deleted file mode 100644 index d3c923e..0000000 --- a/internal/dao/store_task_rewards.go +++ /dev/null @@ -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. diff --git a/internal/dao/system_operation_logs.go b/internal/dao/system_operation_logs.go deleted file mode 100644 index e51b65c..0000000 --- a/internal/dao/system_operation_logs.go +++ /dev/null @@ -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. diff --git a/internal/dao/tasks.go b/internal/dao/tasks.go deleted file mode 100644 index e3e2e27..0000000 --- a/internal/dao/tasks.go +++ /dev/null @@ -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. diff --git a/internal/dao/user_login_records.go b/internal/dao/user_login_records.go deleted file mode 100644 index a3c1c3e..0000000 --- a/internal/dao/user_login_records.go +++ /dev/null @@ -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. diff --git a/internal/dao/user_task_records.go b/internal/dao/user_task_records.go deleted file mode 100644 index e4c294d..0000000 --- a/internal/dao/user_task_records.go +++ /dev/null @@ -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. diff --git a/internal/logic/logic.go b/internal/logic/logic.go index a018f76..f6ea15f 100644 --- a/internal/logic/logic.go +++ b/internal/logic/logic.go @@ -6,7 +6,6 @@ package logic import ( _ "server/internal/logic/admin" - _ "server/internal/logic/menu" _ "server/internal/logic/merchant" _ "server/internal/logic/merchantAdmin" _ "server/internal/logic/rewardType" diff --git a/internal/logic/menu/menu.go b/internal/logic/menu/menu.go deleted file mode 100644 index e5fcc7a..0000000 --- a/internal/logic/menu/menu.go +++ /dev/null @@ -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 -} diff --git a/internal/logic/merchantAdmin/merchantAdmin.go b/internal/logic/merchantAdmin/merchantAdmin.go index 0a3d5af..ceb9e9a 100644 --- a/internal/logic/merchantAdmin/merchantAdmin.go +++ b/internal/logic/merchantAdmin/merchantAdmin.go @@ -17,6 +17,7 @@ import ( "server/utility/ecode" utility "server/utility/encrypt" "server/utility/jwt" + "server/utility/snowid" ) 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) { // 插入商户数据 + generateCode, err := snowid.GetSnowClient().GenerateMerchantCode() + if err != nil { + return ecode.Fail.Sub("生成商户编号失败") + } 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, Status: consts.MerchantDisabledStatus, AuditStatus: consts.MerchantPendingReview, diff --git a/internal/logic/store/store.go b/internal/logic/store/store.go index 4ef5490..c358bb6 100644 --- a/internal/logic/store/store.go +++ b/internal/logic/store/store.go @@ -9,6 +9,7 @@ import ( "server/internal/model/do" "server/internal/service" "server/utility/ecode" + "server/utility/snowid" ) type sStore struct { @@ -39,21 +40,29 @@ func (s *sStore) Create(ctx context.Context, in *model.StoreCreateIn) (out *mode // 2. 使用事务处理数据插入 if err = dao.Stores.Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { // 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 { return ecode.Fail.Sub("获取商户ID出现异常") } // 2,2 生成门店的相关信息 - + code, err := snowid.GetSnowClient().GenerateStoreCode() + if err != nil { + return ecode.Fail.Sub("生成门店ID出现异常") + } // 2.3 插入门店数据 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() if err != nil { return ecode.Fail.Sub("新增门店出现异常") } - //2.4 生成门店主管理账号 + // TODO 生成门店主管理账号,密码通知方式 // 2.5 插入门店管理员数据 _, 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 { return ecode.Fail.Sub("新增门店管理员出现异常") } + out.Id = id return nil }); err != nil { return nil, err } - return } diff --git a/internal/logic/user/user.go b/internal/logic/user/user.go index 393a927..4d1a7f4 100644 --- a/internal/logic/user/user.go +++ b/internal/logic/user/user.go @@ -98,6 +98,9 @@ func (s *sUser) Login(ctx context.Context, in *model.UserLoginIn) (out *model.Us } 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) { exist, err := dao.Users.Ctx(ctx).Where(do.Users{WxOpenId: in.OpenId, Id: in.Id}).OmitEmptyWhere().Exist() diff --git a/internal/model/do/competition_awards.go b/internal/model/do/competition_awards.go deleted file mode 100644 index b9aa6c7..0000000 --- a/internal/model/do/competition_awards.go +++ /dev/null @@ -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 // 软删除时间 -} diff --git a/internal/model/do/competition_participants.go b/internal/model/do/competition_participants.go deleted file mode 100644 index 3c8c791..0000000 --- a/internal/model/do/competition_participants.go +++ /dev/null @@ -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 // 软删除时间 -} diff --git a/internal/model/do/competitions.go b/internal/model/do/competitions.go deleted file mode 100644 index 9a68aa0..0000000 --- a/internal/model/do/competitions.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/menus.go b/internal/model/do/menus.go deleted file mode 100644 index b852d95..0000000 --- a/internal/model/do/menus.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/merchants.go b/internal/model/do/merchants.go index 4c8d116..13524f7 100644 --- a/internal/model/do/merchants.go +++ b/internal/model/do/merchants.go @@ -33,4 +33,5 @@ type Merchants struct { AuditAt *gtime.Time // 审核时间 AuditRemark interface{} // 审核备注 RejectReason interface{} // 拒绝原因 + MerchantCode interface{} // 商户编号 } diff --git a/internal/model/do/notices.go b/internal/model/do/notices.go deleted file mode 100644 index aa212ea..0000000 --- a/internal/model/do/notices.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/reward_distributions.go b/internal/model/do/reward_distributions.go deleted file mode 100644 index 797c9ae..0000000 --- a/internal/model/do/reward_distributions.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/role_menus.go b/internal/model/do/role_menus.go deleted file mode 100644 index a9b2d66..0000000 --- a/internal/model/do/role_menus.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/store_rewards.go b/internal/model/do/store_rewards.go deleted file mode 100644 index 54fb7f3..0000000 --- a/internal/model/do/store_rewards.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/store_task_rewards.go b/internal/model/do/store_task_rewards.go deleted file mode 100644 index da7de1b..0000000 --- a/internal/model/do/store_task_rewards.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/system_operation_logs.go b/internal/model/do/system_operation_logs.go deleted file mode 100644 index fda3480..0000000 --- a/internal/model/do/system_operation_logs.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/tasks.go b/internal/model/do/tasks.go deleted file mode 100644 index d3e3331..0000000 --- a/internal/model/do/tasks.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/user_login_records.go b/internal/model/do/user_login_records.go deleted file mode 100644 index aa84fae..0000000 --- a/internal/model/do/user_login_records.go +++ /dev/null @@ -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 // 软删除时间戳 -} diff --git a/internal/model/do/user_task_records.go b/internal/model/do/user_task_records.go deleted file mode 100644 index f5ec6f3..0000000 --- a/internal/model/do/user_task_records.go +++ /dev/null @@ -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 // 软删除时间 -} diff --git a/internal/model/entity/competition_awards.go b/internal/model/entity/competition_awards.go deleted file mode 100644 index 2b4815a..0000000 --- a/internal/model/entity/competition_awards.go +++ /dev/null @@ -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:"软删除时间"` // 软删除时间 -} diff --git a/internal/model/entity/competition_participants.go b/internal/model/entity/competition_participants.go deleted file mode 100644 index ad3033c..0000000 --- a/internal/model/entity/competition_participants.go +++ /dev/null @@ -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:"软删除时间"` // 软删除时间 -} diff --git a/internal/model/entity/competitions.go b/internal/model/entity/competitions.go deleted file mode 100644 index b86a6fe..0000000 --- a/internal/model/entity/competitions.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/menus.go b/internal/model/entity/menus.go deleted file mode 100644 index b82dcfb..0000000 --- a/internal/model/entity/menus.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/merchants.go b/internal/model/entity/merchants.go index 8c2b58e..0bc728a 100644 --- a/internal/model/entity/merchants.go +++ b/internal/model/entity/merchants.go @@ -31,4 +31,5 @@ type Merchants struct { AuditAt *gtime.Time `json:"auditAt" orm:"audit_at" description:"审核时间"` // 审核时间 AuditRemark string `json:"auditRemark" orm:"audit_remark" description:"审核备注"` // 审核备注 RejectReason string `json:"rejectReason" orm:"reject_reason" description:"拒绝原因"` // 拒绝原因 + MerchantCode string `json:"merchantCode" orm:"merchant_code" description:"商户编号"` // 商户编号 } diff --git a/internal/model/entity/notices.go b/internal/model/entity/notices.go deleted file mode 100644 index b322ef0..0000000 --- a/internal/model/entity/notices.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/reward_distributions.go b/internal/model/entity/reward_distributions.go deleted file mode 100644 index 102db18..0000000 --- a/internal/model/entity/reward_distributions.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/role_menus.go b/internal/model/entity/role_menus.go deleted file mode 100644 index e085667..0000000 --- a/internal/model/entity/role_menus.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/store_rewards.go b/internal/model/entity/store_rewards.go deleted file mode 100644 index 24bb49d..0000000 --- a/internal/model/entity/store_rewards.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/store_task_rewards.go b/internal/model/entity/store_task_rewards.go deleted file mode 100644 index 7c6c429..0000000 --- a/internal/model/entity/store_task_rewards.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/system_operation_logs.go b/internal/model/entity/system_operation_logs.go deleted file mode 100644 index c11c3ea..0000000 --- a/internal/model/entity/system_operation_logs.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/tasks.go b/internal/model/entity/tasks.go deleted file mode 100644 index f5c20eb..0000000 --- a/internal/model/entity/tasks.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/user_login_records.go b/internal/model/entity/user_login_records.go deleted file mode 100644 index 54da8d7..0000000 --- a/internal/model/entity/user_login_records.go +++ /dev/null @@ -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:"软删除时间戳"` // 软删除时间戳 -} diff --git a/internal/model/entity/user_task_records.go b/internal/model/entity/user_task_records.go deleted file mode 100644 index 22d33d7..0000000 --- a/internal/model/entity/user_task_records.go +++ /dev/null @@ -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:"软删除时间"` // 软删除时间 -} diff --git a/internal/model/store.go b/internal/model/store.go index 555416f..9b29bd7 100644 --- a/internal/model/store.go +++ b/internal/model/store.go @@ -17,8 +17,12 @@ type Store struct { } type StoreCreateIn struct { - MerchantAdminId int64 - Name string + OperatorId int64 + OperatorRole string + Name string // 门店名称 + Address string // 门店地址 + ContactName string // 联系人姓名 + ContactPhone string // 联系人电话 } type StoreUpdateIn struct { @@ -50,7 +54,7 @@ type StoreInfoOut struct { } type StoreDeleteIn struct { - Id int + Id int64 OperatorId int OperatorRole string } diff --git a/internal/model/user.go b/internal/model/user.go index 5a03eca..be1aa35 100644 --- a/internal/model/user.go +++ b/internal/model/user.go @@ -58,6 +58,12 @@ type LoginCache struct { type UserLoginIn struct { OpenId string } +type WeChatLogin struct { + UUID string // 使用的是微信的唯一 id,而不是openid,保证微信服务号,小程序绑定的系统用户为同一个 +} +type WeChatLoginOut struct { + Token string +} type UserLoginOut struct { Token string } diff --git a/internal/packed/packed.go b/internal/packed/packed.go index a3e727f..921e39a 100644 --- a/internal/packed/packed.go +++ b/internal/packed/packed.go @@ -4,5 +4,6 @@ import ( _ "github.com/gogf/gf/contrib/drivers/mysql/v2" _ "github.com/gogf/gf/contrib/nosql/redis/v2" _ "server/utility/myCasbin" + _ "server/utility/snowid" _ "server/utility/wechat" ) diff --git a/internal/service/user.go b/internal/service/user.go index 90baae2..98e9689 100644 --- a/internal/service/user.go +++ b/internal/service/user.go @@ -13,7 +13,9 @@ import ( type ( IUser interface { 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) + Code(ctx context.Context, in *model.UserCodeIn) (out *model.UserCodeOut, 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) List(ctx context.Context, in *model.UserListIn) (out *model.UserListOut, err error) diff --git a/utility/snowid/snowid.go b/utility/snowid/snowid.go new file mode 100644 index 0000000..b7a0bbf --- /dev/null +++ b/utility/snowid/snowid.go @@ -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 +}