package pack import ( "github.com/tidwall/gjson" "strconv" "youngee_b_api/model/gorm_model" "youngee_b_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"), "")) 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"), ""), 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, } } /* type T struct { DoorNum int `json:"door_num"` TalentId string `json:"talent_id"` AddressId int `json:"address_id"` DefaultTag int `json:"default_tag"` DetailAddr string `json:"detail_addr"` RegionCode int `json:"region_code"` PhoneNumber string `json:"phone_number"` ReceiverName string `json:"receiver_name"` } type T struct { Id string `json:"id"` Point int `json:"point"` Avatar string `json:"avatar"` Income int `json:"income"` TaskAll int `json:"task_all"` TaskEnd int `json:"task_end"` ApplyNum int `json:"apply_num"` UserType int `json:"user_type"` TaskApply int `json:"task_apply"` Withdrawed int `json:"withdrawed"` Canwithdraw int `json:"canwithdraw"` CreateDate string `json:"create_date"` Withdrawing int `json:"withdrawing"` InBlacklist int `json:"in_blacklist"` IsBindBank int `json:"is_bind_bank"` IsBindInfo int `json:"is_bind_info"` TaskExecute int `json:"task_execute"` IsBindAccount int `json:"is_bind_account"` LastLoginDate string `json:"last_login_date"` TalentNickname string `json:"talent_nickname"` IsBindLocation int `json:"is_bind_location"` TalentWxOpenid string `json:"talent_wx_openid"` TalentAgeBracket int `json:"talent_age_bracket"` TalentNationality int `json:"talent_nationality"` TalentWxNickname string `json:"talent_wx_nickname"` VisitStoreRegion int `json:"visit_store_region"` TalentPhoneNumber string `json:"talent_phone_number"` } */