新增了长时间未操作处理

This commit is contained in:
2025-03-17 09:59:49 +08:00
parent e2a6e69df4
commit 42cc40b531
8 changed files with 189 additions and 28 deletions
+36
View File
@@ -0,0 +1,36 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// AdminApiRequest 后台api请求记录
type AdminApiRequest struct {
RequestId int64 `gorm:"column:request_id;type:bigint(19);primary_key;comment:主键id" json:"request_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:后台用户id" json:"user_id"`
ApiName string `gorm:"column:api_name;type:varchar(100);comment:api名称" json:"api_name"`
ApiPath string `gorm:"column:api_path;type:varchar(255);comment: 接口路径(全路径 id为:id" json:"api_path"`
ApiMethod string `gorm:"column:api_method;type:varchar(10);comment:请求类型(put:修改 post:新增 get:获取 " json:"api_method"`
RequestTime LocalTime `gorm:"column:request_time;type:datetime;comment:请求时间" json:"request_time"`
Model
}
func (m *AdminApiRequest) TableName() string {
return "gdxz_admin_api_request"
}
func (m *AdminApiRequest) BeforeCreate(tx *gorm.DB) error {
if m.RequestId == 0 {
m.RequestId = global.Snowflake.Generate().Int64()
}
m.CreatedAt = LocalTime(time.Now())
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
m.UpdatedAt = LocalTime(time.Now())
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
return nil
}
+1
View File
@@ -15,6 +15,7 @@ type OrderProductItem struct {
ProductId int64 `gorm:"column:product_id;type:bigint(19);comment:商品id" json:"product_id"`
ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"`
ProductPrice float64 `gorm:"column:product_price;type:decimal(10,2);comment:商品价格" json:"product_price"`
ActualProductPrice float64 `gorm:"column:actual_product_price;type:decimal(10,2);comment:实际商品价格" json:"actual_product_price"`
ProductPlatformCode string `gorm:"column:product_platform_code;type:varchar(100);comment:商品处方平台编码" json:"product_platform_code"`
Amount int `gorm:"column:amount;type:int(11);comment:数量" json:"amount"`
Manufacturer string `gorm:"column:manufacturer;type:varchar(255);comment:生产厂家" json:"manufacturer"`