mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
fix: #1117
This commit is contained in:
@@ -3,7 +3,6 @@ package internal
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -108,7 +107,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
|
||||
// REF: https://www.51dns.com/document/api/4/12.html
|
||||
request := &dnscomsdk.RecordCreateRequest{
|
||||
DomainID: lo.ToPtr(zone.DomainID),
|
||||
DomainID: lo.ToPtr(zone.DomainID.String()),
|
||||
Type: lo.ToPtr("TXT"),
|
||||
Host: lo.ToPtr(subDomain),
|
||||
Value: lo.ToPtr(info.Value),
|
||||
@@ -120,7 +119,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
}
|
||||
|
||||
d.recordCacheMu.Lock()
|
||||
d.recordCache[token] = dnsRecordCacheEntry{DomainID: zone.DomainID, RecordID: response.Data.RecordID}
|
||||
d.recordCache[token] = dnsRecordCacheEntry{DomainID: zone.DomainID.String(), RecordID: response.Data.RecordID.String()}
|
||||
d.recordCacheMu.Unlock()
|
||||
|
||||
return nil
|
||||
@@ -153,8 +152,8 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
||||
}
|
||||
|
||||
type dnsRecordCacheEntry struct {
|
||||
DomainID int64
|
||||
RecordID int64
|
||||
DomainID string
|
||||
RecordID string
|
||||
}
|
||||
|
||||
func (d *DNSProvider) findZone(zoneName string) (*dnscomsdk.DomainRecord, error) {
|
||||
@@ -176,7 +175,7 @@ func (d *DNSProvider) findZone(zoneName string) (*dnscomsdk.DomainRecord, error)
|
||||
}
|
||||
|
||||
for _, domainItem := range response.Data.Data {
|
||||
if strings.TrimRight(domainItem.Domain, ".") == zoneName {
|
||||
if domainItem.Domain == zoneName {
|
||||
return domainItem, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,20 +6,19 @@ import (
|
||||
)
|
||||
|
||||
type DomainListRequest struct {
|
||||
GroupID *int64 `json:"groupID,omitempty"`
|
||||
Page *int32 `json:"page,omitempty"`
|
||||
PageSize *int32 `json:"pageSize,omitempty"`
|
||||
GroupID *string `json:"groupID,omitempty"`
|
||||
Page *int32 `json:"page,omitempty"`
|
||||
PageSize *int32 `json:"pageSize,omitempty"`
|
||||
}
|
||||
|
||||
type DomainListResponse struct {
|
||||
apiResponseBase
|
||||
|
||||
Data *struct {
|
||||
Data []*DomainRecord `json:"data"`
|
||||
RecordCount int32 `json:"recordCount"`
|
||||
Page int32 `json:"page"`
|
||||
PageSize int32 `json:"pageSize"`
|
||||
PageCount int32 `json:"pageCount"`
|
||||
Data []*DomainRecord `json:"data"`
|
||||
Page int32 `json:"page"`
|
||||
PageSize int32 `json:"pageSize"`
|
||||
PageCount int32 `json:"pageCount"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
)
|
||||
|
||||
type RecordCreateRequest struct {
|
||||
DomainID *int64 `json:"domainID,omitempty"`
|
||||
ViewID *int64 `json:"viewID,omitempty"`
|
||||
DomainID *string `json:"domainID,omitempty"`
|
||||
ViewID *string `json:"viewID,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Host *string `json:"host,omitempty"`
|
||||
Value *string `json:"value,omitempty"`
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
)
|
||||
|
||||
type RecordRemoveRequest struct {
|
||||
DomainID *int64 `json:"domainID,omitempty"`
|
||||
RecordID *int64 `json:"recordID,omitempty"`
|
||||
DomainID *string `json:"domainID,omitempty"`
|
||||
RecordID *string `json:"recordID,omitempty"`
|
||||
}
|
||||
|
||||
type RecordRemoveResponse struct {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package dnscom
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type apiResponse interface {
|
||||
GetCode() int32
|
||||
GetMessage() string
|
||||
@@ -21,21 +25,26 @@ func (r *apiResponseBase) GetMessage() string {
|
||||
var _ apiResponse = (*apiResponseBase)(nil)
|
||||
|
||||
type DomainRecord struct {
|
||||
DomainID int64 `json:"domainID"`
|
||||
Domain string `json:"domain"`
|
||||
State int32 `json:"state"`
|
||||
GroupID json.Number `json:"groupID"`
|
||||
DomainID json.Number `json:"domainsID"`
|
||||
Domain string `json:"domains"`
|
||||
State int32 `json:"state"`
|
||||
UserLockState int32 `json:"userLock"`
|
||||
AdminLockState int32 `json:"adminLock"`
|
||||
HealthState int32 `json:"healthState"`
|
||||
ViewType string `json:"view_type"`
|
||||
}
|
||||
|
||||
type DNSRecord struct {
|
||||
DomainID int64 `json:"domainID"`
|
||||
RecordID int64 `json:"recordID"`
|
||||
ViewID int64 `json:"viewID"`
|
||||
Record string `json:"record"`
|
||||
Type string `json:"type"`
|
||||
Host string `json:"host"`
|
||||
Value string `json:"value"`
|
||||
TTL int32 `json:"ttl"`
|
||||
MX int32 `json:"mx"`
|
||||
State int32 `json:"state"`
|
||||
Remark string `json:"remark"`
|
||||
DomainID json.Number `json:"domainID"`
|
||||
RecordID json.Number `json:"recordID"`
|
||||
ViewID json.Number `json:"viewID"`
|
||||
Record string `json:"record"`
|
||||
Type string `json:"type"`
|
||||
Host string `json:"host"`
|
||||
Value string `json:"value"`
|
||||
TTL int32 `json:"ttl"`
|
||||
MX int32 `json:"mx"`
|
||||
State int32 `json:"state"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user