package controller import ( "fmt" "github.com/gin-gonic/gin" ) func GetDownloadDeloy(c *gin.Context) { entId, _ := c.Get("ent_id") kefuName, _ := c.Get("kefu_name") host := c.Request.Host config := fmt.Sprintf(` const KEFU_NAME="%s";//商户账号 const ENT_ID="%s";//商户编号 `, kefuName, entId) // 生成HTML内容 htmlContent := ` 在线咨询
` // 设置响应头,让浏览器下载 c.Header("Content-Disposition", "attachment; filename=chat.html") c.Header("Content-Type", "application/octet-stream") // 将HTML内容写入响应 c.String(200, htmlContent) }