refactor platform logic modules

This commit is contained in:
david
2026-07-28 13:55:40 +08:00
parent bc39021c0d
commit bc8138f978
29 changed files with 861 additions and 776 deletions

View File

@@ -1,4 +1,4 @@
// Package platform 提供平台总后台的同步 HTTP 业务逻辑。
// Package common provides shared HTTP and persistence helpers for business logic modules.
package common
import (
@@ -12,9 +12,16 @@ import (
"git.apinb.com/heqiapp/platforms/backend/api/internal/impl"
"git.apinb.com/heqiapp/platforms/backend/api/internal/models"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
"gorm.io/gorm"
)
// PasswordHash creates the shared password representation used by account modules.
func PasswordHash(password string) (string, error) {
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(hash), err
}
// FilterFields keeps only explicitly allowed persistence fields.
func FilterFields(values map[string]any, allowedFields []string) gin.H {
allowed := make(map[string]struct{}, len(allowedFields))