mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-25 14:36:35 +08:00
优化代码
This commit is contained in:
@@ -218,6 +218,8 @@ func (this *DNSDomainDAO) ExistAvailableDomains(tx *dbs.Tx) (bool, error) {
|
||||
|
||||
// ExistDomainRecord 检查域名解析记录是否存在
|
||||
func (this *DNSDomainDAO) ExistDomainRecord(tx *dbs.Tx, domainId int64, recordName string, recordType string, recordRoute string, recordValue string) (bool, error) {
|
||||
recordType = strings.ToUpper(recordType)
|
||||
|
||||
query := maps.Map{
|
||||
"name": recordName,
|
||||
"type": recordType,
|
||||
@@ -239,7 +241,6 @@ func (this *DNSDomainDAO) ExistDomainRecord(tx *dbs.Tx, domainId int64, recordNa
|
||||
}
|
||||
}
|
||||
}
|
||||
recordType = strings.ToUpper(recordType)
|
||||
return this.Query(tx).
|
||||
Pk(domainId).
|
||||
Where("JSON_CONTAINS(records, :query)").
|
||||
|
||||
@@ -11,7 +11,7 @@ func TestServerClientBrowserMonthlyStatDAO_IncreaseMonthlyCount(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
var tx *dbs.Tx
|
||||
err := SharedServerClientBrowserMonthlyStatDAO.IncreaseMonthlyCount(tx, 1, 1, "202101", 1)
|
||||
err := SharedServerClientBrowserMonthlyStatDAO.IncreaseMonthlyCount(tx, 1, 1, "1.0", "202101", 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ func TestTrafficDailyStatDAO_IncreaseDayBytes(t *testing.T) {
|
||||
dbs.NotifyReady()
|
||||
|
||||
now := time.Now()
|
||||
err := SharedTrafficDailyStatDAO.IncreaseDailyBytes(nil, timeutil.Format("Ymd"), 1)
|
||||
err := SharedTrafficDailyStatDAO.IncreaseDailyStat(nil, timeutil.Format("Ymd"), 1, 1, 1, 1, 1, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user