mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 18:10:25 +08:00
优化代码
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
package models
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package models
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package models
|
package clients
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/utils/ttlcache"
|
"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.CreatedDay = timeutil.Format("Ymd")
|
||||||
op.State = ClientBrowserStateEnabled
|
op.State = ClientBrowserStateEnabled
|
||||||
browserId, err = this.SaveInt64(tx, op)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package models_test
|
package clients_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package models
|
package clients
|
||||||
|
|
||||||
import "github.com/iwind/TeaGo/dbs"
|
import "github.com/iwind/TeaGo/dbs"
|
||||||
|
|
||||||
1
internal/db/models/clients/client_browser_model_ext.go
Normal file
1
internal/db/models/clients/client_browser_model_ext.go
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package clients
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package models
|
package clients
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
"github.com/TeaOSLab/EdgeAPI/internal/goman"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/utils/ttlcache"
|
"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.CreatedDay = timeutil.Format("Ymd")
|
||||||
op.State = ClientSystemStateEnabled
|
op.State = ClientSystemStateEnabled
|
||||||
systemId, err = this.SaveInt64(tx, op)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package models_test
|
package clients_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package models
|
package clients
|
||||||
|
|
||||||
import "github.com/iwind/TeaGo/dbs"
|
import "github.com/iwind/TeaGo/dbs"
|
||||||
|
|
||||||
1
internal/db/models/clients/client_system_model_ext.go
Normal file
1
internal/db/models/clients/client_system_model_ext.go
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package clients
|
||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||||
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models/clients"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models/dns"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models/dns"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models/regions"
|
"github.com/TeaOSLab/EdgeAPI/internal/db/models/regions"
|
||||||
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
"github.com/TeaOSLab/EdgeAPI/internal/utils"
|
||||||
@@ -1714,7 +1715,7 @@ func (this *ServerService) UploadServerHTTPRequestStat(ctx context.Context, req
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if systemId == 0 {
|
if systemId == 0 {
|
||||||
err = models.SharedClientSystemDAO.CreateSystemIfNotExists(tx, result.Name)
|
err = clients.SharedClientSystemDAO.CreateSystemIfNotExists(tx, result.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -1745,7 +1746,7 @@ func (this *ServerService) UploadServerHTTPRequestStat(ctx context.Context, req
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if browserId == 0 {
|
if browserId == 0 {
|
||||||
err = models.SharedClientBrowserDAO.CreateBrowserIfNotExists(tx, result.Name)
|
err = clients.SharedClientBrowserDAO.CreateBrowserIfNotExists(tx, result.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user