sec_task_list.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. }
  41. }
  42. /*
  43. type T struct {
  44. DoorNum int `json:"door_num"`
  45. TalentId string `json:"talent_id"`
  46. AddressId int `json:"address_id"`
  47. DefaultTag int `json:"default_tag"`
  48. DetailAddr string `json:"detail_addr"`
  49. RegionCode int `json:"region_code"`
  50. PhoneNumber string `json:"phone_number"`
  51. ReceiverName string `json:"receiver_name"`
  52. }
  53. type T struct {
  54. Id string `json:"id"`
  55. Point int `json:"point"`
  56. Avatar string `json:"avatar"`
  57. Income int `json:"income"`
  58. TaskAll int `json:"task_all"`
  59. TaskEnd int `json:"task_end"`
  60. ApplyNum int `json:"apply_num"`
  61. UserType int `json:"user_type"`
  62. TaskApply int `json:"task_apply"`
  63. Withdrawed int `json:"withdrawed"`
  64. Canwithdraw int `json:"canwithdraw"`
  65. CreateDate string `json:"create_date"`
  66. Withdrawing int `json:"withdrawing"`
  67. InBlacklist int `json:"in_blacklist"`
  68. IsBindBank int `json:"is_bind_bank"`
  69. IsBindInfo int `json:"is_bind_info"`
  70. TaskExecute int `json:"task_execute"`
  71. IsBindAccount int `json:"is_bind_account"`
  72. LastLoginDate string `json:"last_login_date"`
  73. TalentNickname string `json:"talent_nickname"`
  74. IsBindLocation int `json:"is_bind_location"`
  75. TalentWxOpenid string `json:"talent_wx_openid"`
  76. TalentAgeBracket int `json:"talent_age_bracket"`
  77. TalentNationality int `json:"talent_nationality"`
  78. TalentWxNickname string `json:"talent_wx_nickname"`
  79. VisitStoreRegion int `json:"visit_store_region"`
  80. TalentPhoneNumber string `json:"talent_phone_number"`
  81. }
  82. */