fix
This commit is contained in:
parent
5f24397d80
commit
692042685d
@ -1,6 +1,8 @@
|
||||
FROM golang:1.21-alpine AS builder
|
||||
LABEL authors="Nite07"
|
||||
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
@ -9,7 +11,10 @@ COPY . .
|
||||
RUN go install github.com/swaggo/swag/cmd/swag@latest
|
||||
RUN swag init
|
||||
ARG version=dev
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X pcgamedb/constant.Version=${version}" -o pcgamedb .
|
||||
RUN if [ "$version" = "dev" ]; then \
|
||||
version=$(git describe --tags --always); \
|
||||
fi && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X github.com/nitezs/pcgamedb/constant.Version=${version}" -o pcgamedb .
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
|
2
build.sh
2
build.sh
@ -1,4 +1,4 @@
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
swag init
|
||||
CGO_ENABLED=0
|
||||
go build -o gamedb .
|
||||
go build -o pcgamedb -ldflags "-s -w -X github.com/nitezs/pcgamedb/constant.Version=$(git describe --tags --always)" .
|
||||
|
5
cache/redis.go
vendored
5
cache/redis.go
vendored
@ -3,11 +3,12 @@ package cache
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/log"
|
||||
"pcgamedb/task"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/task"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -3,12 +3,13 @@ package cmd
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/log"
|
||||
"pcgamedb/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -1,11 +1,12 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
|
@ -1,9 +1,9 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uber.org/zap"
|
||||
|
@ -3,9 +3,10 @@ package cmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/server"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/server"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/log"
|
||||
"pcgamedb/task"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/task"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -1,9 +1,9 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -2,9 +2,10 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"runtime"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
var (
|
||||
Version = "dev"
|
||||
)
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
|
@ -6,14 +6,15 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/jlaffaye/ftp"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -4,13 +4,14 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package crawler
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -1,11 +1,12 @@
|
||||
package crawler
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -4,14 +4,15 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -4,13 +4,14 @@ import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"html"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -2,13 +2,14 @@ package crawler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
@ -2,13 +2,14 @@ package crawler
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -4,14 +4,15 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -5,16 +5,17 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"pcgamedb/cache"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cache"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
)
|
||||
|
||||
var TwitchToken string
|
||||
|
@ -1,10 +1,11 @@
|
||||
package crawler
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -7,15 +7,16 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -5,15 +5,16 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"pcgamedb/cache"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cache"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
)
|
||||
|
||||
func _GetSteamID(name string) (int, error) {
|
||||
|
@ -4,16 +4,17 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"pcgamedb/cache"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cache"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
)
|
||||
|
||||
|
@ -4,13 +4,14 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -4,14 +4,15 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/constant"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/constant"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
)
|
||||
|
||||
func GetDODIGameDownloads() ([]*model.GameDownload, error) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package db
|
||||
|
||||
import "pcgamedb/model"
|
||||
import "github.com/nitezs/pcgamedb/model"
|
||||
|
||||
func IsARMGDDNCrawled(flag string) bool {
|
||||
return IsGameCrawled(flag, "armgddn")
|
||||
|
@ -2,7 +2,8 @@ package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
"pcgamedb/config"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
5
db/db.go
5
db/db.go
@ -3,11 +3,12 @@ package db
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
@ -1,6 +1,6 @@
|
||||
package db
|
||||
|
||||
import "pcgamedb/model"
|
||||
import "github.com/nitezs/pcgamedb/model"
|
||||
|
||||
func GetFitgirlAllGameDownloads() ([]*model.GameDownload, error) {
|
||||
return GetGameDownloadsByAuthor("fitgirl")
|
||||
|
@ -1,7 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
)
|
||||
|
||||
func GetFreeGOGGameDownloads() ([]*model.GameDownload, error) {
|
||||
|
@ -5,14 +5,15 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"pcgamedb/cache"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/model"
|
||||
"regexp"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cache"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
)
|
||||
|
||||
func GetOnlineFixGameDownloads() ([]*model.GameDownload, error) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
)
|
||||
|
||||
func GetXatabGameDownloads() ([]*model.GameDownload, error) {
|
||||
|
@ -2,9 +2,10 @@ package log
|
||||
|
||||
import (
|
||||
"os"
|
||||
"pcgamedb/config"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
|
5
main.go
5
main.go
@ -1,10 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"pcgamedb/cmd"
|
||||
"pcgamedb/log"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cmd"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/log"
|
||||
"pcgamedb/task"
|
||||
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/task"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,7 +2,8 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -2,7 +2,8 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -3,11 +3,12 @@ package handler
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/db"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
@ -2,8 +2,9 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -2,11 +2,12 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/model"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
@ -2,9 +2,10 @@ package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/config"
|
||||
"strings"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"pcgamedb/log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -2,7 +2,8 @@ package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"pcgamedb/log"
|
||||
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
|
@ -1,13 +1,13 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"pcgamedb/server/handler"
|
||||
"pcgamedb/server/middleware"
|
||||
"github.com/nitezs/pcgamedb/server/handler"
|
||||
"github.com/nitezs/pcgamedb/server/middleware"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
docs "pcgamedb/docs"
|
||||
docs "github.com/nitezs/pcgamedb/docs"
|
||||
|
||||
swaggerfiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
|
@ -2,14 +2,15 @@ package server
|
||||
|
||||
import (
|
||||
"io"
|
||||
"pcgamedb/cache"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/db"
|
||||
"pcgamedb/log"
|
||||
"pcgamedb/server/middleware"
|
||||
"pcgamedb/task"
|
||||
"time"
|
||||
|
||||
"github.com/nitezs/pcgamedb/cache"
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/log"
|
||||
"github.com/nitezs/pcgamedb/server/middleware"
|
||||
"github.com/nitezs/pcgamedb/task"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/robfig/cron/v3"
|
||||
"go.uber.org/zap"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"pcgamedb/db"
|
||||
"github.com/nitezs/pcgamedb/db"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -3,10 +3,11 @@ package task
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"pcgamedb/config"
|
||||
"pcgamedb/crawler"
|
||||
"pcgamedb/model"
|
||||
"pcgamedb/utils"
|
||||
|
||||
"github.com/nitezs/pcgamedb/config"
|
||||
"github.com/nitezs/pcgamedb/crawler"
|
||||
"github.com/nitezs/pcgamedb/model"
|
||||
"github.com/nitezs/pcgamedb/utils"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
@ -19,13 +20,13 @@ func Crawl(logger *zap.Logger) {
|
||||
if c, ok := item.(crawler.PagedCrawler); ok {
|
||||
g, err := c.CrawlMulti([]int{1, 2, 3})
|
||||
if err != nil {
|
||||
logger.Error("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err))
|
||||
logger.Warn("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err))
|
||||
}
|
||||
games = append(games, g...)
|
||||
} else if c, ok := item.(crawler.SimpleCrawler); ok {
|
||||
g, err := c.CrawlAll()
|
||||
if err != nil {
|
||||
logger.Error("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err))
|
||||
logger.Warn("Failed to crawl games", zap.String("crawler", c.Name()), zap.Error(err))
|
||||
}
|
||||
games = append(games, g...)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user