shawei_zz há 2 anos atrás
pai
commit
c238017510
1 ficheiros alterados com 12 adições e 13 exclusões
  1. 12 13
      main.go

+ 12 - 13
main.go

@@ -14,10 +14,10 @@ import (
 	_ "net/http/pprof"
 	"os"
 	"strings"
-
 	//"unsafe"
 )
 
+// sss
 // @title 科湃腾Go语言后台API
 // @version 1.1.2
 // @description  kptyun_service
@@ -34,14 +34,14 @@ func main() {
 	logging.Setup()
 
 	svcConfig := &service.Config{
-		Name:        setting.ServerSetting.ServerName, //服务显示名称
-		DisplayName:  setting.ServerSetting.DisplayName, //服务名称
-		Description:  setting.ServerSetting.Description, //服务描述
+		Name:        setting.ServerSetting.ServerName,  //服务显示名称
+		DisplayName: setting.ServerSetting.DisplayName, //服务名称
+		Description: setting.ServerSetting.Description, //服务描述
 	}
 	prg := &program{}
 	s, err := service.New(prg, svcConfig)
 	if err != nil {
-		fmt.Println(err, "service.New() err",err)
+		fmt.Println(err, "service.New() err", err)
 	}
 
 	if len(os.Args) > 1 {
@@ -72,9 +72,8 @@ func main() {
 
 }
 
-
-
 type program struct{}
+
 func (p *program) Start(s service.Service) error {
 	go p.run()
 	return nil
@@ -85,7 +84,7 @@ func (p *program) run() {
 
 	//路由初始化
 	routersInit := routers.InitRouter()
-	if setting.ServerSetting.GRFD == "1"{  //格润富德定时任务
+	if setting.ServerSetting.GRFD == "1" { //格润富德定时任务
 		api.CronGRFD()
 	}
 	readTimeout := setting.ServerSetting.ReadTimeout
@@ -107,14 +106,14 @@ func (p *program) run() {
 	}
 	httpsPort := fmt.Sprintf(":%d", setting.ServerSetting.HttpsPort)
 	// 开启http/https服务
-	if  setting.ServerSetting.Https == 1{
+	if setting.ServerSetting.Https == 1 {
 		log.Printf("[info] start https server listening port %s", httpsPort)
-		_ =routersInit.RunTLS(httpsPort, setting.ServerSetting.CrtPath, setting.ServerSetting.KeyPath)
-	}else if setting.ServerSetting.Https == 2{
-		log.Printf("[info] start https & http  server listening port https %s, http %s", httpsPort,endPoint)
+		_ = routersInit.RunTLS(httpsPort, setting.ServerSetting.CrtPath, setting.ServerSetting.KeyPath)
+	} else if setting.ServerSetting.Https == 2 {
+		log.Printf("[info] start https & http  server listening port https %s, http %s", httpsPort, endPoint)
 		go routersInit.RunTLS(httpsPort, setting.ServerSetting.CrtPath, setting.ServerSetting.KeyPath)
 		_ = server.ListenAndServe()
-	}else {
+	} else {
 		log.Printf("[info] start https server listening port %s", endPoint)
 		_ = server.ListenAndServe()
 	}