1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package http
- import (
- "time"
- )
- type MessageResp struct {
- ID int `json:"id"`
- }
- type MessageReq struct {
- MsgTypeID int `json:"msg_type_id"`
- ServiceID int `form:"service_id" json:"service_id" gorm:"service_id"`
- SysName string `form:"sys_name" json:"sys_name" gorm:"sys_name"`
- PastureID int `form:"pasture_id" json:"pasture_id" gorm:"pasture_id"`
- Miniprogram Miniprogram `json:"miniprogram"`
- Target []string `json:"target"`
- Keys []string `json:"keys"`
- Content []Tag `json:"content"`
- }
- type MessageTypeResp struct {
- RowsAffected int `json:"rows_affected"`
- Method string `json:"method"`
- }
- type Miniprogram struct {
- AppID string `json:"appid"`
- PagePath string `json:"pagepath"`
- }
- type Tag struct {
- Value string `json:"value"`
- Color string `json:"color"`
- }
- type MessageTypeReq struct {
- ID int `form:"id" json:"id" gorm:"column:id; primary_key;AUTO_INCREMENT" `
- ServiceID int `form:"service_id" json:"service_id" gorm:"service_id"`
- SysName string `form:"sys_name" json:"sys_name" gorm:"sys_name"`
- PastureID int `form:"pasture_id" json:"pasture_id" gorm:"pasture_id"`
- TypeName string `form:"type_name" json:"type_name" gorm:"type_name"`
- RemindType int `form:"remind_type" json:"remind_type" gorm:"remind_type"`
- DateType int `form:"date_type" json:"date_type" gorm:"date_type"`
- CycleType int `form:"cycle_type" json:"cycle_type" gorm:"cycle_type"`
- DelayTime int `form:"delay_time" json:"delay_time" gorm:"delay_time"`
- PushDate int `form:"push_date" json:"push_date" gorm:"push_date"`
- PushTime string `form:"push_time" json:"push_time" gorm:"push_time"`
- IntervalTime int `form:"interval_time" json:"interval_time" gorm:"interval_time"`
- PushLimit int `form:"push_limit" json:"push_limit" gorm:"push_limit"`
- TemplateID string `form:"template_id" json:"template_id" gorm:"template_id"`
- Status int `form:"status" json:"status" gorm:"status"`
- CreatedAt time.Time `form:"created_at" json:"created_at" gorm:"created_at"`
- UpdatedAt time.Time `form:"updated_at" json:"updated_at" gorm:"updated_at"`
- }
- func (m MessageTypeReq) Validate() (err error) {
- // if m.SysName == "" || m.PastureID == 0 || m.ServiceID == 0 {
- // err = errors.New("sys_name or pasture_id or service_id is empty")
- // }
- return
- }
- func (p MessageReq) Validate() error {
- return nil
- }
|