message.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package http
  2. import (
  3. "time"
  4. )
  5. type MessageResp struct {
  6. ID int `json:"id"`
  7. }
  8. type MessageReq struct {
  9. MsgTypeID int `json:"msg_type_id"`
  10. ServiceID int `form:"service_id" json:"service_id" gorm:"service_id"`
  11. SysName string `form:"sys_name" json:"sys_name" gorm:"sys_name"`
  12. PastureID int `form:"pasture_id" json:"pasture_id" gorm:"pasture_id"`
  13. Miniprogram Miniprogram `json:"miniprogram"`
  14. Target []string `json:"target"`
  15. Keys []string `json:"keys"`
  16. Content []Tag `json:"content"`
  17. }
  18. type MessageTypeResp struct {
  19. RowsAffected int `json:"rows_affected"`
  20. Method string `json:"method"`
  21. }
  22. type Miniprogram struct {
  23. AppID string `json:"appid"`
  24. PagePath string `json:"pagepath"`
  25. }
  26. type Tag struct {
  27. Value string `json:"value"`
  28. Color string `json:"color"`
  29. }
  30. type MessageTypeReq struct {
  31. ID int `form:"id" json:"id" gorm:"column:id; primary_key;AUTO_INCREMENT" `
  32. ServiceID int `form:"service_id" json:"service_id" gorm:"service_id"`
  33. SysName string `form:"sys_name" json:"sys_name" gorm:"sys_name"`
  34. PastureID int `form:"pasture_id" json:"pasture_id" gorm:"pasture_id"`
  35. TypeName string `form:"type_name" json:"type_name" gorm:"type_name"`
  36. RemindType int `form:"remind_type" json:"remind_type" gorm:"remind_type"`
  37. DateType int `form:"date_type" json:"date_type" gorm:"date_type"`
  38. CycleType int `form:"cycle_type" json:"cycle_type" gorm:"cycle_type"`
  39. DelayTime int `form:"delay_time" json:"delay_time" gorm:"delay_time"`
  40. PushDate int `form:"push_date" json:"push_date" gorm:"push_date"`
  41. PushTime string `form:"push_time" json:"push_time" gorm:"push_time"`
  42. IntervalTime int `form:"interval_time" json:"interval_time" gorm:"interval_time"`
  43. PushLimit int `form:"push_limit" json:"push_limit" gorm:"push_limit"`
  44. TemplateID string `form:"template_id" json:"template_id" gorm:"template_id"`
  45. Status int `form:"status" json:"status" gorm:"status"`
  46. CreatedAt time.Time `form:"created_at" json:"created_at" gorm:"created_at"`
  47. UpdatedAt time.Time `form:"updated_at" json:"updated_at" gorm:"updated_at"`
  48. }
  49. func (m MessageTypeReq) Validate() (err error) {
  50. // if m.SysName == "" || m.PastureID == 0 || m.ServiceID == 0 {
  51. // err = errors.New("sys_name or pasture_id or service_id is empty")
  52. // }
  53. return
  54. }
  55. func (p MessageReq) Validate() error {
  56. return nil
  57. }