...
|
...
|
@@ -3,6 +3,7 @@ package main |
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/astaxie/beego"
|
|
|
"github.com/astaxie/beego/context"
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/config"
|
...
|
...
|
@@ -13,6 +14,7 @@ import ( |
|
|
"opp/internal/utils"
|
|
|
_ "opp/routers"
|
|
|
"os"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -71,6 +73,8 @@ func init() { |
|
|
log.Info(fmt.Sprintf("env REDIS_HOST:%v", os.Getenv("REDIS_HOST")))
|
|
|
log.Info(fmt.Sprintf("env REDIS_PORT:%v", os.Getenv("REDIS_PORT")))
|
|
|
log.Info(fmt.Sprintf("env aliyun_file_access:%v", os.Getenv("aliyun_file_access")))
|
|
|
|
|
|
//mime.AddExtensionType(".mp3","audio/mpeg")
|
|
|
}
|
|
|
|
|
|
func main() {
|
...
|
...
|
@@ -79,6 +83,14 @@ func main() { |
|
|
}()
|
|
|
log.Info("app on start!")
|
|
|
log.Info("Beego Run Mode:", beego.BConfig.RunMode)
|
|
|
|
|
|
beego.InsertFilter("file/opp/*", beego.BeforeStatic, FilterBeforeStatic)
|
|
|
beego.Run()
|
|
|
}
|
|
|
|
|
|
var FilterBeforeStatic = func(ctx *context.Context) {
|
|
|
if strings.HasSuffix(ctx.Request.RequestURI, ".mp3") {
|
|
|
//If-Modified-Since
|
|
|
//ctx.Request.Header.Add("If-Modified-Since","")
|
|
|
ctx.ResponseWriter.Header().Add("Content-Type", "audio/mpeg")
|
|
|
}
|
|
|
} |
...
|
...
|
|