123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package pack
- import (
- "youngee_b_api/model/http_model"
- "github.com/tidwall/gjson"
- "github.com/issue9/conv"
- )
- func MGormTaskLogisticsInfoListToHttpTaskLogisticsPreviewList(gormTaskLogisticsInfos []*http_model.TaskLogisticsInfo) []*http_model.TaskLogisticsPreview {
- var httpProjectPreviews []*http_model.TaskLogisticsPreview
- for _, gormTaskLogisticsInfo := range gormTaskLogisticsInfos {
- httpTaskLogisticsPreview := MGormTaskLogisticsInfoToHttpTaskLogisticsPreview(gormTaskLogisticsInfo)
- httpProjectPreviews = append(httpProjectPreviews, httpTaskLogisticsPreview)
- }
- return httpProjectPreviews
- }
- func MGormTaskLogisticsInfoToHttpTaskLogisticsPreview(TaskLogisticsInfo *http_model.TaskLogisticsInfo) *http_model.TaskLogisticsPreview {
- deliveryTime := conv.MustString(TaskLogisticsInfo.DeliveryTime)
- deliveryTime = deliveryTime[0:19]
- return &http_model.TaskLogisticsPreview{
- TaskID: conv.MustString(TaskLogisticsInfo.TaskID),
- PlatformNickname: conv.MustString(TaskLogisticsInfo.PlatformNickname),
- FansCount: conv.MustString(TaskLogisticsInfo.FansCount),
- RecruitStrategyID: conv.MustString(TaskLogisticsInfo.RecruitStrategyID),
- StrategyID: conv.MustString(TaskLogisticsInfo.StrategyID),
- DetailAddr: conv.MustString(TaskLogisticsInfo.DetailAddr),
- CompanyName: conv.MustString(TaskLogisticsInfo.CompanyName),
- LogisticsNumber: conv.MustString(TaskLogisticsInfo.LogisticsNumber),
- DeliveryTime: deliveryTime,
- ExplorestoreStarttime: TaskLogisticsInfo.ExplorestoreStarttime,
- ExplorestoreEndtime: TaskLogisticsInfo.ExplorestoreEndtime,
- ExplorestorePeriod: conv.MustString(TaskLogisticsInfo.ExplorestorePeriod),
- CouponCode: conv.MustString(TaskLogisticsInfo.CouponCode),
- }
- }
- func TaskLogisticsToTaskInfo(TaskLogisticss []*http_model.TaskLogistics) []*http_model.TaskLogisticsInfo {
- var TaskLogisticsInfos []*http_model.TaskLogisticsInfo
- for _, TaskLogistics := range TaskLogisticss {
- TaskLogistics := GetTalentInfoStruct(TaskLogistics)
- TaskLogisticsInfos = append(TaskLogisticsInfos, TaskLogistics)
- }
- return TaskLogisticsInfos
- }
- func GetTalentInfoStruct(TaskLogistics *http_model.TaskLogistics) *http_model.TaskLogisticsInfo {
- TalentPlatformInfoSnap := TaskLogistics.Talent.TalentPlatformInfoSnap
- TalentPostAddrSnap := TaskLogistics.Talent.TalentPostAddrSnap
- return &http_model.TaskLogisticsInfo{
- TaskID: TaskLogistics.Talent.TaskID,
- PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "PlatformInfo.platform_name")),
- FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count")),
- StrategyID: TaskLogistics.Talent.StrategyID,
- DetailAddr: conv.MustString(gjson.Get(TalentPostAddrSnap, "detail_addr")),
- CompanyName: TaskLogistics.Logistics.CompanyName,
- LogisticsNumber: TaskLogistics.Logistics.LogisticsNumber,
- DeliveryTime: conv.MustString(TaskLogistics.Logistics.DeliveryTime),
- ExplorestoreStarttime: TaskLogistics.Logistics.ExplorestoreStarttime,
- ExplorestoreEndtime: TaskLogistics.Logistics.ExplorestoreEndtime,
- ExplorestorePeriod: TaskLogistics.Logistics.ExplorestorePeriod,
- CouponCode: TaskLogistics.Logistics.CouponCodeInformation,
- }
- }
|