package pack import ( "fmt" "github.com/tidwall/gjson" "strconv" "youngee_m_api/model/gorm_model" "youngee_m_api/model/http_model" "github.com/caixw/lib.go/conv" ) func GormSecTaskListToHttpSecTaskList(secTaskList []*gorm_model.YounggeeSecTaskInfo) []*http_model.SecTaskInfo { var resTaskTaskList []*http_model.SecTaskInfo for _, secTask := range secTaskList { secTaskH := GormSecTaskToHttpSecTask(secTask) resTaskTaskList = append(resTaskTaskList, secTaskH) } return resTaskTaskList } func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_model.SecTaskInfo { TalentPlatformInfoSnap := secTask.TalentPlatformInfoSnap regionCode, _ := strconv.Atoi(conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "region_code"), "")) fmt.Println("粉丝数: ", strconv.Itoa(secTask.FansNum)) return &http_model.SecTaskInfo{ SelectionId: secTask.SelectionID, SecTaskId: secTask.TaskID, PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""), FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""), HomePageCaptureUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""), HomePageUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""), RegionCode: regionCode, DetailAddr: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "detail_addr"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "receiver_name"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "phone_number"), ""), TalentPhone: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "phone_number"), ""), TalentAddress: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "detail_addr"), ""), TalentName: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "receiver_name"), ""), CreateDate: conv.MustString(secTask.CreateDate, "")[:19], SelectDate: conv.MustString(secTask.SelectDate, "")[:19], DeliveryDate: conv.MustString(secTask.DeliveryDate, "")[:19], CompleteDate: conv.MustString(secTask.CompleteDate, "")[:19], IsPayReward: secTask.IsPayReward, IsPayPayment: secTask.IsPayPayment, SignedTime: conv.MustString(secTask.SignedTime, "0000"), SaleNum: secTask.SaleNum, FreeStrategyId: secTask.FreeStrategyId, TalentId: secTask.TalentID, ProductId: secTask.ProductId, CreateLogisticUserId: secTask.CreateLogisticUserId, CreateLogisticUserType: secTask.CreateLogisticUserType, CreateLogisticUserName: secTask.CreateLogisticUserId, ChooseTalentUserId: secTask.ChooseTalentUserId, ChooseTalentUserType: secTask.ChooseTalentUserType, ChooseTalentUserName: secTask.ChooseTalentUserId, SupplierType: 0, TalentOrigin: "公海", } }