增加存储字段,小数点,倍数,和昨收价(对指数有效,个股无效)

This commit is contained in:
钱纯净
2025-03-15 15:05:10 +08:00
parent 4d8d9f1ad9
commit 1d552a0fc7

View File

@@ -120,16 +120,22 @@ func (this *Codes) Code(byDatabase bool) ([]*CodeModel, error) {
if mCode[v.Code].Name != v.Name { if mCode[v.Code].Name != v.Name {
mCode[v.Code].Name = v.Name mCode[v.Code].Name = v.Name
update = append(update, &CodeModel{ update = append(update, &CodeModel{
Name: v.Name, Name: v.Name,
Code: v.Code, Code: v.Code,
Exchange: exchange.String(), Exchange: exchange.String(),
Multiple: v.Multiple,
Decimal: v.Decimal,
LastPrice: v.LastPrice,
}) })
} }
} else { } else {
code := &CodeModel{ code := &CodeModel{
Name: v.Name, Name: v.Name,
Code: v.Code, Code: v.Code,
Exchange: exchange.String(), Exchange: exchange.String(),
Multiple: v.Multiple,
Decimal: v.Decimal,
LastPrice: v.LastPrice,
} }
insert = append(insert, code) insert = append(insert, code)
list = append(list, code) list = append(list, code)
@@ -160,12 +166,15 @@ func (this *Codes) Code(byDatabase bool) ([]*CodeModel, error) {
} }
type CodeModel struct { type CodeModel struct {
ID int64 `json:"id"` //主键 ID int64 `json:"id"` //主键
Name string `json:"name"` //名称,有时候名称会变,例STxxx Name string `json:"name"` //名称,有时候名称会变,例STxxx
Code string `json:"code" xorm:"index"` //代码 Code string `json:"code" xorm:"index"` //代码
Exchange string `json:"exchange" xorm:"index"` //交易所 Exchange string `json:"exchange" xorm:"index"` //交易所
EditDate int64 `json:"editDate" xorm:"updated"` //修改时间 Multiple uint16 `json:"multiple"` //倍数
InDate int64 `json:"inDate" xorm:"created"` //创建时间 Decimal int8 `json:"decimal"` //小数位
LastPrice float64 `json:"lastPrice"` //昨收价格
EditDate int64 `json:"editDate" xorm:"updated"` //修改时间
InDate int64 `json:"inDate" xorm:"created"` //创建时间
} }
func (c *CodeModel) TableName() string { func (c *CodeModel) TableName() string {