package response import ( "eta/eta_mini_crm_ht/services" "github.com/rdlucklib/rdluck_tools/paging" "time" ) type BaseFromBusinessIndex struct { IndexCode string `description:"指标编码"` IndexName string `description:"指标名称"` Unit string `description:"单位"` Frequency string `description:"频度"` SourceName string `description:"数据来源名称"` StartDate string `description:"指标开始时间"` EndDate string `description:"指标最新时间"` CreateTime string `description:"入库时间"` } type BaseFromBusinessIndexResponse struct { Paging *paging.PagingItem List []*BaseFromBusinessIndex LastUpdateTime string } func (idr *BaseFromBusinessIndexResponse) ToCrmRequest(resp *services.BaseFromBusinessIndexResp) (req BaseFromBusinessIndexResponse) { var crmList []*BaseFromBusinessIndex for _, item := range resp.List { crmList = append(crmList, &BaseFromBusinessIndex{ IndexCode: item.IndexCode, IndexName: item.IndexName, Unit: item.Unit, Frequency: item.Frequency, SourceName: item.SourceName, StartDate: item.StartDate.Format(time.DateOnly), EndDate: item.EndDate.Format(time.DateOnly), CreateTime: item.CreateTime.Format(time.DateTime), }) } return BaseFromBusinessIndexResponse{ Paging: resp.Paging, List: crmList, LastUpdateTime: resp.LastUpdateTime, } }