You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
package handler |
|
|
|
import ( |
|
"fmt" |
|
"os" |
|
"server/modules/backend/app" |
|
"server/modules/backend/values" |
|
|
|
"github.com/gin-gonic/gin" |
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
func Hot(c *gin.Context) { |
|
a := app.NewApp(c) |
|
// defer func() { |
|
// a.Response() |
|
// }() |
|
file := c.Request.RequestURI[9:] |
|
// index := strings.LastIndex(c.Request.RequestURI, "/") |
|
// fileName := c.Request.RequestURI[index+1:] |
|
filePath := "hot/" + file |
|
log.Debug("path:%v", filePath) |
|
if _, err := os.Stat(filePath); err != nil { |
|
log.Error("err:%v", err) |
|
a.Code = values.CodeRetry |
|
a.Response() |
|
return |
|
} |
|
// c.Header("Content-Disposition", "attachment; filename="+file) |
|
// c.Header("Content-Type", "application/octet-stream") |
|
// c.Header("Content-Disposition", "inline;filename="+file) |
|
c.Header("Connection", "keep-alive") |
|
// c.Header("Content-Transfer-Encoding", "binary") |
|
// c.Header("Cache-Control", "no-cache") |
|
c.File(filePath) |
|
} |
|
|
|
func Privacy(c *gin.Context) { |
|
id := c.Param("id") |
|
filePath := fmt.Sprintf("privacy/PrivacyPolicy%v.html", id) |
|
c.File(filePath) |
|
} |
|
|
|
func TermsofService(c *gin.Context) { |
|
id := c.Param("id") |
|
filePath := fmt.Sprintf("privacy/TERMSOFSERVICE%v.html", id) |
|
c.File(filePath) |
|
}
|
|
|