优化代码

This commit is contained in:
刘祥超
2022-12-12 10:28:22 +08:00
parent e76464673a
commit 7ff6c0c18b
11 changed files with 15 additions and 12 deletions

View File

@@ -1 +0,0 @@
package models

View File

@@ -1 +0,0 @@
package models

View File

@@ -1,6 +1,7 @@
package models
package clients
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/goman"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
"github.com/TeaOSLab/EdgeAPI/internal/utils/ttlcache"
@@ -130,7 +131,7 @@ func (this *ClientBrowserDAO) CreateBrowserIfNotExists(tx *dbs.Tx, browserName s
op.CreatedDay = timeutil.Format("Ymd")
op.State = ClientBrowserStateEnabled
browserId, err = this.SaveInt64(tx, op)
if err != nil && CheckSQLErrCode(err, 1062 /** duplicate entry **/) {
if err != nil && models.CheckSQLErrCode(err, 1062 /** duplicate entry **/) {
return nil
}

View File

@@ -1,4 +1,4 @@
package models_test
package clients_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"

View File

@@ -1,4 +1,4 @@
package models
package clients
import "github.com/iwind/TeaGo/dbs"

View File

@@ -0,0 +1 @@
package clients

View File

@@ -1,6 +1,7 @@
package models
package clients
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/goman"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
"github.com/TeaOSLab/EdgeAPI/internal/utils/ttlcache"
@@ -129,7 +130,7 @@ func (this *ClientSystemDAO) CreateSystemIfNotExists(tx *dbs.Tx, systemName stri
op.CreatedDay = timeutil.Format("Ymd")
op.State = ClientSystemStateEnabled
systemId, err = this.SaveInt64(tx, op)
if err != nil && CheckSQLErrCode(err, 1062 /** duplicate entry **/) {
if err != nil && models.CheckSQLErrCode(err, 1062 /** duplicate entry **/) {
return nil
}

View File

@@ -1,4 +1,4 @@
package models_test
package clients_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/db/models"

View File

@@ -1,4 +1,4 @@
package models
package clients
import "github.com/iwind/TeaGo/dbs"

View File

@@ -0,0 +1 @@
package clients