Commit 0fe205e8 authored by szh's avatar szh

update

parent f2f099ce
......@@ -25,3 +25,13 @@ func UpdateDevList(rasp RaspDevList) error {
}
return nil
}
func UpdateDevList1(rasp RaspDevList) error {
var dev RaspDevList
dev.Addr = rasp.Addr
tx := db.Begin()
if tx.First(dev).RecordNotFound() {
return tx.Create(rasp).Error
}
return tx.Save(rasp).Error
}
\ No newline at end of file
......@@ -212,7 +212,7 @@ func UploadInfo(KP map[string]string) error {
return err
}
rasp := convertDevList(KP)
err = models.UpdateDevList(rasp)
err = models.UpdateDevList1(rasp)
if err != nil {
return err
}
......@@ -248,6 +248,8 @@ func convertDevList(params map[string]string) models.RaspDevList {
}
rasp.BtyVersion = pai.BtyVersion.App
} else {
rasp.NodeStatus = 0
}
return rasp
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment