sec_task_list.go 4.5 KB

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