修改模块名为goweb-gin-demo
parent
da4b26cdf6
commit
28bbe31e12
|
@ -101,7 +101,7 @@ docs/
|
|||
└── swagger.yaml
|
||||
```
|
||||
|
||||
> 需要注意把docs文件夹导入到代码中 `import "github.com/ymm135/goweb-gin-demo/docs"`
|
||||
> 需要注意把docs文件夹导入到代码中 `import "goweb-gin-demo/docs"`
|
||||
|
||||
# 验证码获取及校验
|
||||
首选通过`/base/captcha`获取验证码,其中包含验证码图片地址:`data:image/png;...`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/api/web"
|
||||
"goweb-gin-demo/api/web"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
|
|
|
@ -3,9 +3,9 @@ package web
|
|||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mojocn/base64Captcha"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
webRes "github.com/ymm135/goweb-gin-demo/model/web/response"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
webRes "goweb-gin-demo/model/web/response"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/service"
|
||||
"goweb-gin-demo/service"
|
||||
)
|
||||
|
||||
type ApiGroup struct {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
systemReq "github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
systemRes "github.com/ymm135/goweb-gin-demo/model/web/response"
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web"
|
||||
systemReq "goweb-gin-demo/model/web/request"
|
||||
systemRes "goweb-gin-demo/model/web/response"
|
||||
"goweb-gin-demo/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -4,13 +4,13 @@ import (
|
|||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
systemReq "github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
webRes "github.com/ymm135/goweb-gin-demo/model/web/response"
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web"
|
||||
systemReq "goweb-gin-demo/model/web/request"
|
||||
webRes "goweb-gin-demo/model/web/response"
|
||||
"goweb-gin-demo/utils"
|
||||
"go.uber.org/zap"
|
||||
"strconv"
|
||||
"time"
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"fmt"
|
||||
"github.com/fvbock/endless"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/initialize"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/initialize"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
)
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
"github.com/songzhibin97/gkit/cache/local_cache"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
_ "github.com/ymm135/goweb-gin-demo/packfile"
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/global"
|
||||
_ "goweb-gin-demo/packfile"
|
||||
"goweb-gin-demo/utils"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/spf13/viper"
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/utils"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
|
|
@ -2,13 +2,13 @@ package global
|
|||
|
||||
import (
|
||||
"github.com/songzhibin97/gkit/cache/local_cache"
|
||||
"github.com/ymm135/goweb-gin-demo/utils/timer"
|
||||
"goweb-gin-demo/utils/timer"
|
||||
|
||||
"golang.org/x/sync/singleflight"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/config"
|
||||
"goweb-gin-demo/config"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/spf13/viper"
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module github.com/ymm135/goweb-gin-demo
|
||||
module goweb-gin-demo
|
||||
|
||||
go 1.16
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package initialize
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/initialize/internal"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/initialize/internal"
|
||||
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
"gorm.io/gorm/logger"
|
||||
"gorm.io/gorm/utils"
|
||||
)
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
"github.com/swaggo/gin-swagger"
|
||||
"github.com/swaggo/gin-swagger/swaggerFiles"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/middleware"
|
||||
"github.com/ymm135/goweb-gin-demo/router"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/middleware"
|
||||
"goweb-gin-demo/router"
|
||||
)
|
||||
|
||||
func Routers() *gin.Engine {
|
||||
|
|
|
@ -42,3 +42,5 @@
|
|||
[github.com/flipped-aurora/gin-vue-admin/server]2021/10/29 - 14:24:04.838 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:43 router register success
|
||||
[github.com/flipped-aurora/gin-vue-admin/server]2021/10/29 - 14:24:04.839 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8888"}
|
||||
[github.com/flipped-aurora/gin-vue-admin/server]2021/10/29 - 14:33:20.005 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8888: use of closed network connection
|
||||
[github.com/flipped-aurora/gin-vue-admin/server]2021/10/29 - 14:42:32.682 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:43 router register success
|
||||
[github.com/flipped-aurora/gin-vue-admin/server]2021/10/29 - 14:42:32.683 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8888"}
|
||||
|
|
8
main.go
8
main.go
|
@ -1,10 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/core"
|
||||
_ "github.com/ymm135/goweb-gin-demo/docs"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/initialize"
|
||||
"goweb-gin-demo/core"
|
||||
_ "goweb-gin-demo/docs"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/initialize"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -2,10 +2,10 @@ package middleware
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"github.com/ymm135/goweb-gin-demo/service"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/service"
|
||||
)
|
||||
|
||||
var casbinService = service.ServiceGroupApp.CasbinService
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/utils"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/response"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"github.com/ymm135/goweb-gin-demo/service"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
|
|
|
@ -8,10 +8,10 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"github.com/ymm135/goweb-gin-demo/service"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/service"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
)
|
||||
|
||||
type SysBaseMenu struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
)
|
||||
|
||||
type JwtBlacklist struct {
|
||||
|
|
|
@ -4,7 +4,7 @@ package web
|
|||
import (
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
)
|
||||
|
||||
// 如果含有time.Time 请自行import time包
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package request
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web"
|
||||
)
|
||||
|
||||
// Add menu authority info structure
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package request
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/web"
|
||||
)
|
||||
|
||||
type SysOperationRecordSearch struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package response
|
||||
|
||||
import "github.com/ymm135/goweb-gin-demo/model/web"
|
||||
import "goweb-gin-demo/model/web"
|
||||
|
||||
type SysAuthorityResponse struct {
|
||||
Authority web.SysAuthority `json:"authority"`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package response
|
||||
|
||||
import "github.com/ymm135/goweb-gin-demo/model/web"
|
||||
import "goweb-gin-demo/model/web"
|
||||
|
||||
type SysMenusResponse struct {
|
||||
Menus []web.SysMenu `json:"menus"`
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package response
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/model/web"
|
||||
)
|
||||
|
||||
type SysUserResponse struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
"github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package router
|
||||
|
||||
import "github.com/ymm135/goweb-gin-demo/router/web"
|
||||
import "goweb-gin-demo/router/web"
|
||||
|
||||
type RouterGroup struct {
|
||||
web.BaseRouter
|
||||
|
|
|
@ -2,7 +2,7 @@ package web
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/ymm135/goweb-gin-demo/api"
|
||||
"goweb-gin-demo/api"
|
||||
)
|
||||
|
||||
type BaseRouter struct {
|
||||
|
|
|
@ -2,7 +2,7 @@ package web
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
v1 "github.com/ymm135/goweb-gin-demo/api"
|
||||
v1 "goweb-gin-demo/api"
|
||||
)
|
||||
|
||||
type JwtRouter struct {
|
||||
|
|
|
@ -2,8 +2,8 @@ package web
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
v1 "github.com/ymm135/goweb-gin-demo/api"
|
||||
"github.com/ymm135/goweb-gin-demo/middleware"
|
||||
v1 "goweb-gin-demo/api"
|
||||
"goweb-gin-demo/middleware"
|
||||
)
|
||||
|
||||
type MenuRouter struct {
|
||||
|
|
|
@ -2,8 +2,8 @@ package web
|
|||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
v1 "github.com/ymm135/goweb-gin-demo/api"
|
||||
"github.com/ymm135/goweb-gin-demo/middleware"
|
||||
v1 "goweb-gin-demo/api"
|
||||
"goweb-gin-demo/middleware"
|
||||
)
|
||||
|
||||
type UserRouter struct {
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web/response"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/model/web/response"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package service
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"github.com/casbin/casbin/v2/util"
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/model/web/request"
|
||||
)
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"go.uber.org/zap"
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web"
|
||||
)
|
||||
|
||||
type JwtService struct {
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/web"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
systemReq "github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/web"
|
||||
systemReq "goweb-gin-demo/model/web/request"
|
||||
)
|
||||
|
||||
//@author: [granty1](https://github.com/granty1)
|
||||
|
|
|
@ -3,10 +3,10 @@ package service
|
|||
import (
|
||||
"errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/common/request"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web"
|
||||
"github.com/ymm135/goweb-gin-demo/utils"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/web"
|
||||
"goweb-gin-demo/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package utils
|
|||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
systemReq "github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/global"
|
||||
systemReq "goweb-gin-demo/model/web/request"
|
||||
)
|
||||
|
||||
// 从Gin的Context中获取从jwt解析出来的用户ID
|
||||
|
|
|
@ -3,7 +3,7 @@ package utils
|
|||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package utils
|
|||
import (
|
||||
"errors"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"github.com/ymm135/goweb-gin-demo/model/web/request"
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/web/request"
|
||||
)
|
||||
|
||||
type JWT struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
zaprotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/ymm135/goweb-gin-demo/global"
|
||||
"goweb-gin-demo/global"
|
||||
zaprotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue