add Dockerfile

This commit is contained in:
landaiqing
2024-10-29 00:20:51 +08:00
parent ae5131b7e1
commit 0e141b1050
5 changed files with 147 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ package model
import (
"encoding/json"
"gorm.io/gorm"
"time"
)
@@ -42,3 +43,16 @@ func (user *ScaAuthUser) MarshalBinary() ([]byte, error) {
func (user *ScaAuthUser) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, user)
}
func (user *ScaAuthUser) BeforeCreate(tx *gorm.DB) (err error) {
user.CreatedBy = "system"
return
}
func (user *ScaAuthUser) BeforeUpdate(tx *gorm.DB) (err error) {
currentUserID, b := tx.Get("user_id")
if !b {
return
}
user.UpdateBy = currentUserID.(string)
return
}