实现门店桌面设置相关配置

This commit is contained in:
2025-06-19 18:01:47 +08:00
parent fcdc44b94e
commit a25068154f
35 changed files with 372 additions and 335 deletions

16
api/desktop/desktop.go Normal file
View File

@ -0,0 +1,16 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package desktop
import (
"context"
"server/api/desktop/v1"
)
type IDesktopV1 interface {
Get(ctx context.Context, req *v1.GetReq) (res *v1.GetRes, err error)
Save(ctx context.Context, req *v1.SaveReq) (res *v1.SaveRes, err error)
}

22
api/desktop/v1/desktop.go Normal file
View File

@ -0,0 +1,22 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
type GetReq struct {
g.Meta `path:"/desktop" method:"get" tags:"Desktop" summary:"(PC)获取桌面信息"`
StoreId int64 `json:"storeId" v:"required#请选择店铺" dc:"门店id"`
}
type GetRes struct {
TopComponentVisible int `json:"topComponentVisible"`
RightComponentVisible int `json:"rightComponentVisible"`
}
type SaveReq struct {
g.Meta `path:"/desktop" method:"post" tags:"Desktop" summary:"(PC)保存桌面信息"`
StoreId int64 `json:"storeId" v:"required#请选择店铺" dc:"门店id"`
TopComponentVisible int `json:"topComponentVisible" v:"in:1,2#显示隐藏只能选择1或2"`
RightComponentVisible int `json:"rightComponentVisible" v:"in:1,2#显示隐藏只能选择1或2"`
}
type SaveRes struct {
Success bool `json:"success" dc:"是否成功"`
}

View File

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

View File

@ -59,3 +59,5 @@ type CallbackReq struct {
g.Meta `path:"/reward/callback" method:"post" tags:"Reward" summary:"(tencent)回调"` g.Meta `path:"/reward/callback" method:"post" tags:"Reward" summary:"(tencent)回调"`
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"` UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
} }
type CallbackRes struct {
}

View File

@ -7,6 +7,7 @@ import (
"github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gcmd"
"server/internal/controller/admin" "server/internal/controller/admin"
"server/internal/controller/auth" "server/internal/controller/auth"
"server/internal/controller/desktop"
"server/internal/controller/feedback" "server/internal/controller/feedback"
"server/internal/controller/game" "server/internal/controller/game"
"server/internal/controller/merchant" "server/internal/controller/merchant"
@ -58,6 +59,7 @@ var (
rewardType.NewV1(), rewardType.NewV1(),
reward.NewV1(), reward.NewV1(),
storeTaskReward.NewV1(), storeTaskReward.NewV1(),
desktop.NewV1(),
) )
}) })
}) })

View File

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

View File

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

View File

@ -0,0 +1,19 @@
package desktop
import (
"context"
"server/internal/service"
"server/api/desktop/v1"
)
func (c *ControllerV1) Get(ctx context.Context, req *v1.GetReq) (res *v1.GetRes, err error) {
out, err := service.StoreDesktopSetting().Get(ctx, req.StoreId)
if err != nil {
return nil, err
}
return &v1.GetRes{
RightComponentVisible: out.RightComponentVisible,
TopComponentVisible: out.TopComponentVisible,
}, nil
}

View File

@ -0,0 +1,23 @@
package desktop
import (
"context"
"server/internal/model"
"server/internal/service"
"server/api/desktop/v1"
)
func (c *ControllerV1) Save(ctx context.Context, req *v1.SaveReq) (res *v1.SaveRes, err error) {
out, err := service.StoreDesktopSetting().Save(ctx, model.SaveDesktopSettingIn{
RightComponentVisible: req.RightComponentVisible,
StoreId: req.StoreId,
TopComponentVisible: req.TopComponentVisible,
})
if err != nil {
return nil, err
}
return &v1.SaveRes{
Success: out.Success,
}, nil
}

View File

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

View File

@ -13,10 +13,9 @@ import (
// AdminsDao is the data access object for the table admins. // AdminsDao is the data access object for the table admins.
type AdminsDao struct { type AdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns AdminsColumns // columns contains all the column names of Table for convenient usage. columns AdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// AdminsColumns defines and stores column names for the table admins. // AdminsColumns defines and stores column names for the table admins.
@ -50,12 +49,11 @@ var adminsColumns = AdminsColumns{
} }
// NewAdminsDao creates and returns a new DAO object for table data access. // NewAdminsDao creates and returns a new DAO object for table data access.
func NewAdminsDao(handlers ...gdb.ModelHandler) *AdminsDao { func NewAdminsDao() *AdminsDao {
return &AdminsDao{ return &AdminsDao{
group: "default", group: "default",
table: "admins", table: "admins",
columns: adminsColumns, columns: adminsColumns,
handlers: handlers,
} }
} }
@ -81,11 +79,7 @@ func (dao *AdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *AdminsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// FeedbacksDao is the data access object for the table feedbacks. // FeedbacksDao is the data access object for the table feedbacks.
type FeedbacksDao struct { type FeedbacksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns FeedbacksColumns // columns contains all the column names of Table for convenient usage. columns FeedbacksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// FeedbacksColumns defines and stores column names for the table feedbacks. // FeedbacksColumns defines and stores column names for the table feedbacks.
@ -52,12 +51,11 @@ var feedbacksColumns = FeedbacksColumns{
} }
// NewFeedbacksDao creates and returns a new DAO object for table data access. // NewFeedbacksDao creates and returns a new DAO object for table data access.
func NewFeedbacksDao(handlers ...gdb.ModelHandler) *FeedbacksDao { func NewFeedbacksDao() *FeedbacksDao {
return &FeedbacksDao{ return &FeedbacksDao{
group: "default", group: "default",
table: "feedbacks", table: "feedbacks",
columns: feedbacksColumns, columns: feedbacksColumns,
handlers: handlers,
} }
} }
@ -83,11 +81,7 @@ func (dao *FeedbacksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model { func (dao *FeedbacksDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// GamesDao is the data access object for the table games. // GamesDao is the data access object for the table games.
type GamesDao struct { type GamesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns GamesColumns // columns contains all the column names of Table for convenient usage. columns GamesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// GamesColumns defines and stores column names for the table games. // GamesColumns defines and stores column names for the table games.
@ -46,12 +45,11 @@ var gamesColumns = GamesColumns{
} }
// NewGamesDao creates and returns a new DAO object for table data access. // NewGamesDao creates and returns a new DAO object for table data access.
func NewGamesDao(handlers ...gdb.ModelHandler) *GamesDao { func NewGamesDao() *GamesDao {
return &GamesDao{ return &GamesDao{
group: "default", group: "default",
table: "games", table: "games",
columns: gamesColumns, columns: gamesColumns,
handlers: handlers,
} }
} }
@ -77,11 +75,7 @@ func (dao *GamesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model { func (dao *GamesDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// MerchantAdminsDao is the data access object for the table merchant_admins. // MerchantAdminsDao is the data access object for the table merchant_admins.
type MerchantAdminsDao struct { type MerchantAdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage. columns MerchantAdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// MerchantAdminsColumns defines and stores column names for the table merchant_admins. // MerchantAdminsColumns defines and stores column names for the table merchant_admins.
@ -58,12 +57,11 @@ var merchantAdminsColumns = MerchantAdminsColumns{
} }
// NewMerchantAdminsDao creates and returns a new DAO object for table data access. // NewMerchantAdminsDao creates and returns a new DAO object for table data access.
func NewMerchantAdminsDao(handlers ...gdb.ModelHandler) *MerchantAdminsDao { func NewMerchantAdminsDao() *MerchantAdminsDao {
return &MerchantAdminsDao{ return &MerchantAdminsDao{
group: "default", group: "default",
table: "merchant_admins", table: "merchant_admins",
columns: merchantAdminsColumns, columns: merchantAdminsColumns,
handlers: handlers,
} }
} }
@ -89,11 +87,7 @@ func (dao *MerchantAdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *MerchantAdminsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// MerchantsDao is the data access object for the table merchants. // MerchantsDao is the data access object for the table merchants.
type MerchantsDao struct { type MerchantsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns MerchantsColumns // columns contains all the column names of Table for convenient usage. columns MerchantsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// MerchantsColumns defines and stores column names for the table merchants. // MerchantsColumns defines and stores column names for the table merchants.
@ -72,12 +71,11 @@ var merchantsColumns = MerchantsColumns{
} }
// NewMerchantsDao creates and returns a new DAO object for table data access. // NewMerchantsDao creates and returns a new DAO object for table data access.
func NewMerchantsDao(handlers ...gdb.ModelHandler) *MerchantsDao { func NewMerchantsDao() *MerchantsDao {
return &MerchantsDao{ return &MerchantsDao{
group: "default", group: "default",
table: "merchants", table: "merchants",
columns: merchantsColumns, columns: merchantsColumns,
handlers: handlers,
} }
} }
@ -103,11 +101,7 @@ func (dao *MerchantsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// RewardTypesDao is the data access object for the table reward_types. // RewardTypesDao is the data access object for the table reward_types.
type RewardTypesDao struct { type RewardTypesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns RewardTypesColumns // columns contains all the column names of Table for convenient usage. columns RewardTypesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// RewardTypesColumns defines and stores column names for the table reward_types. // RewardTypesColumns defines and stores column names for the table reward_types.
@ -46,12 +45,11 @@ var rewardTypesColumns = RewardTypesColumns{
} }
// NewRewardTypesDao creates and returns a new DAO object for table data access. // NewRewardTypesDao creates and returns a new DAO object for table data access.
func NewRewardTypesDao(handlers ...gdb.ModelHandler) *RewardTypesDao { func NewRewardTypesDao() *RewardTypesDao {
return &RewardTypesDao{ return &RewardTypesDao{
group: "default", group: "default",
table: "reward_types", table: "reward_types",
columns: rewardTypesColumns, columns: rewardTypesColumns,
handlers: handlers,
} }
} }
@ -77,11 +75,7 @@ func (dao *RewardTypesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model { func (dao *RewardTypesDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// RewardsDao is the data access object for the table rewards. // RewardsDao is the data access object for the table rewards.
type RewardsDao struct { type RewardsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns RewardsColumns // columns contains all the column names of Table for convenient usage. columns RewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// RewardsColumns defines and stores column names for the table rewards. // RewardsColumns defines and stores column names for the table rewards.
@ -54,12 +53,11 @@ var rewardsColumns = RewardsColumns{
} }
// NewRewardsDao creates and returns a new DAO object for table data access. // NewRewardsDao creates and returns a new DAO object for table data access.
func NewRewardsDao(handlers ...gdb.ModelHandler) *RewardsDao { func NewRewardsDao() *RewardsDao {
return &RewardsDao{ return &RewardsDao{
group: "default", group: "default",
table: "rewards", table: "rewards",
columns: rewardsColumns, columns: rewardsColumns,
handlers: handlers,
} }
} }
@ -85,11 +83,7 @@ func (dao *RewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *RewardsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// RolesDao is the data access object for the table roles. // RolesDao is the data access object for the table roles.
type RolesDao struct { type RolesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns RolesColumns // columns contains all the column names of Table for convenient usage. columns RolesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// RolesColumns defines and stores column names for the table roles. // RolesColumns defines and stores column names for the table roles.
@ -48,12 +47,11 @@ var rolesColumns = RolesColumns{
} }
// NewRolesDao creates and returns a new DAO object for table data access. // NewRolesDao creates and returns a new DAO object for table data access.
func NewRolesDao(handlers ...gdb.ModelHandler) *RolesDao { func NewRolesDao() *RolesDao {
return &RolesDao{ return &RolesDao{
group: "default", group: "default",
table: "roles", table: "roles",
columns: rolesColumns, columns: rolesColumns,
handlers: handlers,
} }
} }
@ -79,11 +77,7 @@ func (dao *RolesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model { func (dao *RolesDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// StoreAdminsDao is the data access object for the table store_admins. // StoreAdminsDao is the data access object for the table store_admins.
type StoreAdminsDao struct { type StoreAdminsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage. columns StoreAdminsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoreAdminsColumns defines and stores column names for the table store_admins. // StoreAdminsColumns defines and stores column names for the table store_admins.
@ -58,12 +57,11 @@ var storeAdminsColumns = StoreAdminsColumns{
} }
// NewStoreAdminsDao creates and returns a new DAO object for table data access. // NewStoreAdminsDao creates and returns a new DAO object for table data access.
func NewStoreAdminsDao(handlers ...gdb.ModelHandler) *StoreAdminsDao { func NewStoreAdminsDao() *StoreAdminsDao {
return &StoreAdminsDao{ return &StoreAdminsDao{
group: "default", group: "default",
table: "store_admins", table: "store_admins",
columns: storeAdminsColumns, columns: storeAdminsColumns,
handlers: handlers,
} }
} }
@ -89,11 +87,7 @@ func (dao *StoreAdminsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *StoreAdminsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,45 +13,31 @@ import (
// StoreDesktopSettingsDao is the data access object for the table store_desktop_settings. // StoreDesktopSettingsDao is the data access object for the table store_desktop_settings.
type StoreDesktopSettingsDao struct { type StoreDesktopSettingsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage. columns StoreDesktopSettingsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings. // StoreDesktopSettingsColumns defines and stores column names for the table store_desktop_settings.
type StoreDesktopSettingsColumns struct { type StoreDesktopSettingsColumns struct {
Id string // 主键ID StoreId string //
StoreId string // 门店ID TopComponentVisible string // 1显示2 隐藏
BackgroundUrl string // 桌面背景图片URL RightComponentVisible string // 1显示2 隐藏
Resolution string // 分辨率例如1920x1080
IsTopWidgetVisible string // 顶部组件是否显示FALSE=隐藏TRUE=显示
IsRightWidgetVisible string // 右侧组件是否显示FALSE=隐藏TRUE=显示
CreatedAt string // 创建时间
UpdatedAt string // 更新时间
DeletedAt string // 软删除时间戳
} }
// storeDesktopSettingsColumns holds the columns for the table store_desktop_settings. // storeDesktopSettingsColumns holds the columns for the table store_desktop_settings.
var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{ var storeDesktopSettingsColumns = StoreDesktopSettingsColumns{
Id: "id", StoreId: "store_id",
StoreId: "store_id", TopComponentVisible: "top_component_visible",
BackgroundUrl: "background_url", RightComponentVisible: "right_component_visible",
Resolution: "resolution",
IsTopWidgetVisible: "is_top_widget_visible",
IsRightWidgetVisible: "is_right_widget_visible",
CreatedAt: "created_at",
UpdatedAt: "updated_at",
DeletedAt: "deleted_at",
} }
// NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access. // NewStoreDesktopSettingsDao creates and returns a new DAO object for table data access.
func NewStoreDesktopSettingsDao(handlers ...gdb.ModelHandler) *StoreDesktopSettingsDao { func NewStoreDesktopSettingsDao() *StoreDesktopSettingsDao {
return &StoreDesktopSettingsDao{ return &StoreDesktopSettingsDao{
group: "default", group: "default",
table: "store_desktop_settings", table: "store_desktop_settings",
columns: storeDesktopSettingsColumns, columns: storeDesktopSettingsColumns,
handlers: handlers,
} }
} }
@ -77,11 +63,7 @@ func (dao *StoreDesktopSettingsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreDesktopSettingsDao) Ctx(ctx context.Context) *gdb.Model { func (dao *StoreDesktopSettingsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// StoreRolesDao is the data access object for the table store_roles. // StoreRolesDao is the data access object for the table store_roles.
type StoreRolesDao struct { type StoreRolesDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns StoreRolesColumns // columns contains all the column names of Table for convenient usage. columns StoreRolesColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoreRolesColumns defines and stores column names for the table store_roles. // StoreRolesColumns defines and stores column names for the table store_roles.
@ -40,12 +39,11 @@ var storeRolesColumns = StoreRolesColumns{
} }
// NewStoreRolesDao creates and returns a new DAO object for table data access. // NewStoreRolesDao creates and returns a new DAO object for table data access.
func NewStoreRolesDao(handlers ...gdb.ModelHandler) *StoreRolesDao { func NewStoreRolesDao() *StoreRolesDao {
return &StoreRolesDao{ return &StoreRolesDao{
group: "default", group: "default",
table: "store_roles", table: "store_roles",
columns: storeRolesColumns, columns: storeRolesColumns,
handlers: handlers,
} }
} }
@ -71,11 +69,7 @@ func (dao *StoreRolesDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoreRolesDao) Ctx(ctx context.Context) *gdb.Model { func (dao *StoreRolesDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// StoreTaskRewardsDao is the data access object for the table store_task_rewards. // StoreTaskRewardsDao is the data access object for the table store_task_rewards.
type StoreTaskRewardsDao struct { type StoreTaskRewardsDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. columns StoreTaskRewardsColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards. // StoreTaskRewardsColumns defines and stores column names for the table store_task_rewards.
@ -42,12 +41,11 @@ var storeTaskRewardsColumns = StoreTaskRewardsColumns{
} }
// NewStoreTaskRewardsDao creates and returns a new DAO object for table data access. // NewStoreTaskRewardsDao creates and returns a new DAO object for table data access.
func NewStoreTaskRewardsDao(handlers ...gdb.ModelHandler) *StoreTaskRewardsDao { func NewStoreTaskRewardsDao() *StoreTaskRewardsDao {
return &StoreTaskRewardsDao{ return &StoreTaskRewardsDao{
group: "default", group: "default",
table: "store_task_rewards", table: "store_task_rewards",
columns: storeTaskRewardsColumns, columns: storeTaskRewardsColumns,
handlers: handlers,
} }
} }
@ -73,11 +71,7 @@ func (dao *StoreTaskRewardsDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // 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 { func (dao *StoreTaskRewardsDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// StoresDao is the data access object for the table stores. // StoresDao is the data access object for the table stores.
type StoresDao struct { type StoresDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns StoresColumns // columns contains all the column names of Table for convenient usage. columns StoresColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// StoresColumns defines and stores column names for the table stores. // StoresColumns defines and stores column names for the table stores.
@ -52,12 +51,11 @@ var storesColumns = StoresColumns{
} }
// NewStoresDao creates and returns a new DAO object for table data access. // NewStoresDao creates and returns a new DAO object for table data access.
func NewStoresDao(handlers ...gdb.ModelHandler) *StoresDao { func NewStoresDao() *StoresDao {
return &StoresDao{ return &StoresDao{
group: "default", group: "default",
table: "stores", table: "stores",
columns: storesColumns, columns: storesColumns,
handlers: handlers,
} }
} }
@ -83,11 +81,7 @@ func (dao *StoresDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model { func (dao *StoresDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// TasksDao is the data access object for the table tasks. // TasksDao is the data access object for the table tasks.
type TasksDao struct { type TasksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current 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. columns TasksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// TasksColumns defines and stores column names for the table tasks. // TasksColumns defines and stores column names for the table tasks.
@ -58,12 +57,11 @@ var tasksColumns = TasksColumns{
} }
// NewTasksDao creates and returns a new DAO object for table data access. // NewTasksDao creates and returns a new DAO object for table data access.
func NewTasksDao(handlers ...gdb.ModelHandler) *TasksDao { func NewTasksDao() *TasksDao {
return &TasksDao{ return &TasksDao{
group: "default", group: "default",
table: "tasks", table: "tasks",
columns: tasksColumns, columns: tasksColumns,
handlers: handlers,
} }
} }
@ -89,11 +87,7 @@ func (dao *TasksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // 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 { func (dao *TasksDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// UserTasksDao is the data access object for the table user_tasks. // UserTasksDao is the data access object for the table user_tasks.
type UserTasksDao struct { type UserTasksDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns UserTasksColumns // columns contains all the column names of Table for convenient usage. columns UserTasksColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// UserTasksColumns defines and stores column names for the table user_tasks. // UserTasksColumns defines and stores column names for the table user_tasks.
@ -52,12 +51,11 @@ var userTasksColumns = UserTasksColumns{
} }
// NewUserTasksDao creates and returns a new DAO object for table data access. // NewUserTasksDao creates and returns a new DAO object for table data access.
func NewUserTasksDao(handlers ...gdb.ModelHandler) *UserTasksDao { func NewUserTasksDao() *UserTasksDao {
return &UserTasksDao{ return &UserTasksDao{
group: "default", group: "default",
table: "user_tasks", table: "user_tasks",
columns: userTasksColumns, columns: userTasksColumns,
handlers: handlers,
} }
} }
@ -83,11 +81,7 @@ func (dao *UserTasksDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model { func (dao *UserTasksDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -13,10 +13,9 @@ import (
// UsersDao is the data access object for the table users. // UsersDao is the data access object for the table users.
type UsersDao struct { type UsersDao struct {
table string // table is the underlying table name of the DAO. table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of the current DAO. group string // group is the database configuration group name of the current DAO.
columns UsersColumns // columns contains all the column names of Table for convenient usage. columns UsersColumns // columns contains all the column names of Table for convenient usage.
handlers []gdb.ModelHandler // handlers for customized model modification.
} }
// UsersColumns defines and stores column names for the table users. // UsersColumns defines and stores column names for the table users.
@ -60,12 +59,11 @@ var usersColumns = UsersColumns{
} }
// NewUsersDao creates and returns a new DAO object for table data access. // NewUsersDao creates and returns a new DAO object for table data access.
func NewUsersDao(handlers ...gdb.ModelHandler) *UsersDao { func NewUsersDao() *UsersDao {
return &UsersDao{ return &UsersDao{
group: "default", group: "default",
table: "users", table: "users",
columns: usersColumns, columns: usersColumns,
handlers: handlers,
} }
} }
@ -91,11 +89,7 @@ func (dao *UsersDao) Group() string {
// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model { func (dao *UsersDao) Ctx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table) return dao.DB().Model(dao.table).Safe().Ctx(ctx)
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
} }
// Transaction wraps the transaction logic using function f. // Transaction wraps the transaction logic using function f.

View File

@ -15,6 +15,7 @@ import (
_ "server/internal/logic/role" _ "server/internal/logic/role"
_ "server/internal/logic/store" _ "server/internal/logic/store"
_ "server/internal/logic/storeAdmin" _ "server/internal/logic/storeAdmin"
_ "server/internal/logic/storeDesktopSetting"
_ "server/internal/logic/storeRole" _ "server/internal/logic/storeRole"
_ "server/internal/logic/storeTaskReward" _ "server/internal/logic/storeTaskReward"
_ "server/internal/logic/task" _ "server/internal/logic/task"

View File

@ -173,57 +173,3 @@ func (s *sStore) GetDesktopSetting(ctx context.Context, in *model.StoreGetDeskto
return out, nil return out, nil
} }
func (s *sStore) SaveDesktopSetting(ctx context.Context, in *model.SaveDesktopSettingIn) (*model.SaveDesktopSettingOut, error) {
out := &model.SaveDesktopSettingOut{}
err := dao.StoreDesktopSettings.Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
// 构建数据,包含所有字段
data := do.StoreDesktopSettings{
Id: in.Id,
StoreId: in.StoreId,
BackgroundUrl: in.BackgroundUrl,
Resolution: in.Resolution,
IsTopWidgetVisible: in.IsTopWidgetVisible,
IsRightWidgetVisible: in.IsRightWidgetVisible,
}
// 检查记录是否存在(基于 store_id
exist, err := dao.StoreDesktopSettings.Ctx(ctx).TX(tx).Where(do.StoreDesktopSettings{StoreId: in.StoreId}).Count()
if err != nil {
return gerror.Wrap(ecode.Fail, "检查门店桌面设置失败")
}
if exist == 0 {
// 新增
result, err := dao.StoreDesktopSettings.Ctx(ctx).TX(tx).Data(data).Insert()
if err != nil {
return gerror.Wrap(ecode.Fail, "新增门店桌面设置失败")
}
id, err := result.LastInsertId()
if err != nil {
return gerror.Wrap(ecode.Fail, "获取新增记录ID失败")
}
out.Id = id
} else {
// 更新(如果提供了 Id则优先使用 Id 作为条件,否则使用 StoreId
updateWhere := do.StoreDesktopSettings{StoreId: in.StoreId}
if in.Id > 0 {
updateWhere = do.StoreDesktopSettings{Id: in.Id}
}
_, err := dao.StoreDesktopSettings.Ctx(ctx).TX(tx).Data(data).Where(updateWhere).Update()
if err != nil {
return gerror.Wrap(ecode.Fail, "更新门店桌面设置失败")
}
id, err := dao.StoreDesktopSettings.Ctx(ctx).TX(tx).Where(updateWhere).Fields(dao.StoreDesktopSettings.Columns().Id).Value()
if err != nil {
return gerror.Wrap(ecode.Fail, "获取更新记录ID失败")
}
out.Id = id.Int64()
}
return nil
})
if err != nil {
return nil, err
}
return out, nil
}

View File

@ -0,0 +1,66 @@
package storeDesktopSetting
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"server/internal/dao"
"server/internal/model"
"server/internal/model/do"
"server/internal/service"
)
type sStoreDesktopSetting struct {
}
func New() service.IStoreDesktopSetting {
return &sStoreDesktopSetting{}
}
func init() {
service.RegisterStoreDesktopSetting(New())
}
func (s *sStoreDesktopSetting) Get(ctx context.Context, storeId int64) (out *model.StoreDesktopSettings, err error) {
value, err := dao.StoreDesktopSettings.Ctx(ctx).Where(do.StoreDesktopSettings{StoreId: storeId}).One()
if err != nil {
return nil, err
}
// 为空创建一条记录,组件都展示;反之返回对应数据
if value.IsEmpty() {
out = &model.StoreDesktopSettings{
RightComponentVisible: 1,
TopComponentVisible: 1,
}
_, err := dao.StoreDesktopSettings.Ctx(ctx).Insert(do.StoreDesktopSettings{
RightComponentVisible: out.RightComponentVisible,
StoreId: storeId,
TopComponentVisible: out.TopComponentVisible,
})
if err != nil {
return nil, err
}
return out, nil
} else {
out = &model.StoreDesktopSettings{}
err := value.Struct(out)
if err != nil {
return nil, err
}
return out, nil
}
}
func (s *sStoreDesktopSetting) Save(ctx context.Context, in model.SaveDesktopSettingIn) (out *model.SaveDesktopSettingOut, err error) {
if in.TopComponentVisible == 2 && in.RightComponentVisible == 2 {
return nil, gerror.New("请至少选择一个组件")
}
_, err = dao.StoreDesktopSettings.Ctx(ctx).Where(do.StoreDesktopSettings{StoreId: in.StoreId}).Update(do.StoreDesktopSettings{
RightComponentVisible: in.RightComponentVisible,
TopComponentVisible: in.TopComponentVisible,
})
if err != nil {
return nil, err
}
return &model.SaveDesktopSettingOut{
Success: true,
}, nil
}

View File

@ -6,19 +6,12 @@ package do
import ( import (
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
) )
// StoreDesktopSettings is the golang structure of table store_desktop_settings for DAO operations like Where/Data. // StoreDesktopSettings is the golang structure of table store_desktop_settings for DAO operations like Where/Data.
type StoreDesktopSettings struct { type StoreDesktopSettings struct {
g.Meta `orm:"table:store_desktop_settings, do:true"` g.Meta `orm:"table:store_desktop_settings, do:true"`
Id interface{} // 主键ID StoreId interface{} //
StoreId interface{} // 门店ID TopComponentVisible interface{} // 1显示2 隐藏
BackgroundUrl interface{} // 桌面背景图片URL RightComponentVisible interface{} // 1显示2 隐藏
Resolution interface{} // 分辨率例如1920x1080
IsTopWidgetVisible interface{} // 顶部组件是否显示FALSE=隐藏TRUE=显示
IsRightWidgetVisible interface{} // 右侧组件是否显示FALSE=隐藏TRUE=显示
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
DeletedAt *gtime.Time // 软删除时间戳
} }

View File

@ -4,19 +4,9 @@
package entity package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// StoreDesktopSettings is the golang structure for table store_desktop_settings. // StoreDesktopSettings is the golang structure for table store_desktop_settings.
type StoreDesktopSettings struct { type StoreDesktopSettings struct {
Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID StoreId int64 `json:"storeId" orm:"store_id" description:""` //
StoreId int64 `json:"storeId" orm:"store_id" description:"门店ID"` // 门店ID TopComponentVisible int `json:"topComponentVisible" orm:"top_component_visible" description:"1显示2 隐藏"` // 1显示2 隐藏
BackgroundUrl string `json:"backgroundUrl" orm:"background_url" description:"桌面背景图片URL"` // 桌面背景图片URL RightComponentVisible int `json:"rightComponentVisible" orm:"right_component_visible" description:"1显示2 隐藏"` // 1显示2 隐藏
Resolution string `json:"resolution" orm:"resolution" description:"分辨率例如1920x1080"` // 分辨率例如1920x1080
IsTopWidgetVisible int `json:"isTopWidgetVisible" orm:"is_top_widget_visible" description:"顶部组件是否显示FALSE=隐藏TRUE=显示"` // 顶部组件是否显示FALSE=隐藏TRUE=显示
IsRightWidgetVisible int `json:"isRightWidgetVisible" orm:"is_right_widget_visible" description:"右侧组件是否显示FALSE=隐藏TRUE=显示"` // 右侧组件是否显示FALSE=隐藏TRUE=显示
CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" description:"更新时间"` // 更新时间
DeletedAt *gtime.Time `json:"deletedAt" orm:"deleted_at" description:"软删除时间戳"` // 软删除时间戳
} }

View File

@ -3,13 +3,10 @@ package model
import "github.com/gogf/gf/v2/frame/g" import "github.com/gogf/gf/v2/frame/g"
type StoreDesktopSettings struct { type StoreDesktopSettings struct {
g.Meta `orm:"table:store_desktop_settings"` g.Meta `orm:"table:store_desktop_settings"`
Id int64 `orm:"id" json:"id"` // 主键ID StoreId int64 `json:"storeId" orm:"store_id" description:""` //
StoreId int64 `orm:"store_id" json:"store_id"` // 门店ID TopComponentVisible int `json:"topComponentVisible" orm:"top_component_visible" description:"1显示2 隐藏"` // 1显示2 隐藏
BackgroundUrl string `orm:"background_url" json:"background_url"` // 桌面背景图片URL RightComponentVisible int `json:"rightComponentVisible" orm:"right_component_visible" description:"1显示2 隐藏"` // 1显示2 隐藏
Resolution string `orm:"resolution" json:"resolution"` // 分辨率例如1920x1080
IsTopWidgetVisible bool `orm:"is_top_widget_visible" json:"is_top_widget_visible"` // 顶部组件是否显示FALSE=隐藏TRUE=显示
IsRightWidgetVisible bool `orm:"is_right_widget_visible" json:"is_right_widget_visible"` // 右侧组件是否显示FALSE=隐藏TRUE=显示
} }
type StoreGetDesktopSettingIn struct { type StoreGetDesktopSettingIn struct {
@ -22,13 +19,10 @@ type StoreGetDesktopSettingOut struct {
} }
type SaveDesktopSettingIn struct { type SaveDesktopSettingIn struct {
Id int64 StoreId int64
StoreId int64 TopComponentVisible int // 1显示2 隐藏
BackgroundUrl string RightComponentVisible int // 1显示2 隐藏
Resolution string
IsTopWidgetVisible bool
IsRightWidgetVisible bool
} }
type SaveDesktopSettingOut struct { type SaveDesktopSettingOut struct {
Id int64 Success bool
} }

View File

@ -18,7 +18,6 @@ type (
Delete(ctx context.Context, in *model.StoreDeleteIn) (out *model.DeleteOut, err error) Delete(ctx context.Context, in *model.StoreDeleteIn) (out *model.DeleteOut, err error)
Info(ctx context.Context, in *model.StoreInfoIn) (out *model.StoreInfoOut, err error) Info(ctx context.Context, in *model.StoreInfoIn) (out *model.StoreInfoOut, err error)
GetDesktopSetting(ctx context.Context, in *model.StoreGetDesktopSettingIn) (*model.StoreGetDesktopSettingOut, error) GetDesktopSetting(ctx context.Context, in *model.StoreGetDesktopSettingIn) (*model.StoreGetDesktopSettingOut, error)
SaveDesktopSetting(ctx context.Context, in *model.SaveDesktopSettingIn) (*model.SaveDesktopSettingOut, error)
} }
) )

View File

@ -0,0 +1,33 @@
// ================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
"context"
"server/internal/model"
)
type (
IStoreDesktopSetting interface {
Get(ctx context.Context, storeId int64) (out *model.StoreDesktopSettings, err error)
Save(ctx context.Context, in model.SaveDesktopSettingIn) (out *model.SaveDesktopSettingOut, err error)
}
)
var (
localStoreDesktopSetting IStoreDesktopSetting
)
func StoreDesktopSetting() IStoreDesktopSetting {
if localStoreDesktopSetting == nil {
panic("implement not found for interface IStoreDesktopSetting, forgot register?")
}
return localStoreDesktopSetting
}
func RegisterStoreDesktopSetting(i IStoreDesktopSetting) {
localStoreDesktopSetting = i
}

View File

@ -112,6 +112,10 @@ func init() {
enforcer.AddPolicy("store", "/x/store/admin/*", "DELETE", "删除门店管理员") enforcer.AddPolicy("store", "/x/store/admin/*", "DELETE", "删除门店管理员")
enforcer.AddPolicy("store", "/x/store/admin/password", "POST", "修改门店管理员密码") enforcer.AddPolicy("store", "/x/store/admin/password", "POST", "修改门店管理员密码")
// 门店桌面设置
enforcer.AddPolicy("store", "/x/desktop", "GET", "获取门店桌面设置")
enforcer.AddPolicy("store", "/x/desktop", "POST", "修改门店桌面设置")
} }
// 商户 // 商户
{ {