作者 庄敏学

增加导入类型参数

不能预览此文件类型
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
4 - "fmt"  
5 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
6 "github.com/linmadan/egglib-go/web/beego" 5 "github.com/linmadan/egglib-go/web/beego"
7 "github.com/xuri/excelize/v2" 6 "github.com/xuri/excelize/v2"
@@ -34,7 +33,12 @@ func (controller *ImportController) Import() { @@ -34,7 +33,12 @@ func (controller *ImportController) Import() {
34 controller.Response(nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取excel错误:"+err.Error())) 33 controller.Response(nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "读取excel错误:"+err.Error()))
35 return 34 return
36 } 35 }
37 - dimensions, _ := domain.LoadPerformanceDimensions(rows)  
38 - fmt.Println(dimensions)  
39 - controller.Response(dimensions, nil) 36 + formType := controller.GetString("type")
  37 + switch formType {
  38 + case "PerformanceDimension":
  39 + dimensions, _ := domain.LoadPerformanceDimensions(rows)
  40 + controller.Response(dimensions, nil)
  41 + default:
  42 + controller.Response(nil, application.ThrowError(application.ARG_ERROR, "请确认您导入的表单类型"))
  43 + }
40 } 44 }