sec_task_list.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package pack
  2. import (
  3. "fmt"
  4. "github.com/tidwall/gjson"
  5. "strconv"
  6. "youngee_m_api/model/gorm_model"
  7. "youngee_m_api/model/http_model"
  8. "github.com/caixw/lib.go/conv"
  9. )
  10. func GormSecTaskListToHttpSecTaskList(secTaskList []*gorm_model.YounggeeSecTaskInfo) []*http_model.SecTaskInfo {
  11. var resTaskTaskList []*http_model.SecTaskInfo
  12. for _, secTask := range secTaskList {
  13. secTaskH := GormSecTaskToHttpSecTask(secTask)
  14. resTaskTaskList = append(resTaskTaskList, secTaskH)
  15. }
  16. return resTaskTaskList
  17. }
  18. func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_model.SecTaskInfo {
  19. TalentPlatformInfoSnap := secTask.TalentPlatformInfoSnap
  20. regionCode, _ := strconv.Atoi(conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "region_code"), ""))
  21. fmt.Println("粉丝数: ", strconv.Itoa(secTask.FansNum))
  22. return &http_model.SecTaskInfo{
  23. SelectionId: secTask.SelectionID,
  24. SecTaskId: secTask.TaskID,
  25. PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
  26. FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
  27. HomePageCaptureUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""),
  28. HomePageUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""),
  29. RegionCode: regionCode,
  30. 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"), ""),
  31. TalentPhone: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "phone_number"), ""),
  32. TalentAddress: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "detail_addr"), ""),
  33. TalentName: conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "receiver_name"), ""),
  34. CreateDate: conv.MustString(secTask.CreateDate, "")[:19],
  35. SelectDate: conv.MustString(secTask.SelectDate, "")[:19],
  36. DeliveryDate: conv.MustString(secTask.DeliveryDate, "")[:19],
  37. CompleteDate: conv.MustString(secTask.CompleteDate, "")[:19],
  38. IsPayReward: secTask.IsPayReward,
  39. IsPayPayment: secTask.IsPayPayment,
  40. SignedTime: conv.MustString(secTask.SignedTime, "0000"),
  41. SaleNum: secTask.SaleNum,
  42. FreeStrategyId: secTask.FreeStrategyId,
  43. TalentId: secTask.TalentID,
  44. ProductId: secTask.ProductId,
  45. CreateLogisticUserId: secTask.CreateLogisticUserId,
  46. CreateLogisticUserType: secTask.CreateLogisticUserType,
  47. CreateLogisticUserName: secTask.CreateLogisticUserId,
  48. ChooseTalentUserId: secTask.ChooseTalentUserId,
  49. ChooseTalentUserType: secTask.ChooseTalentUserType,
  50. ChooseTalentUserName: secTask.ChooseTalentUserId,
  51. SupplierType: 0,
  52. TalentOrigin: "公海",
  53. }
  54. }