sec_task_list.go 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. SelectionId: secTask.SelectionID,
  22. SecTaskId: secTask.TaskID,
  23. PlatformNickname: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
  24. FansCount: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
  25. HomePageCaptureUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""),
  26. HomePageUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""),
  27. RegionCode: regionCode,
  28. 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"), ""),
  29. CreateDate: conv.MustString(secTask.CreateDate, "")[:19],
  30. SelectDate: conv.MustString(secTask.SelectDate, "")[:19],
  31. DeliveryDate: conv.MustString(secTask.DeliveryDate, "")[:19],
  32. CompleteDate: conv.MustString(secTask.CompleteDate, "")[:19],
  33. IsPayReward: secTask.IsPayReward,
  34. IsPayPayment: secTask.IsPayPayment,
  35. SignedTime: conv.MustString(secTask.SignedTime, "0000"),
  36. SaleNum: secTask.SaleNum,
  37. FreeStrategyId: secTask.FreeStrategyId,
  38. TalentId: secTask.TalentID,
  39. ProductId: secTask.ProductId,
  40. CreateLogisticUserId: secTask.CreateLogisticUserId,
  41. CreateLogisticUserType: secTask.CreateLogisticUserType,
  42. CreateLogisticUserName: secTask.CreateLogisticUserId,
  43. ChooseTalentUserId: secTask.ChooseTalentUserId,
  44. ChooseTalentUserType: secTask.ChooseTalentUserType,
  45. ChooseTalentUserName: secTask.ChooseTalentUserId,
  46. SupplierType: 0,
  47. TalentOrigin: "公海",
  48. }
  49. }
  50. /*
  51. type T struct {
  52. DoorNum int `json:"door_num"`
  53. TalentId string `json:"talent_id"`
  54. AddressId int `json:"address_id"`
  55. DefaultTag int `json:"default_tag"`
  56. DetailAddr string `json:"detail_addr"`
  57. RegionCode int `json:"region_code"`
  58. PhoneNumber string `json:"phone_number"`
  59. ReceiverName string `json:"receiver_name"`
  60. }
  61. type T struct {
  62. Id string `json:"id"`
  63. Point int `json:"point"`
  64. Avatar string `json:"avatar"`
  65. Income int `json:"income"`
  66. TaskAll int `json:"task_all"`
  67. TaskEnd int `json:"task_end"`
  68. ApplyNum int `json:"apply_num"`
  69. UserType int `json:"user_type"`
  70. TaskApply int `json:"task_apply"`
  71. Withdrawed int `json:"withdrawed"`
  72. Canwithdraw int `json:"canwithdraw"`
  73. CreateDate string `json:"create_date"`
  74. Withdrawing int `json:"withdrawing"`
  75. InBlacklist int `json:"in_blacklist"`
  76. IsBindBank int `json:"is_bind_bank"`
  77. IsBindInfo int `json:"is_bind_info"`
  78. TaskExecute int `json:"task_execute"`
  79. IsBindAccount int `json:"is_bind_account"`
  80. LastLoginDate string `json:"last_login_date"`
  81. TalentNickname string `json:"talent_nickname"`
  82. IsBindLocation int `json:"is_bind_location"`
  83. TalentWxOpenid string `json:"talent_wx_openid"`
  84. TalentAgeBracket int `json:"talent_age_bracket"`
  85. TalentNationality int `json:"talent_nationality"`
  86. TalentWxNickname string `json:"talent_wx_nickname"`
  87. VisitStoreRegion int `json:"visit_store_region"`
  88. TalentPhoneNumber string `json:"talent_phone_number"`
  89. }
  90. */