vo.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. package myselfsrv
  2. import (
  3. "Cold_Logistic/internal/pkg/common/constant"
  4. "Cold_Logistic/internal/server/infra/models"
  5. validation "github.com/go-ozzo/ozzo-validation/v4"
  6. "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/core"
  7. )
  8. type UpdateMyselfInfoReqVO struct {
  9. Name string `json:"name"` // 真实名称
  10. Gender string `json:"gender"` // 性别
  11. Phone string `json:"phone"` // 电话
  12. CompanyName string `json:"companyName"` // 公司
  13. }
  14. func (r *UpdateMyselfInfoReqVO) Validate() error {
  15. return validation.ValidateStruct(r,
  16. validation.Field(&r.Name, validation.Required, validation.RuneLength(1, 10)),
  17. validation.Field(&r.Gender, validation.Required, validation.In("男", "女", "未知")),
  18. validation.Field(&r.Phone, validation.Required, validation.RuneLength(1, 11)),
  19. validation.Field(&r.CompanyName, validation.Required, validation.RuneLength(1, 30)),
  20. )
  21. }
  22. type RefreshTokenRespVo struct {
  23. TokenType string `json:"tokenType"`
  24. AccessToken string `json:"accessToken"`
  25. ExpiresIn int64 `json:"expiresIn"`
  26. }
  27. type AddressPageReqVO struct {
  28. Page core.Page `json:"page"`
  29. AddressType string `json:"addressType"` // 地址类型:sender-发货人 consignee-收货人
  30. }
  31. func (r *AddressPageReqVO) Validate() error {
  32. return validation.ValidateStruct(r,
  33. validation.Field(&r.AddressType, validation.Required,
  34. validation.In(constant.AddressTypeSender, constant.AddressTypeConsignee)),
  35. )
  36. }
  37. type AddressIdRespVO struct {
  38. AddressId int `json:"addressId"`
  39. }
  40. type AddAddressReqVO struct {
  41. AddressType string `json:"addressType"` //地址类型:
  42. Name string `json:"name"` //姓名
  43. Phone string `json:"phone"` //联系电话
  44. ProvinceId int `json:"provinceId"` //省Id
  45. CityId int `json:"cityId"` //市Id
  46. RegionId int `json:"regionId"` //区Id
  47. Address string `json:"address"` //详细地址
  48. IsDefault int `json:"isDefault"` //是否默认:1-是 2-否
  49. }
  50. func (r *AddAddressReqVO) Validate() error {
  51. return validation.ValidateStruct(r,
  52. validation.Field(&r.AddressType, validation.Required, validation.In(constant.AddressTypeSender, constant.AddressTypeConsignee)),
  53. validation.Field(&r.Name, validation.Required, validation.RuneLength(1, 10)),
  54. validation.Field(&r.Phone, validation.Required, validation.RuneLength(1, 11)),
  55. validation.Field(&r.Address, validation.Required, validation.RuneLength(1, 100)),
  56. validation.Field(&r.IsDefault, validation.In(constant.YES, constant.NO)),
  57. )
  58. }
  59. type UpdateAddressReqVO struct {
  60. AddressId int `json:"addressId"`
  61. Name string `json:"name"` //姓名
  62. Phone string `json:"phone"` //联系电话
  63. ProvinceId int `json:"provinceId"` //省Id
  64. CityId int `json:"cityId"` //市Id
  65. RegionId int `json:"regionId"` //区Id
  66. Address string `json:"address"` //详细地址
  67. IsDefault int `json:"isDefault"` //是否默认:1-是 2-否
  68. }
  69. func (r *UpdateAddressReqVO) Validate() error {
  70. return validation.ValidateStruct(r,
  71. validation.Field(&r.AddressId, validation.Required),
  72. validation.Field(&r.Name, validation.Required, validation.RuneLength(1, 10)),
  73. validation.Field(&r.Phone, validation.Required, validation.RuneLength(1, 11)),
  74. validation.Field(&r.Address, validation.Required, validation.RuneLength(1, 100)),
  75. validation.Field(&r.IsDefault, validation.In(constant.YES, constant.NO)),
  76. )
  77. }
  78. type DeleteAddressReqVO struct {
  79. AddressId int `json:"addressId"`
  80. }
  81. func (r *DeleteAddressReqVO) Validate() error {
  82. return validation.ValidateStruct(r, validation.Field(&r.AddressId, validation.Required))
  83. }
  84. type LogisticPageReqVO struct {
  85. Page core.Page `json:"page"`
  86. }
  87. type LogisticIdRespVO struct {
  88. LogisticId int `json:"logisticId"`
  89. }
  90. type AddLogisticReqVO struct {
  91. Name string `json:"name"` //名称
  92. IsDefault int `json:"isDefault"` //是否默认:1-是 - 2-否
  93. Pid int `json:"pid"` //冷链系统公司Id
  94. }
  95. func (r *AddLogisticReqVO) Validate() error {
  96. return validation.ValidateStruct(r,
  97. validation.Field(&r.Name, validation.Required, validation.RuneLength(1, 100)),
  98. validation.Field(&r.Pid, validation.Required),
  99. )
  100. }
  101. type DeleteLogisticReqVO struct {
  102. LogisticId string `json:"logisticId"`
  103. }
  104. func (r *DeleteLogisticReqVO) Validate() error {
  105. return validation.ValidateStruct(r, validation.Field(&r.LogisticId, validation.Required))
  106. }
  107. type OrderPageReqVO struct {
  108. Page core.Page `json:"page"`
  109. Search struct {
  110. OrderNo string `json:"orderNo"` // 订单号
  111. OrderStatus []int `json:"orderStatus"`
  112. SearchDateTime constant.SearchDateTimeType `json:"searchDateTime"`
  113. PlaceOrderStartTime models.MyTime `json:"placeOrderStartTime"`
  114. PlaceOrderEndTime models.MyTime `json:"placeOrderEndTime"`
  115. }
  116. }
  117. type OrderSubNoReqVO struct {
  118. OrderId int `json:"orderId"` // 订单
  119. }
  120. func (r *OrderSubNoReqVO) Validate() error {
  121. return validation.ValidateStruct(r, validation.Field(&r.OrderId, validation.Required))
  122. }
  123. type OrderSubNoRespVO struct {
  124. OrderSubNo string `json:"orderSubNo"`
  125. }