Browse Source

添加对最后更新新时间的处理及response的data改为string类型

pull/255/head
zhangxin 3 years ago
parent
commit
490dac11d0
2 changed files with 14 additions and 8 deletions
  1. +1
    -1
      models/base/response.go
  2. +13
    -7
      services/log/implments/ArtDemandHead.service.impl.go

+ 1
- 1
models/base/response.go View File

@ -3,5 +3,5 @@ package base
type Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data []byte `json:"data"`
Data string `json:"data"`
}

+ 13
- 7
services/log/implments/ArtDemandHead.service.impl.go View File

@ -13,7 +13,6 @@ import (
model "LAPP_GAAS_GFrame_BACKEND/models/log"
"LAPP_GAAS_GFrame_BACKEND/utils"
"LAPP_GAAS_GFrame_BACKEND/web/models"
"errors"
"fmt"
"github.com/360EntSecGroup-Skylar/excelize/v2"
json "github.com/json-iterator/go"
@ -836,11 +835,16 @@ func (impl *ArtDemandHeadServiceImplement) TransferDataToOrigin(getTimeUrl, post
log.Error("DataToOrigin unmarshal time body failed, error:"+err.Error(), "body: "+string(timeBody))
return
}
log.Debug("DataToOrigin get time response:" + string(timeBody))
if response.Code != http.StatusOK {
log.Info("DataToOrigin get time data failed, response:" + string(timeBody))
return
}
lastTime := string(response.Data)
lastTime := response.Data
if lastTime == "" {
lastTime = "2000-01-01 00:00:00"
}
_, err = time.Parse("2006-01-02 15:04:05", lastTime)
if err != nil {
log.Error("DataToOrigin parse time failed, error:"+err.Error(), "time string:"+lastTime)
@ -881,6 +885,7 @@ func (impl *ArtDemandHeadServiceImplement) TransferDataToOrigin(getTimeUrl, post
log.Error("DataToOrigin unmarshal post file response failed, error:"+err.Error(), "data:"+string(resp))
return
}
log.Debug("DataToOrigin post file response:" + string(resp))
if postResp.Code != http.StatusOK {
log.Error("DataToOrigin post file response code is not OK, data:" + string(resp))
return
@ -985,9 +990,10 @@ func (impl *ArtDemandHeadServiceImplement) SaveToExcel(headLi *[]model.ArtDemand
if err != nil {
return "", err
}
pathLi := strings.Split(filepath, "web\\")
if len(pathLi) != 2 {
return "", errors.New("导出失败,请重试")
}
return pathLi[1], nil
//pathLi := strings.Split(filepath, "web\\")
//if len(pathLi) != 2 {
// return "", errors.New("导出失败,请重试")
//}
//return pathLi[1], nil
return filepath, nil
}

Loading…
Cancel
Save