sec_task_list.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. }
  41. /*
  42. type T struct {
  43. DoorNum int `json:"door_num"`
  44. TalentId string `json:"talent_id"`
  45. AddressId int `json:"address_id"`
  46. DefaultTag int `json:"default_tag"`
  47. DetailAddr string `json:"detail_addr"`
  48. RegionCode int `json:"region_code"`
  49. PhoneNumber string `json:"phone_number"`
  50. ReceiverName string `json:"receiver_name"`
  51. }
  52. */