|
@@ -4,26 +4,18 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"work-device/conf"
|
|
|
- "work-device/db"
|
|
|
"work-device/db/repo"
|
|
|
|
|
|
"github.com/gin-contrib/cors"
|
|
|
"github.com/gin-contrib/sessions"
|
|
|
"github.com/gin-contrib/sessions/cookie"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
- "github.com/go-redis/redis/v8"
|
|
|
-)
|
|
|
-
|
|
|
-const (
|
|
|
- SKU3DADMIN = "sku3d-admin"
|
|
|
- SKU3DUSER = "sku3d-user"
|
|
|
- SKU3DDESIGNER = "sku3d-designer"
|
|
|
)
|
|
|
|
|
|
type Service struct {
|
|
|
- Gin *gin.Engine
|
|
|
- Mongo *db.MongoDB
|
|
|
- Redis *redis.Client
|
|
|
+ Gin *gin.Engine
|
|
|
+ // Mongo *db.MongoDB
|
|
|
+ // Redis *redis.Client
|
|
|
Port int32
|
|
|
DebugUserId string
|
|
|
DebugUserPhone string
|
|
@@ -43,13 +35,15 @@ type ApiSession struct {
|
|
|
|
|
|
func (api *ApiSession) CreateRepoCtx() *repo.RepoSession {
|
|
|
return &repo.RepoSession{
|
|
|
- Ctx: context.Background(),
|
|
|
- Client: api.Svc.Mongo,
|
|
|
- Redis: api.Svc.Redis,
|
|
|
+ Ctx: context.Background(),
|
|
|
+ // Client: api.Svc.Mongo,
|
|
|
+ // Redis: api.Svc.Redis,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func NewHttpService(app *conf.AppConf, dbMongo *db.MongoDB, redisClient *redis.Client) *Service {
|
|
|
+// func NewHttpService(app *conf.AppConf, dbMongo *db.MongoDB, redisClient *redis.Client) *Service {
|
|
|
+
|
|
|
+func NewHttpService(app *conf.AppConf) *Service {
|
|
|
|
|
|
engine := gin.Default()
|
|
|
|
|
@@ -64,7 +58,8 @@ func NewHttpService(app *conf.AppConf, dbMongo *db.MongoDB, redisClient *redis.C
|
|
|
|
|
|
jwt := NewUitlsJwt(app)
|
|
|
|
|
|
- s := &Service{Conf: app, Redis: redisClient, JWT: jwt, Gin: engine, Mongo: dbMongo, Port: app.Port, DebugUserId: app.Debug.UserId, DebugUserPhone: app.Debug.UserPhone, DebugUserRole: app.Debug.UserRole}
|
|
|
+ // s := &Service{Conf: app, Redis: redisClient, JWT: jwt, Gin: engine, Mongo: dbMongo, Port: app.Port, DebugUserId: app.Debug.UserId, DebugUserPhone: app.Debug.UserPhone, DebugUserRole: app.Debug.UserRole}
|
|
|
+ s := &Service{Conf: app, JWT: jwt, Gin: engine, Port: app.Port, DebugUserId: app.Debug.UserId, DebugUserPhone: app.Debug.UserPhone, DebugUserRole: app.Debug.UserRole}
|
|
|
|
|
|
RegRouters(s)
|
|
|
|