pull/232/head
wangchuxiao 3 years ago
parent 7137924baa
commit 7a423eb6e1

@ -274,12 +274,12 @@ func (DepartmentMember) TableName() string {
}
type AppVersion struct {
Version string `gorm:"column:version;size:64"`
Type int `gorm:"column:type;primary_key"`
UpdateTime int `gorm:"column:update_time"`
ForceUpdate bool `gorm:"column:force_update"`
FileName string `gorm:"column:file_name"`
YamlName string `gorm:"column:yaml_name"`
Version string `gorm:"column:version;size:64" json:"version"`
Type int `gorm:"column:type;primary_key" json:"type"`
UpdateTime int `gorm:"column:update_time" json:"update_time"`
ForceUpdate bool `gorm:"column:force_update" json:"force_update"`
FileName string `gorm:"column:file_name" json:"file_name"`
YamlName string `gorm:"column:yaml_name" json:"yaml_name"`
}
func (AppVersion) TableName() string {

@ -10,14 +10,17 @@ func UpdateAppVersion(appType int, version string, forceUpdate bool, fileName, y
if err != nil {
return err
}
updateTime := int(time.Now().Unix())
app := db.AppVersion{
Version: version,
Type: appType,
UpdateTime: int(time.Now().Unix()),
FileName: fileName,
YamlName: yamlName,
Version: version,
Type: appType,
UpdateTime: updateTime,
FileName: fileName,
YamlName: yamlName,
ForceUpdate: forceUpdate,
}
result := dbConn.Model(db.AppVersion{}).Where("type = ?", appType).Updates(&app).Update(map[string]interface{}{"force_update": forceUpdate})
result := dbConn.Model(db.AppVersion{}).Where("type = ?", appType).Update(map[string]interface{}{"force_update": forceUpdate,
"version": version, "update_time": int(time.Now().Unix()), "file_name": fileName, "yaml_name": yamlName, "type": appType})
if result.Error != nil {
return result.Error
}

Loading…
Cancel
Save