|
@@ -27,6 +27,7 @@ type ExcelInfoController struct {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
func (this *ExcelInfoController) GetTableDetail() {
|
|
@@ -45,9 +46,61 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
fromScene, _ := this.GetInt("FromScene", 0)
|
|
|
referencedId, _ := this.GetInt("ReferencedId", 0)
|
|
|
uuid := this.GetString("Uuid")
|
|
|
+ authToken := this.GetString("AuthToken")
|
|
|
+
|
|
|
+ businessConf, err := models.GetBusinessConfByKey(models.BusinessConfChartAuth)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取配置失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
|
|
|
resp := new(response.ExcelTableDetailResp)
|
|
|
+ excelInfo, err := models.GetExcelInfoByUniqueCode(uniqueCode)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "该表格已被删除,请刷新页面"
|
|
|
+ br.ErrMsg = "该表格已被删除,请刷新页面,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取表格表信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if businessConf.ConfVal == `true` {
|
|
|
+ resp.ExcelType = excelInfo.ExcelType
|
|
|
+ resp.ExcelName = excelInfo.ExcelName
|
|
|
+ resp.ExcelImage = excelInfo.ExcelImage
|
|
|
+ resp.UniqueCode = excelInfo.UniqueCode
|
|
|
+ resp.SourcesFrom = excelInfo.SourcesFrom
|
|
|
+
|
|
|
+ if authToken == `` {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "无鉴权"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ redisChartCode, err := utils.Rc.RedisString(authToken)
|
|
|
+ if err != nil {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if redisChartCode != uniqueCode {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
|
|
|
switch fromScene {
|
|
|
case 1, 2:
|
|
|
fromScene = 2
|
|
@@ -87,17 +140,6 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
|
|
|
|
|
|
|
|
|
- excelInfo, err := models.GetExcelInfoByUniqueCode(uniqueCode)
|
|
|
- if err != nil {
|
|
|
- if err.Error() == utils.ErrNoRow() {
|
|
|
- br.Msg = "该表格已被删除,请刷新页面"
|
|
|
- br.ErrMsg = "该表格已被删除,请刷新页面,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取表格表信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
var tableData excel.TableData
|
|
|
switch excelInfo.Source {
|
|
|
case utils.EXCEL_DEFAULT:
|
|
@@ -268,6 +310,8 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ resp.IsAuth = true
|
|
|
+
|
|
|
resp.TableInfo = tableData
|
|
|
resp.Source = excelInfo.Source
|
|
|
resp.ExcelType = excelInfo.ExcelType
|