callback.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // consts for callback
  6. const (
  7. GroupSetResult = "group.SetResult"
  8. BatchGroupSetResult = "group.BatchSetResult"
  9. ChallSetResult = "chall.SetResult"
  10. BatchChallSetResult = "chall.BatchSetResult"
  11. GroupSetState = "group.SetState"
  12. GroupSetPublicReferee = "group.SetPublicReferee"
  13. CallbackDisable = 0
  14. CallbackEnable = 1
  15. )
  16. // Slice is the slice model for callback
  17. type CallbackSlice []*Callback
  18. // Callback is the workflow callback model
  19. type Callback struct {
  20. CbID int32 `json:"cbid" gorm:"column:id"`
  21. URL string `json:"url" gorm:"column:url"`
  22. Business int8 `json:"business" gorm:"column:business"`
  23. IsSobot bool `json:"is_sobot" gorm:"column:is_sobot"`
  24. State int8 `json:"state" gorm:"column:state"`
  25. ExternalAPI string `json:"external_api" gorm:"column:external_api"`
  26. SourceAPI string `json:"source_api" gorm:"column:source_api"`
  27. CTime xtime.Time `json:"ctime" gorm:"column:ctime"`
  28. MTime xtime.Time `json:"mtime" gorm:"column:mtime"`
  29. }
  30. // Actor for callback payload
  31. type Actor struct {
  32. AdminID int64 `json:"admin_id"`
  33. AdminName string `json:"admin_name"`
  34. }
  35. // Payload is the payload model for callback
  36. type Payload struct {
  37. Bid int `json:"bid"`
  38. Verb string `json:"verb"`
  39. Actor Actor `json:"actor"`
  40. CTime xtime.Time `json:"ctime"`
  41. Object interface{} `json:"object"` //处理请求参数
  42. Target interface{} `json:"target"` //被修改的工单或工单详情
  43. Targets []interface{} `json:"targets"` //所有被修改的工单或工单详情
  44. Influence interface{} `json:"influence"` //业务自定义 Deprecated
  45. Extra interface{} `json:"extra"` //业务自定义
  46. }
  47. // TableName is used to identify table name for gorm
  48. func (Callback) TableName() string {
  49. return "workflow_callback"
  50. }