pull/351/head
wangchuxiao 2 years ago
parent d57729d3d7
commit 782ad07940

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
) )
func SetClientInitConfig(c *gin.Context) { func SetClientInitConfig(c *gin.Context) {
@ -61,8 +62,11 @@ func GetClientInitConfig(c *gin.Context) {
} }
config, err := imdb.GetClientInitConfig() config, err := imdb.GetClientInitConfig()
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) if !gorm.IsRecordNotFoundError(err) {
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()})
return
}
} }
resp.Data.DiscoverPageURL = config.DiscoverPageURL resp.Data.DiscoverPageURL = config.DiscoverPageURL
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp ", resp) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp ", resp)

@ -7,7 +7,7 @@ func SetClientInitConfig(m map[string]interface{}) error {
if result.Error != nil { if result.Error != nil {
return result.Error return result.Error
} }
if result.RowsAffected == 1 { if result.RowsAffected == 0 {
err := db.DB.MysqlDB.DefaultGormDB().Model(&db.ClientInitConfig{}).Create(m).Error err := db.DB.MysqlDB.DefaultGormDB().Model(&db.ClientInitConfig{}).Create(m).Error
return err return err
} }

Loading…
Cancel
Save