|
@@ -279,8 +279,12 @@ func ExportTest(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func TestTmplate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func TestTmplate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
db := c.Param("scope")
|
|
db := c.Param("scope")
|
|
fmt.Println(db)
|
|
fmt.Println(db)
|
|
|
|
+ filename := "考核试题模板.xlsx"
|
|
|
|
+ // url.PathEscape将字符串中的特殊字符进行编码,使其符合URL规范
|
|
|
|
+ filename = url.PathEscape(filename)
|
|
|
|
+
|
|
// 设置下载的文件名
|
|
// 设置下载的文件名
|
|
- c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", TESTS_TMPLATE_FILE))
|
|
|
|
|
|
+ c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", filename))
|
|
|
|
|
|
// 设置文件类型
|
|
// 设置文件类型
|
|
c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
|
c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|