sec_task_list.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package pack
  2. import (
  3. "github.com/tidwall/gjson"
  4. "strconv"
  5. "youngee_m_api/model/gorm_model"
  6. "youngee_m_api/model/http_model"
  7. "github.com/caixw/lib.go/conv"
  8. )
  9. func GormSecTaskListToHttpSecTaskList(secTaskList []*gorm_model.YounggeeSecTaskInfo) []*http_model.SecTaskInfo {
  10. var resTaskTaskList []*http_model.SecTaskInfo
  11. for _, secTask := range secTaskList {
  12. secTaskH := GormSecTaskToHttpSecTask(secTask)
  13. resTaskTaskList = append(resTaskTaskList, secTaskH)
  14. }
  15. return resTaskTaskList
  16. }
  17. func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_model.SecTaskInfo {
  18. TalentPlatformInfoSnap := secTask.TalentPlatformInfoSnap
  19. regionCode, _ := strconv.Atoi(conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "region_code"), ""))
  20. return &http_model.SecTaskInfo{
  21. SecTaskId: secTask.TaskID,
  22. PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
  23. FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
  24. HomePageCaptureUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""),
  25. HomePageUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""),
  26. RegionCode: regionCode,
  27. 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"), ""),
  28. CreateDate: conv.MustString(secTask.CreateDate, ""),
  29. SelectDate: conv.MustString(secTask.SelectDate, ""),
  30. DeliveryDate: conv.MustString(secTask.DeliveryDate, ""),
  31. CompleteDate: conv.MustString(secTask.CompleteDate, ""),
  32. IsPayReward: secTask.IsPayReward,
  33. IsPayPayment: secTask.IsPayPayment,
  34. }
  35. }