update app

This commit is contained in:
wangchuxiao
2022-05-11 10:19:58 +08:00
parent 17759f9a98
commit 98a903e60c
6 changed files with 10 additions and 130 deletions
+3
View File
@@ -33,6 +33,7 @@ type UploadUpdateAppReq struct {
File *multipart.FileHeader `form:"file" binding:"required"`
Yaml *multipart.FileHeader `form:"yaml"`
ForceUpdate bool `form:"forceUpdate"`
UpdateLog string `form:"updateLog" binding:"update_log"`
}
type UploadUpdateAppResp struct {
@@ -52,5 +53,7 @@ type GetDownloadURLResp struct {
ForceUpdate bool `json:"forceUpdate"`
FileURL string `json:"fileURL"`
YamlURL string `json:"yamlURL"`
Version string `json:"version"`
UpdateLog string `json:"update_log"`
} `json:"data"`
}
+1
View File
@@ -280,6 +280,7 @@ type AppVersion struct {
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"`
UpdateLog string `gorm:"column:update_log" json:"update_log"`
}
func (AppVersion) TableName() string {
@@ -5,7 +5,7 @@ import (
"time"
)
func UpdateAppVersion(appType int, version string, forceUpdate bool, fileName, yamlName string) error {
func UpdateAppVersion(appType int, version string, forceUpdate bool, fileName, yamlName, updateLog string) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
@@ -18,9 +18,10 @@ func UpdateAppVersion(appType int, version string, forceUpdate bool, fileName, y
FileName: fileName,
YamlName: yamlName,
ForceUpdate: forceUpdate,
UpdateLog: updateLog,
}
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})
"version": version, "update_time": int(time.Now().Unix()), "file_name": fileName, "yaml_name": yamlName, "type": appType, "update_log": updateLog})
if result.Error != nil {
return result.Error
}