实现商户注册、管理员审核商户申请接口

This commit is contained in:
2025-06-04 15:10:56 +08:00
parent 00b889cfcc
commit caf3d42fe5
63 changed files with 1195 additions and 294 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/glog"
"github.com/hailaz/gf-casbin-adapter/v2"
"server/internal/consts"
"sync"
)
@ -33,6 +34,10 @@ func init() {
}
enforcer.LoadPolicy()
enforcer.AddGroupingPolicy(consts.UserRoleCode, consts.GuestRoleCode) // 用户继承游客角色权限
enforcer.AddGroupingPolicy(consts.MerchantRoleCode, consts.StoreRoleCode) // 商户继承门店角色权限
enforcer.AddGroupingPolicy(consts.AdminRoleCode, consts.MerchantRoleCode) // 管理员继承商户角色权限
// 管理员
{
// admin
@ -45,6 +50,10 @@ func init() {
enforcer.AddPolicy("admin", "/x/role", "DELETE", "管理员给角色分配权限")
enforcer.AddPolicy("admin", "/x/role/*", "DELETE", "管理员删除单个角色")
// merchant
enforcer.AddPolicy("admin", "/x/merchant", "GET", "管理员获取商户列表")
enforcer.AddPolicy("admin", "/x/merchant/audit", "POST", "管理员审核商户申请")
}
instance = &myCasbin{Enforcer: enforcer}