小程序一些功能更新

This commit is contained in:
李琦
2026-09-30 17:01:18 +08:00
parent 75499ba85c
commit 6f51d99a78
46 changed files with 5280 additions and 37 deletions

View File

@@ -48,15 +48,17 @@ func TestHasPermission(t *testing.T) {
// TestPermissionsOf 权限点列表稳定且有序。
func TestPermissionsOf(t *testing.T) {
if n := len(PermissionsOf(consts.AdminRoleSuper)); n != 11 {
t.Fatalf("超管权限点应为 11,得 %d", n)
// 迭代-2026-09-29:新增 goods:write / attachment:write(11 → 13)
if n := len(PermissionsOf(consts.AdminRoleSuper)); n != 13 {
t.Fatalf("超管权限点应为 13,得 %d", n)
}
if n := len(PermissionsOf(consts.AdminRoleReadonly)); n != 1 {
t.Fatalf("只读权限点应为 1(仅 order:read),得 %d", n)
}
pos := PermissionsOf(consts.AdminRoleOperator)
if len(pos) != 9 {
t.Fatalf("运营权限点应为 9,得 %d", len(pos))
// 迭代-2026-09-29:运营同步获得 goods:write / attachment:write(9 → 11)
if len(pos) != 11 {
t.Fatalf("运营权限点应为 11,得 %d", len(pos))
}
for i := 1; i < len(pos); i++ {
if pos[i-1] > pos[i] {
@@ -85,6 +87,16 @@ func TestPermissionForRoute(t *testing.T) {
{http.MethodPost, "/admin/save", PermAdminManage},
{http.MethodPost, "/audit/record", ""}, // 上报审计仅需登录(≠读取审计)
{http.MethodPost, "/order/refund", PermOrderWrite},
// 迭代-2026-09-29:软件开发服务 / 附件 / 系统配置
{http.MethodPost, "/admin/goods/save", PermGoodsWrite},
{http.MethodPost, "/admin/goods/delete", PermGoodsWrite},
{http.MethodPost, "/admin/upload", PermAttachmentWrite},
{http.MethodPost, "/admin/attachment/delete", PermAttachmentWrite},
{http.MethodPost, "/admin/setting/save", PermAdminManage},
// 服务/附件列表仅需登录(先于 /admin/ 的 admin:manage 兜底命中)
{http.MethodGet, "/admin/goods/list", ""},
{http.MethodGet, "/admin/attachment/list", ""},
{http.MethodGet, "/admin/setting/get", PermAdminManage},
// 只读接口仅需登录
{http.MethodGet, "/user/list", ""},
{http.MethodGet, "/dashboard/stats", ""},