管理员增加数据同步功能,支持初始化股票列表

This commit is contained in:
2026-07-04 14:36:51 +08:00
parent 024320e082
commit b774899655
10 changed files with 431 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package models
import (
"time"
"gorm.io/gorm"
)
// Stock 存储股票基础信息。
type Stock struct {
ID string `json:"id" gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
TsCode string `json:"ts_code" gorm:"size:32;not null;uniqueIndex"`
Symbol string `json:"symbol" gorm:"size:32;not null;index"`
Name string `json:"name" gorm:"size:128"`
Area string `json:"area" gorm:"size:64"`
Industry string `json:"industry" gorm:"size:64"`
Market string `json:"market" gorm:"size:16"`
Exchange string `json:"exchange" gorm:"size:16"`
ListStatus string `json:"list_status" gorm:"size:8"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// AutoMigrateStocks 迁移股票基础信息表。
func AutoMigrateStocks(db *gorm.DB) error {
return db.AutoMigrate(&Stock{})
}