123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- 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)[0:19]
- //signedTime := conv.MustString(TaskLogisticsInfo.SignedTime)[0:19]
- SignedTime := ""
- if TaskLogisticsInfo.SignedTime == "" {
- SignedTime = ""
- } else {
- SignedTime = TaskLogisticsInfo.SignedTime[:19]
- }
- return &http_model.TaskLogisticsPreview{
- TaskID: 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,
- SignedTime: SignedTime,
- 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
- SignedTime := ""
- if TaskLogistics.Logistics.SignedTime == nil {
- SignedTime = ""
- } else {
- SignedTime = conv.MustString(TaskLogistics.Logistics.SignedTime, "")
- }
- return &http_model.TaskLogisticsInfo{
- TaskID: TaskLogistics.Talent.TaskID,
- PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname")),
- FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count")),
- StrategyID: TaskLogistics.Talent.StrategyID,
- DetailAddr: TaskLogistics.Region + conv.MustString(gjson.Get(TalentPostAddrSnap, "detail_addr")),
- CompanyName: TaskLogistics.Logistics.CompanyName,
- LogisticsNumber: TaskLogistics.Logistics.LogisticsNumber,
- DeliveryTime: conv.MustString(TaskLogistics.Logistics.DeliveryTime),
- SignedTime: SignedTime,
- ExplorestoreStarttime: TaskLogistics.Logistics.ExplorestoreStarttime,
- ExplorestoreEndtime: TaskLogistics.Logistics.ExplorestoreEndtime,
- ExplorestorePeriod: TaskLogistics.Logistics.ExplorestorePeriod,
- CouponCode: TaskLogistics.Logistics.CouponCodeInformation,
- }
- }
- func MGormSpecialTaskLogisticsInfoListToHttpTaskLogisticsPreviewList(gormTaskLogisticsInfos []*http_model.SpecialTaskLogisticsInfo) []*http_model.SpecialTaskLogisticsPreview {
- var httpProjectPreviews []*http_model.SpecialTaskLogisticsPreview
- for _, gormTaskLogisticsInfo := range gormTaskLogisticsInfos {
- httpTaskLogisticsPreview := MGormSpecialTaskLogisticsInfoToHttpTaskLogisticsPreview(gormTaskLogisticsInfo)
- httpProjectPreviews = append(httpProjectPreviews, httpTaskLogisticsPreview)
- }
- return httpProjectPreviews
- }
- func MGormSpecialTaskLogisticsInfoToHttpTaskLogisticsPreview(TaskLogisticsInfo *http_model.SpecialTaskLogisticsInfo) *http_model.SpecialTaskLogisticsPreview {
- deliveryTime := conv.MustString(TaskLogisticsInfo.DeliveryTime, "")
- deliveryTime = deliveryTime[0:19]
- SignedTime := ""
- if TaskLogisticsInfo.SignedTime == "" {
- SignedTime = ""
- } else {
- SignedTime = TaskLogisticsInfo.SignedTime[:19]
- }
- return &http_model.SpecialTaskLogisticsPreview{
- TaskID: conv.MustString(TaskLogisticsInfo.TaskID, ""),
- PlatformNickname: conv.MustString(TaskLogisticsInfo.PlatformNickname, ""),
- FansCount: conv.MustString(TaskLogisticsInfo.FansCount, ""),
- 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, ""),
- SignedTime: SignedTime,
- }
- }
- func SpecialTaskLogisticsToTaskInfo(TaskLogisticss []*http_model.SpecialTaskLogistics) []*http_model.SpecialTaskLogisticsInfo {
- var TaskLogisticsInfos []*http_model.SpecialTaskLogisticsInfo
- for _, TaskLogistics := range TaskLogisticss {
- TaskLogistics := GetSpecialTalentInfoStruct(TaskLogistics)
- TaskLogisticsInfos = append(TaskLogisticsInfos, TaskLogistics)
- }
- return TaskLogisticsInfos
- }
- func GetSpecialTalentInfoStruct(TaskLogistics *http_model.SpecialTaskLogistics) *http_model.SpecialTaskLogisticsInfo {
- TalentPlatformInfoSnap := TaskLogistics.Talent.TalentPlatformInfoSnap
- TalentPostAddrSnap := TaskLogistics.Talent.TalentPostAddrSnap
- SignedTime := ""
- if TaskLogistics.Logistics.SignedTime == nil {
- SignedTime = ""
- } else {
- SignedTime = conv.MustString(TaskLogistics.Logistics.SignedTime, "")
- }
- return &http_model.SpecialTaskLogisticsInfo{
- TaskID: TaskLogistics.Talent.TaskID,
- PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
- FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
- DetailAddr: conv.MustString(gjson.Get(TalentPostAddrSnap, "detail_addr"), "") + TaskLogistics.Region,
- 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,
- SignedTime: SignedTime,
- }
- }
|