This commit is contained in:
xia 2025-01-20 00:11:11 +08:00
parent eac96374bd
commit f22d048ccc
25 changed files with 59 additions and 43 deletions

View File

@ -1,10 +1,10 @@
package controller package controller
import ( import (
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin/service"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"youtu_ecpm/api/gin/service"
"youtu_ecpm/dao/query"
) )
type AppUserInfo struct { type AppUserInfo struct {

View File

@ -4,14 +4,14 @@ import (
"context" "context"
"errors" "errors"
"gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache" "gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin/service"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/douyinapi"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"net/http" "net/http"
"time" "time"
"youtu_ecpm/api/gin/service"
"youtu_ecpm/dao/model"
"youtu_ecpm/dao/query"
"youtu_ecpm/pkg/douyinapi"
) )
type DouyinOpenApiController struct { type DouyinOpenApiController struct {

View File

@ -1,11 +1,11 @@
package controller package controller
import ( import (
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin/service"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"net/http" "net/http"
"youtu_ecpm/api/gin/service"
"youtu_ecpm/dao/query"
) )
type RankingList struct { type RankingList struct {

View File

@ -4,13 +4,13 @@ import (
"context" "context"
"errors" "errors"
"gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache" "gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin/service"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/wechat_api"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"net/http" "net/http"
"youtu_ecpm/api/gin/service"
"youtu_ecpm/dao/model"
"youtu_ecpm/dao/query"
"youtu_ecpm/pkg/wechat_api"
) )
type WechatOpenApiController struct { type WechatOpenApiController struct {

View File

@ -3,6 +3,8 @@ package ecpm_httpserver
import ( import (
"context" "context"
"errors" "errors"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin/controller"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
ginzap "github.com/gin-contrib/zap" ginzap "github.com/gin-contrib/zap"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
@ -10,8 +12,6 @@ import (
"os" "os"
"os/signal" "os/signal"
"time" "time"
"youtu_ecpm/api/gin/controller"
"youtu_ecpm/dao/query"
) )
type HttpServer struct { type HttpServer struct {

View File

@ -2,7 +2,7 @@ package service
import ( import (
"context" "context"
"youtu_ecpm/dao/query" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
) )
type AppAccount struct { type AppAccount struct {

View File

@ -3,10 +3,10 @@ package service
import ( import (
"context" "context"
"errors" "errors"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
"youtu_ecpm/dao/model"
"youtu_ecpm/dao/query"
) )
type AppUserInfo struct { type AppUserInfo struct {

View File

@ -3,10 +3,10 @@ package service
import ( import (
"context" "context"
"gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache" "gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"strconv" "strconv"
"sync" "sync"
"youtu_ecpm/dao/model"
"youtu_ecpm/dao/query"
) )
type RankingList struct { type RankingList struct {

View File

@ -16,7 +16,7 @@ import (
"gorm.io/plugin/dbresolver" "gorm.io/plugin/dbresolver"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
) )
func newAppAccount(db *gorm.DB, opts ...gen.DOOption) appAccount { func newAppAccount(db *gorm.DB, opts ...gen.DOOption) appAccount {

View File

@ -9,7 +9,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gorm.io/gen" "gorm.io/gen"
"gorm.io/gen/field" "gorm.io/gen/field"

View File

@ -16,7 +16,7 @@ import (
"gorm.io/plugin/dbresolver" "gorm.io/plugin/dbresolver"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
) )
func newAppUserInfo(db *gorm.DB, opts ...gen.DOOption) appUserInfo { func newAppUserInfo(db *gorm.DB, opts ...gen.DOOption) appUserInfo {

View File

@ -9,7 +9,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gorm.io/gen" "gorm.io/gen"
"gorm.io/gen/field" "gorm.io/gen/field"

View File

@ -16,7 +16,7 @@ import (
"gorm.io/plugin/dbresolver" "gorm.io/plugin/dbresolver"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
) )
func newDouyinEcpmConfig(db *gorm.DB, opts ...gen.DOOption) douyinEcpmConfig { func newDouyinEcpmConfig(db *gorm.DB, opts ...gen.DOOption) douyinEcpmConfig {

View File

@ -9,7 +9,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gorm.io/gen" "gorm.io/gen"
"gorm.io/gen/field" "gorm.io/gen/field"

View File

@ -16,7 +16,7 @@ import (
"gorm.io/plugin/dbresolver" "gorm.io/plugin/dbresolver"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
) )
func newGameScore(db *gorm.DB, opts ...gen.DOOption) gameScore { func newGameScore(db *gorm.DB, opts ...gen.DOOption) gameScore {

View File

@ -9,7 +9,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"youtu_ecpm/dao/model" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/model"
"gorm.io/gen" "gorm.io/gen"
"gorm.io/gen/field" "gorm.io/gen/field"

View File

@ -19,7 +19,7 @@ services:
- ./data/mysql/data:/var/lib/mysql - ./data/mysql/data:/var/lib/mysql
- ./data/mysql/logs:/var/log/mysql - ./data/mysql/logs:/var/log/mysql
##初始化的脚本初始化我们存放的init.sql文件 ##初始化的脚本初始化我们存放的init.sql文件
- ./data/mysql/initdb:/docker-entrypoint-initdb.d/ - ./sql:/docker-entrypoint-initdb.d/
- ./data/mysql/conf:/etc/mysql/conf.d - ./data/mysql/conf:/etc/mysql/conf.d
ports: ports:
- "3306:3306" - "3306:3306"
@ -29,3 +29,19 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
#network_mode: host #network_mode: host
redis:
image: redis
restart: always
hostname: redis
container_name: redis
privileged: true
ports:
- "6379:6379"
environment:
TZ: Asia/Shanghai
volumes:
- ./data/redis:/data
# - ./conf/redis.conf:/etc/redis/redis.conf
- ./data/redis/logs:/logs
# command: [ "redis-server","/etc/redis/redis.conf" ]

2
go.mod
View File

@ -1,4 +1,4 @@
module youtu_ecpm module gitea.youtukeji.com.cn/xiabin/youtu_ecpm
go 1.23.4 go 1.23.4

View File

@ -1,10 +1,10 @@
package main package main
import ( import (
"youtu_ecpm/dao/query" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"youtu_ecpm/pkg/config" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/config"
"youtu_ecpm/pkg/db" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/db"
"youtu_ecpm/pkg/log" "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/log"
) )
func main() { func main() {

View File

@ -2,9 +2,9 @@ package db
import ( import (
"fmt" "fmt"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/config"
"gorm.io/driver/mysql" "gorm.io/driver/mysql"
"gorm.io/gorm" "gorm.io/gorm"
"youtu_ecpm/pkg/config"
) )
var Db *gorm.DB var Db *gorm.DB

View File

@ -5,9 +5,9 @@ import (
douyinopenapi "gitea.youtukeji.com.cn/xiabin/douyin-openapi" douyinopenapi "gitea.youtukeji.com.cn/xiabin/douyin-openapi"
access_token "gitea.youtukeji.com.cn/xiabin/douyin-openapi/access-token" access_token "gitea.youtukeji.com.cn/xiabin/douyin-openapi/access-token"
"gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache" "gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache"
errors2 "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/errors"
"gorm.io/gorm" "gorm.io/gorm"
"sync" "sync"
errors2 "youtu_ecpm/pkg/errors"
) )
type DouYinOpenApiClient struct { type DouYinOpenApiClient struct {

View File

@ -2,12 +2,12 @@ package wechat_api
import ( import (
"gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache" "gitea.youtukeji.com.cn/xiabin/douyin-openapi/cache"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/pkg/errors"
"github.com/silenceper/wechat/v2" "github.com/silenceper/wechat/v2"
"github.com/silenceper/wechat/v2/miniprogram" "github.com/silenceper/wechat/v2/miniprogram"
miniConfig "github.com/silenceper/wechat/v2/miniprogram/config" miniConfig "github.com/silenceper/wechat/v2/miniprogram/config"
"gorm.io/gorm" "gorm.io/gorm"
"sync" "sync"
"youtu_ecpm/pkg/errors"
) )
type WechatApi struct { type WechatApi struct {

View File

@ -1,7 +1,7 @@
package server package server
import ( import (
ecpmhttpserver "youtu_ecpm/api/gin" ecpmhttpserver "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin"
) )
type EcpmApp struct { type EcpmApp struct {

View File

@ -5,11 +5,11 @@
package main package main
import ( import (
ecpm_httpserver "gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/server"
"github.com/google/wire" "github.com/google/wire"
"go.uber.org/zap" "go.uber.org/zap"
ecpm_httpserver "youtu_ecpm/api/gin"
"youtu_ecpm/dao/query"
"youtu_ecpm/server"
) )
// wireApp init kratos application. // wireApp init kratos application.

View File

@ -7,10 +7,10 @@
package main package main
import ( import (
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/api/gin"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/dao/query"
"gitea.youtukeji.com.cn/xiabin/youtu_ecpm/server"
"go.uber.org/zap" "go.uber.org/zap"
"youtu_ecpm/api/gin"
"youtu_ecpm/dao/query"
"youtu_ecpm/server"
) )
// Injectors from wire.go: // Injectors from wire.go: