sec_task_list.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package pack
  2. import (
  3. "github.com/tidwall/gjson"
  4. "strconv"
  5. "youngee_b_api/model/gorm_model"
  6. "youngee_b_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. SignedTime: conv.MustString(secTask.SignedTime, "0000"),
  35. SaleNum: secTask.SaleNum,
  36. FreeStrategyId: secTask.FreeStrategyId,
  37. TalentId: secTask.TalentID,
  38. ProductId: secTask.ProductId,
  39. }
  40. }