diff --git a/Dockerfile b/Dockerfile index 707fa0e..579d5ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") && \ go build -ldflags="-s -w -X 'github.com/perfect-panel/server/pkg/constant.Version=${VERSION}' -X 'github.com/perfect-panel/server/pkg/constant.BuildTime=${BUILD_TIME}'" -o /app/ppanel ppanel.go # Final minimal image -FROM scratch +FROM alpine:latest # Copy CA certificates and timezone data COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ diff --git a/etc/ppanel.yaml b/etc/ppanel.yaml index 24ddd89..5ce9c3d 100644 --- a/etc/ppanel.yaml +++ b/etc/ppanel.yaml @@ -35,4 +35,16 @@ Redis: DB: 0 Administrator: Password: password - Email: admin@ppanel.dev \ No newline at end of file + Email: admin@ppanel.dev +Email: + Enable: true + Platform: smtp + PlatformConfig: '{"host":"smtp.gmail.com","port":465,"user":"devneeds52@gmail.com","pass":"bqxn hurw ckxt ookj","from":"devneeds52@gmail.com","ssl":true}' + EnableVerify: true + EnableNotify: true + EnableDomainSuffix: false + DomainSuffixList: "" + VerifyEmailTemplate: "" + ExpirationEmailTemplate: "" + MaintenanceEmailTemplate: "" + TrafficExceedEmailTemplate: "" \ No newline at end of file diff --git a/internal/logic/common/getStatLogic.go b/internal/logic/common/getStatLogic.go index 003b317..4991d86 100644 --- a/internal/logic/common/getStatLogic.go +++ b/internal/logic/common/getStatLogic.go @@ -3,11 +3,6 @@ package common import ( "context" "encoding/json" - "io" - "net" - "net/http" - "slices" - "strings" "time" "github.com/perfect-panel/server/internal/config" @@ -68,47 +63,9 @@ func (l *GetStatLogic) GetStat() (resp *types.GetStatResponse, err error) { l.Logger.Error("[GetStatLogic] get server_addr failed: ", logger.Field("error", err.Error())) return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "get server_addr failed: %v", err.Error()) } - type apireq struct { - query string - fields string - } - type apiret struct { - CountryCode string `json:"countryCode"` - } - //map as dict - type void struct{} - var v void - country := make(map[string]void) - for c := range slices.Chunk(nodeaddr, 100) { - var batchreq []apireq - for _, addr := range c { - isAddr := net.ParseIP(addr) - if isAddr == nil { - ip, err := net.LookupIP(addr) - if err == nil && len(ip) > 0 { - batchreq = append(batchreq, apireq{query: ip[0].String(), fields: "countryCode"}) - } - } else { - batchreq = append(batchreq, apireq{query: addr, fields: "countryCode"}) - } - } - req, _ := json.Marshal(batchreq) - ret, err := http.Post("http://ip-api.com/batch", "application/json", strings.NewReader(string(req))) - if err == nil { - retBytes, err := io.ReadAll(ret.Body) - if err == nil { - var retStruct []apiret - err := json.Unmarshal(retBytes, &retStruct) - if err == nil { - for _, dat := range retStruct { - if dat.CountryCode != "" { - country[dat.CountryCode] = v - } - } - } - } - } - } + + country := 0 + protocolDict := make(map[string]void) var protocol []string l.svcCtx.DB.Model(&server.Server{}).Where("enable = true").Pluck("protocol", &protocol) @@ -122,7 +79,7 @@ func (l *GetStatLogic) GetStat() (resp *types.GetStatResponse, err error) { resp = &types.GetStatResponse{ User: u, Node: n, - Country: int64(len(country)), + Country: int64(country), Protocol: protocol, OnlineDevice: l.svcCtx.DeviceManager.GetOnlineDeviceCount(), } diff --git a/internal/model/ticket/model.go b/internal/model/ticket/model.go index dac125a..2e80035 100644 --- a/internal/model/ticket/model.go +++ b/internal/model/ticket/model.go @@ -66,8 +66,6 @@ func (m *customTicketModel) QueryTicketList(ctx context.Context, page, size int, } if status != nil { query = query.Where("status = ?", status) - } else { - query = query.Where("status != ?", 4) } if issueType != nil { query = query.Where("issue_type = ?", issueType)