作者 tangxvhui

更新x-font-token处理

@@ -413,5 +413,20 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy @@ -413,5 +413,20 @@ func (srv StaffAssessServeice) ExportUserAssess(param *query.ListAssessContentCy
413 } 413 }
414 } 414 }
415 } 415 }
  416 + //TODO 调整样式
  417 + xlsxFile.MergeCell(sheetName, "A2", "A4")
  418 + xlsxFile.MergeCell(sheetName, "B2", "B4")
  419 + xlsxFile.MergeCell(sheetName, "B5", "B5")
  420 + //设置行高
  421 + for i := range tableRowSort {
  422 + xlsxFile.SetRowHeight(sheetName, i+6, 50)
  423 + }
  424 + //设置列宽
  425 + for i := range headerList {
  426 + colName, _ := excelize.ColumnNumberToName(i + 1)
  427 + if i == 0 {
  428 + xlsxFile.SetColWidth(sheetName, colName, colName, 70)
  429 + }
  430 + }
416 return xlsxFile, nil 431 return xlsxFile, nil
417 } 432 }
1 package middlewares 1 package middlewares
2 2
3 import ( 3 import (
  4 + "strings"
  5 +
4 "github.com/beego/beego/v2/server/web/context" 6 "github.com/beego/beego/v2/server/web/context"
5 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" 7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
@@ -8,7 +10,17 @@ import ( @@ -8,7 +10,17 @@ import (
8 10
9 func CheckFontToken() func(ctx *context.Context) { 11 func CheckFontToken() func(ctx *context.Context) {
10 return func(ctx *context.Context) { 12 return func(ctx *context.Context) {
11 - adminToken := ctx.Input.Header("x-font-token") 13 + // adminToken := ctx.Input.Header("x-font-token")
  14 + // Bearer authorization_token
  15 + adminToken := ctx.Input.Header("Authorization")
  16 + //以一个空格" ",做切分
  17 + strList := strings.Split(adminToken, " ")
  18 + if len(strList) > 1 {
  19 + adminToken = strList[1]
  20 + }
  21 + if len(strList) == 1 {
  22 + adminToken = strList[0]
  23 + }
12 userAuth, err := (&domain.UserAuth{}).ParseAccessToken(adminToken) 24 userAuth, err := (&domain.UserAuth{}).ParseAccessToken(adminToken)
13 if err != nil || userAuth.UserId <= 0 { 25 if err != nil || userAuth.UserId <= 0 {
14 forbidden(ctx) 26 forbidden(ctx)