重新实现套餐

This commit is contained in:
GoEdgeLab
2023-09-06 16:34:11 +08:00
parent 28bf65e88a
commit ca95ea5c3d
10 changed files with 71 additions and 20 deletions

View File

@@ -8,15 +8,17 @@ import (
// 流量限制
func (this *HTTPRequest) doTrafficLimit() {
var config = this.ReqServer.TrafficLimit
this.tags = append(this.tags, "bandwidth")
this.tags = append(this.tags, "trafficLimit")
var statusCode = 509
this.writer.statusCode = statusCode
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
this.writer.Header().Set("Content-Type", "text/html; charset=utf-8")
this.writer.WriteHeader(statusCode)
if len(config.NoticePageBody) != 0 {
var config = this.ReqServer.TrafficLimit
if config != nil && len(config.NoticePageBody) != 0 {
_, _ = this.writer.WriteString(this.Format(config.NoticePageBody))
} else {
_, _ = this.writer.WriteString(this.Format(serverconfigs.DefaultTrafficLimitNoticePageBody))