Compare commits
	
		
			4 Commits
		
	
	
		
			63b0d09e35
			...
			feature/lo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9daa1ba251 | |||
| af174ba501 | |||
| e152823b21 | |||
| ad39fe5b68 | 
							
								
								
									
										18
									
								
								gin/static/define.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								gin/static/define.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
// Package static ...
 | 
			
		||||
//
 | 
			
		||||
// Description : static
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2021/12/24 2:18 PM
 | 
			
		||||
package static
 | 
			
		||||
 | 
			
		||||
// MapRule 定义映射规则
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2:18 PM 2021/12/24
 | 
			
		||||
type MapRule struct {
 | 
			
		||||
	URIPrefix     string `json:"uri_prefix"`      // 路由前缀
 | 
			
		||||
	StaticDirPath string `json:"static_dir_path"` // 静态资源路由
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								gin/static/static.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								gin/static/static.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
			
		||||
// Package static ...
 | 
			
		||||
//
 | 
			
		||||
// Description : 启动静态资源服务器
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2021/12/24 2:14 PM
 | 
			
		||||
package static
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
 | 
			
		||||
	"github.com/gin-gonic/gin"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Register 静态资源服务器
 | 
			
		||||
//
 | 
			
		||||
// Author : go_developer@163.com<白茶清欢>
 | 
			
		||||
//
 | 
			
		||||
// Date : 2:17 PM 2021/12/24
 | 
			
		||||
func Register(router *gin.Engine, ruleList []*MapRule) {
 | 
			
		||||
	for _, rule := range ruleList {
 | 
			
		||||
		router.StaticFS(rule.URIPrefix, http.Dir(rule.StaticDirPath))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.mod
									
									
									
									
									
								
							@ -27,7 +27,7 @@ require (
 | 
			
		||||
	gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
 | 
			
		||||
	gopkg.in/yaml.v2 v2.4.0
 | 
			
		||||
	gorm.io/driver/mysql v1.2.0
 | 
			
		||||
	gorm.io/gorm v1.22.3
 | 
			
		||||
	gorm.io/gorm v1.22.4
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
@ -68,7 +68,7 @@ require (
 | 
			
		||||
	github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect
 | 
			
		||||
	github.com/jcmturner/rpc/v2 v2.0.3 // indirect
 | 
			
		||||
	github.com/jinzhu/inflection v1.0.0 // indirect
 | 
			
		||||
	github.com/jinzhu/now v1.1.2 // indirect
 | 
			
		||||
	github.com/jinzhu/now v1.1.4 // indirect
 | 
			
		||||
	github.com/jonboulle/clockwork v0.2.2 // indirect
 | 
			
		||||
	github.com/json-iterator/go v1.1.11 // indirect
 | 
			
		||||
	github.com/klauspost/compress v1.13.6 // indirect
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										5
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								go.sum
									
									
									
									
									
								
							@ -294,6 +294,9 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
 | 
			
		||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
 | 
			
		||||
github.com/jinzhu/now v1.1.2 h1:eVKgfIdy9b6zbWBMgFpfDPoAMifwSZagU9HmEU6zgiI=
 | 
			
		||||
github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 | 
			
		||||
github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 | 
			
		||||
github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=
 | 
			
		||||
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 | 
			
		||||
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
 | 
			
		||||
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
 | 
			
		||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
 | 
			
		||||
@ -933,6 +936,8 @@ gorm.io/driver/mysql v1.2.0 h1:l8+9VwjjyzEkw0PNPBOr2JHhLOGVk7XEnl5hk42bcvs=
 | 
			
		||||
gorm.io/driver/mysql v1.2.0/go.mod h1:4RQmTg4okPghdt+kbe6e1bTXIQp7Ny1NnBn/3Z6ghjk=
 | 
			
		||||
gorm.io/gorm v1.22.3 h1:/JS6z+GStEQvJNW3t1FTwJwG/gZ+A7crFdRqtvG5ehA=
 | 
			
		||||
gorm.io/gorm v1.22.3/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0=
 | 
			
		||||
gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM=
 | 
			
		||||
gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk=
 | 
			
		||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
			
		||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
			
		||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user