parent
8e734cdd35
commit
6532c62f9b
@ -0,0 +1,82 @@
|
|||||||
|
package LoginController
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dsSdsf/Utils/CommonUtil"
|
||||||
|
"dsSdsf/Utils/ConfigUtil"
|
||||||
|
"dsSdsf/Utils/RedisUtil"
|
||||||
|
"dsSdsf/Utils/RsaUtil"
|
||||||
|
"encoding/base64"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
//模块的路由配置
|
||||||
|
func Routers(r *gin.RouterGroup) {
|
||||||
|
rr := r.Group("/login")
|
||||||
|
|
||||||
|
rr.GET("/test", test)
|
||||||
|
rr.GET("/test1", test1)
|
||||||
|
rr.POST("/doLogin", doLogin)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func test(c *gin.Context) {
|
||||||
|
b := "eWgaeStLsS3Kh/M2oaL3rEzndYZtk5mdnEGyKScOuD40iUnC/a4I0N6gRhNbHRrQplZixM8C0Ng8B3gsy70Abg=="
|
||||||
|
enb, _ := base64.StdEncoding.DecodeString(b)
|
||||||
|
decryptPwd, err := RsaUtil.RsaDecrypt(enb)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "无法解密!"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": true, "info": string(decryptPwd)})
|
||||||
|
}
|
||||||
|
|
||||||
|
func test1(c *gin.Context) {
|
||||||
|
|
||||||
|
redirectUri := c.Query("redirect_uri")
|
||||||
|
|
||||||
|
token := CommonUtil.GetUUID()
|
||||||
|
|
||||||
|
RedisUtil.SET(token, "1", 3000)
|
||||||
|
c.SetCookie("token", token, 0, "/", "", false, true)
|
||||||
|
|
||||||
|
c.Redirect(http.StatusMovedPermanently, redirectUri)
|
||||||
|
}
|
||||||
|
|
||||||
|
func doLogin(c *gin.Context) {
|
||||||
|
user := c.PostForm("user")
|
||||||
|
pwd := c.PostForm("pwd")
|
||||||
|
|
||||||
|
if user == "" || pwd == "" {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不允许为空!"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//RSA解密密码
|
||||||
|
base64Pwd, _ := base64.StdEncoding.DecodeString(pwd)
|
||||||
|
decryptPwdByte, err := RsaUtil.RsaDecrypt(base64Pwd)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不正确!"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//真实密码
|
||||||
|
realPwd := string(decryptPwdByte)
|
||||||
|
//验证密码
|
||||||
|
if realPwd != ConfigUtil.UserPwd {
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不正确!"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成token
|
||||||
|
token := CommonUtil.GetUUID()
|
||||||
|
//将token放到redis设置30分钟过期
|
||||||
|
RedisUtil.SET(token, "1", 1800)
|
||||||
|
//写cookie
|
||||||
|
c.SetCookie("token", token, 0, "/", "", false, true)
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{"sucess": true, "info": "登录成功!"})
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
[distribute] #发布功能的配置
|
||||||
|
ip = 10.10.14.187
|
||||||
|
port = 22
|
||||||
|
user = root
|
||||||
|
pwd = dsideal
|
||||||
|
remotePath = /usr/local/dsMin/dsSdsf/
|
||||||
|
localPath = E:/Work/dsMin/dsSdsf
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
ip = 10.10.14.187
|
||||||
|
port = 22066
|
||||||
|
db_name = base_db_dev
|
||||||
|
user = root
|
||||||
|
pwd = DsideaL147258369
|
||||||
|
|
||||||
|
[redis]
|
||||||
|
ip = 10.10.14.175
|
||||||
|
port = 18890
|
||||||
|
db = 0
|
||||||
|
expireTime = 86400
|
||||||
|
|
||||||
|
#gin服务器的端口
|
||||||
|
[server]
|
||||||
|
port = 8006
|
||||||
|
|
||||||
|
# 本项目名称,用于记录日志
|
||||||
|
[project]
|
||||||
|
project_name = dsSdsf
|
||||||
|
|
||||||
|
[user]
|
||||||
|
user_name = admin
|
||||||
|
user_pwd = dsideal
|
||||||
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIBOQIBAAJBANiZGE52k8UZFFbK2hqFqnPx3H5uICIIP4+8BJD6qdmRdjxxZZ2b
|
||||||
|
0YjLagsNGJZ+w1TQZyBDxiLn3RPf6qxL2AcCAwEAAQJABAkOJ+ATrrdh5qAO4jGd
|
||||||
|
VF2sMvrQRHIM5RumpiDVa0U+tf2uvHkAUY2Lxhg1Mbwhd6xvzCshhNHM3EGp7Jdh
|
||||||
|
IQIhAP97VtscjKD7xZzKbUgyataufHd2NZrrS0OCXFIvRkh3AiEA2QmQo6Gcwbtj
|
||||||
|
CKmrfqJHq0aICzaLnRNF3bKH9fHzYPECIDEoSEQMsDphd1p90J0tpkT8edJ6mkHe
|
||||||
|
uDKbKKxfkERtAiAoU4elb7ThpkCrbmMn/10TrOJAOx1LzTXxEGgEwbT38QIgQsJO
|
||||||
|
SRVo5LE55m6bEJ8yTMUM+7L2HENYmPCD2V/yULI=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
@ -0,0 +1,15 @@
|
|||||||
|
package Router
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dsSdsf/Business/Login/LoginController"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
//接口路由
|
||||||
|
func GinRouter(r *gin.Engine) {
|
||||||
|
//注册分路线
|
||||||
|
rr := r.Group("/sdsf")
|
||||||
|
//登录
|
||||||
|
LoginController.Routers(rr)
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,231 @@
|
|||||||
|
package ConfigUtil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"gopkg.in/ini.v1"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//要发布到的主机信息
|
||||||
|
DistributeIp string
|
||||||
|
DistributePort int32
|
||||||
|
DistributeUser string
|
||||||
|
DistributePwd string
|
||||||
|
DistributeRemotePath string
|
||||||
|
DistributeLocalPath string
|
||||||
|
|
||||||
|
//服务器的端口
|
||||||
|
ServerPort string
|
||||||
|
|
||||||
|
//mysql配置
|
||||||
|
MysqlIp string
|
||||||
|
MysqlPort string
|
||||||
|
MysqlDbName string
|
||||||
|
MysqlUser string
|
||||||
|
MysqlPwd string
|
||||||
|
|
||||||
|
//REDIS配置
|
||||||
|
RedisIp string
|
||||||
|
RedisPort string
|
||||||
|
RedisDb string
|
||||||
|
RedisExpireTime int64
|
||||||
|
|
||||||
|
//项目名称
|
||||||
|
ProjectName string
|
||||||
|
|
||||||
|
//登录信息
|
||||||
|
UserName string
|
||||||
|
UserPwd string
|
||||||
|
|
||||||
|
//RSA私钥
|
||||||
|
PrivateKey string
|
||||||
|
)
|
||||||
|
|
||||||
|
// 判断所给路径文件/文件夹是否存在
|
||||||
|
func Exists(path string) bool {
|
||||||
|
_, err := os.Stat(path) //os.Stat获取文件信息
|
||||||
|
if err != nil {
|
||||||
|
if os.IsExist(err) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
//判断是不是单元测试,如果是的话,那么配置文件的路径需要加上一个.
|
||||||
|
var configIniFile = "./Config/Config.ini"
|
||||||
|
//判断文件不是存在
|
||||||
|
if !Exists(configIniFile) {
|
||||||
|
configIniFile = "." + configIniFile
|
||||||
|
}
|
||||||
|
//再不存在,直接走物理路径
|
||||||
|
if !Exists(configIniFile) {
|
||||||
|
configIniFile = "/usr/local/dsMin/dsSdsf/Config/Config.ini"
|
||||||
|
}
|
||||||
|
|
||||||
|
iniParser := IniParser{}
|
||||||
|
if err := iniParser.Load(configIniFile); err != nil {
|
||||||
|
fmt.Printf("try load config file[%s] error[%s]\n", configIniFile, err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//要发布到的主机信息
|
||||||
|
DistributeIp = iniParser.GetString("distribute", "ip")
|
||||||
|
DistributePort = iniParser.GetInt32("distribute", "port")
|
||||||
|
DistributeUser = iniParser.GetString("distribute", "user")
|
||||||
|
DistributePwd = iniParser.GetString("distribute", "pwd")
|
||||||
|
DistributeRemotePath = iniParser.GetString("distribute", "remotePath")
|
||||||
|
DistributeLocalPath = iniParser.GetString("distribute", "localPath")
|
||||||
|
|
||||||
|
//web服务器端口
|
||||||
|
ServerPort = iniParser.GetString("server", "port")
|
||||||
|
|
||||||
|
//读取redis配置
|
||||||
|
RedisIp = iniParser.GetString("redis", "ip")
|
||||||
|
RedisPort = iniParser.GetString("redis", "port")
|
||||||
|
RedisDb = iniParser.GetString("redis", "db")
|
||||||
|
RedisExpireTime = iniParser.GetInt64("redis", "expireTime")
|
||||||
|
|
||||||
|
//项目名称
|
||||||
|
ProjectName = iniParser.GetString("project", "project_name")
|
||||||
|
|
||||||
|
//mysql
|
||||||
|
MysqlIp = iniParser.GetString("mysql", "ip")
|
||||||
|
MysqlPort = iniParser.GetString("mysql", "port")
|
||||||
|
MysqlDbName = iniParser.GetString("mysql", "db_name")
|
||||||
|
MysqlUser = iniParser.GetString("mysql", "user")
|
||||||
|
MysqlPwd = iniParser.GetString("mysql", "pwd")
|
||||||
|
|
||||||
|
//登录信息
|
||||||
|
UserName = iniParser.GetString("mysql", "user_name")
|
||||||
|
UserPwd = iniParser.GetString("mysql", "user_pwd")
|
||||||
|
|
||||||
|
b, err := ioutil.ReadFile("./Config/privateKey.txt")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Print(err)
|
||||||
|
}
|
||||||
|
PrivateKey = string(b)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type IniParser struct {
|
||||||
|
confReader *ini.File // config reader
|
||||||
|
}
|
||||||
|
|
||||||
|
type IniParserError struct {
|
||||||
|
errorInfo string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *IniParserError) Error() string { return e.errorInfo }
|
||||||
|
|
||||||
|
func (this *IniParser) Load(configFileName string) error {
|
||||||
|
conf, err := ini.Load(configFileName)
|
||||||
|
if err != nil {
|
||||||
|
this.confReader = nil
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.confReader = conf
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetString(section string, key string) string {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.Key(key).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetInt32(section string, key string) int32 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueInt, _ := s.Key(key).Int()
|
||||||
|
|
||||||
|
return int32(valueInt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetUint32(section string, key string) uint32 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueInt, _ := s.Key(key).Uint()
|
||||||
|
|
||||||
|
return uint32(valueInt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetInt64(section string, key string) int64 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueInt, _ := s.Key(key).Int64()
|
||||||
|
return valueInt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetUint64(section string, key string) uint64 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueInt, _ := s.Key(key).Uint64()
|
||||||
|
return valueInt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetFloat32(section string, key string) float32 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueFloat, _ := s.Key(key).Float64()
|
||||||
|
return float32(valueFloat)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IniParser) GetFloat64(section string, key string) float64 {
|
||||||
|
if this.confReader == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
s := this.confReader.Section(section)
|
||||||
|
if s == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
valueFloat, _ := s.Key(key).Float64()
|
||||||
|
return valueFloat
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package RedisUtil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dsSdsf/Utils/ConfigUtil"
|
||||||
|
"github.com/go-redis/redis"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
RedisClient *redis.Client
|
||||||
|
RedisHost string
|
||||||
|
RedisDb int
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// 从配置文件获取redis的ip以及db
|
||||||
|
RedisHost = ConfigUtil.RedisIp + ":" + ConfigUtil.RedisPort
|
||||||
|
RedisClient = redis.NewClient(&redis.Options{
|
||||||
|
Addr: RedisHost,
|
||||||
|
DB: 0, // use default DB
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func SET(key string, value string, expiration time.Duration) {
|
||||||
|
RedisClient.Set(key, value, expiration*time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GET(key string) (string, error) {
|
||||||
|
val, err := RedisClient.Get(key).Result()
|
||||||
|
return val, err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func EXPIRE(key string, expiration time.Duration) {
|
||||||
|
RedisClient.Expire(key, expiration*time.Second)
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
module dsSdsf
|
||||||
|
|
||||||
|
go 1.16
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gin-gonic/gin v1.7.2 // indirect
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
github.com/satori/go.uuid v1.2.0 // indirect
|
||||||
|
gopkg.in/ini.v1 v1.62.0 // indirect
|
||||||
|
)
|
@ -0,0 +1,67 @@
|
|||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
|
github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA=
|
||||||
|
github.com/gin-gonic/gin v1.7.2/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||||
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
|
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||||
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
|
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||||
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
|
||||||
|
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||||
|
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||||
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||||
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||||
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
|
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||||
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||||
|
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
@ -0,0 +1,32 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dsSdsf/Handler"
|
||||||
|
"dsSdsf/Router"
|
||||||
|
"dsSdsf/Utils"
|
||||||
|
"dsSdsf/Utils/ConfigUtil"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// 发布模式
|
||||||
|
//gin.SetMode(gin.ReleaseMode)
|
||||||
|
// 开发模式
|
||||||
|
gin.SetMode(gin.DebugMode)
|
||||||
|
// 开启gin服务器
|
||||||
|
r := gin.Default()
|
||||||
|
// 使用跨域中间件
|
||||||
|
r.Use(Utils.Cors())
|
||||||
|
|
||||||
|
//统一认证拦截器
|
||||||
|
r.Use(Handler.LoginHandler())
|
||||||
|
|
||||||
|
//前台页面目录
|
||||||
|
//r.Static("/dsSdsf", "./Html")
|
||||||
|
|
||||||
|
//主路由
|
||||||
|
Router.GinRouter(r)
|
||||||
|
|
||||||
|
// 监听并在 0.0.0.0:8006 上启动服务
|
||||||
|
r.Run(":" + ConfigUtil.ServerPort)
|
||||||
|
}
|
Loading…
Reference in new issue