|
@@ -1127,3 +1127,40 @@ func (this *ResourceController) GetAdminList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// TemplateDownload
|
|
|
+// @Title 下载模板
|
|
|
+// @Description 下载模板
|
|
|
+// @Success 200 {object} models.EdbdataClassifyResp
|
|
|
+// @Param ResourceType query int false "来源:1:模板1;2:模板2"
|
|
|
+// @router /resource/template [get]
|
|
|
+func (this *ResourceController) TemplateDownload() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ resourceType, _ := this.GetInt("ResourceType")
|
|
|
+ downUrl := ""
|
|
|
+ fileName := ""
|
|
|
+ switch resourceType {
|
|
|
+ case 1:
|
|
|
+ downUrl = "./static/template/政策库上传模板.xlsx"
|
|
|
+ fileName = "政策库上传模板.xlsx"
|
|
|
+ case 2:
|
|
|
+ downUrl = "./static/template/观点库上传模板.xlsx"
|
|
|
+ fileName = "观点库上传模板.xlsx"
|
|
|
+ case 3:
|
|
|
+ downUrl = "./static/template/知识库上传模板.xlsx"
|
|
|
+ fileName = "知识库上传模板.xlsx"
|
|
|
+ default:
|
|
|
+ downUrl = "./static/template/事件库上传模版.xlsx"
|
|
|
+ fileName = "事件库上传模版.xlsx"
|
|
|
+ }
|
|
|
+ this.Ctx.Output.Download(downUrl, fileName)
|
|
|
+ //this.Ctx.Output.Download("./static/数据导入模板.xlsx", "数据导入模板.xlsx")
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "下载成功"
|
|
|
+}
|