func (c *Context) SetContent(data *PrevData) {
	c.l.Lock()
	c.prevData = data
	c.l.Unlock()
}
Deprecated: You can directly modify the return value of PrevContent()
package znet
import (
	"bytes"
	"encoding/json"
	"fmt"
	"html/template"
	"io/ioutil"
	"mime"
	"net/http"
	"os"
	"path/filepath"
	"strings"
	"github.com/sohaha/zlsgo/zfile"
	"github.com/sohaha/zlsgo/zstring"
	"github.com/sohaha/zlsgo/zutil"
)
type (
	render interface {
		Content(c *Context) (content []byte)
	}
	renderByte struct {
		Data        []byte
		Type        string
		ContentDate []byte
	}
	renderString struct {
		Format      string
		Data        []interface{}
		ContentDate []byte
	}
	renderJSON struct {
		Data        interface{}
		ContentDate []byte
	}
	renderFile struct {
		Data        string
		FileExist   bool
		ContentDate []byte
	}
	renderHTML struct {
		Template    *template.Template
		Data        interface{}
		ContentDate []byte
		FuncMap     template.FuncMap
		Templates   []string
	}
	ApiData struct {
		Code int         `json:"code" example:"200"`
		Msg  string      `json:"msg"`
		Data interface{} `json:"data"`
	}
	Data     map[string]interface{}
	PrevData struct {
		Code    int
		Type    string
		Content []byte
	}
)
var (
	ContentTypePlain = "text/plain; charset=utf-8"
	ContentTypeHTML = "text/html; charset=utf-8"
	ContentTypeJSON = "application/json; charset=utf-8"
)
func (c *Context) renderProcessing(code int, r render) {
	c.l.Lock()
	c.prevData.Code = code
	c.render = r
	c.stopHandle = true
	c.l.Unlock()
}
func (r *renderByte) Content(c *Context) []byte {
	if !c.hasContentType() {
		c.SetContentType(zutil.IfVal(r.Type != "", r.Type, ContentTypePlain).(string))
	}
	return r.Data
}
func (r *renderString) Content(c *Context) []byte {
	if r.ContentDate != nil {
		return r.ContentDate
	}
	c.SetContentType(ContentTypePlain)
	if len(r.Data) > 0 {
		r.ContentDate = zstring.String2Bytes(fmt.Sprintf(r.Format, r.Data...))
	} else {
		r.ContentDate = zstring.String2Bytes(r.Format)
	}
	return r.ContentDate
}
func (r *renderJSON) Content(c *Context) []byte {
	if r.ContentDate != nil {
		return r.ContentDate
	}
	c.SetContentType(ContentTypeJSON)
	r.ContentDate, _ = json.Marshal(r.Data)
	return r.ContentDate
}
func (r *renderFile) Content(c *Context) []byte {
	if !r.FileExist {
		return []byte{}
	}
	if r.ContentDate != nil {
		return r.ContentDate
	}
	fType := mime.TypeByExtension(filepath.Ext(r.Data))
	c.SetContentType(fType)
	r.ContentDate, _ = ioutil.ReadFile(r.Data)
	return r.ContentDate
}
func (r *renderHTML) Content(c *Context) []byte {
	if r.ContentDate != nil {
		return r.ContentDate
	}
	c.SetContentType(ContentTypeHTML)
	if len(r.Templates) > 0 {
		var (
			buf bytes.Buffer
			err error
			t   *template.Template
		)
		tpl := c.Engine.template
		if tpl != nil {
			t = tpl.Get(c.Engine.IsDebug())
			if t != nil && len(r.FuncMap) == 0 {
				name := r.Templates[0]
				err = t.ExecuteTemplate(&buf, name, r.Data)
				if err == nil {
					r.ContentDate = buf.Bytes()
					return r.ContentDate
				}
				if !strings.Contains(err.Error(), " is undefined") {
					panic(err)
				}
			}
		}
		if t, err = templateParse(r.Templates, r.FuncMap); err == nil {
			err = t.Execute(&buf, r.Data)
		}
		if err != nil {
			panic(err)
		}
		r.ContentDate = buf.Bytes()
	} else {
		r.ContentDate = zstring.String2Bytes(fmt.Sprint(r.Data))
	}
	return r.ContentDate
}
func (c *Context) Byte(code int, value []byte) {
	c.renderProcessing(code, &renderByte{Data: value})
}
func (c *Context) String(code int, format string, values ...interface{}) {
	c.renderProcessing(code, &renderString{Format: format, Data: values})
}