You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.5 KiB

  1. package article
  2. import (
  3. "github.com/gogf/gf/v2/frame/g"
  4. "github.com/gogf/gf/v2/os/gtime"
  5. )
  6. type ArticleReq struct {
  7. g.Meta `path:"/addArticle" method:"post" tags:"添加文章"`
  8. //Article Article `json:"article"`
  9. //VotePoll VotePoll `json:"votePoll"`
  10. //VoteOption VoteOption `json:"voteOption"`
  11. //Article表字段
  12. UserId int64 `p:"userId" v:"required" dc:"用户 ID"`
  13. ArticleTitle string `p:"articleTitle" v:"required#标题不能为空" dc:"文章标题"`
  14. ArticleContent string `p:"articleContent" v:"required#内容不能为空" dc:"文章内容"`
  15. VoteStatus int `p:"voteStatus" v:"required" dc:"是否投票"`
  16. //VotePoll表字段
  17. ArticleId int64 `p:"articleId" dc:"文章ID"`
  18. VoteTitle string `p:"voteTitle" v:"required#投票标题不能为空|len:max=24#投票标题不能超过24个字" dc:"投票标题"`
  19. MultiOption int `p:"multiOption" v:"required" dc:"是否多选"`
  20. DeadlineTime *gtime.Time `p:"deadlineTime" v:"required" dc:"截止时间"`
  21. Status int `p:"status" v:"required" dc:"投票活动状态" d:"1"`
  22. //VoteOption表字段
  23. VoteId int64 `p:"voteId" dc:"投票活动ID"`
  24. OptionList []OptionList `p:"optionList" v:"required#选项不能为空" dc:"投票选项与第几个选项"`
  25. }
  26. type OptionList struct {
  27. OptionIndex int `json:"optionIndex" v:"required" dc:"选项序号"`
  28. OptionContent string `json:"optionContent" v:"required#选项不能为空" dc:"投票选项"`
  29. }
  30. type ArticleRes struct {
  31. g.Meta `mime:"application/json"`
  32. }
  33. //type Article struct {
  34. // g.Meta `mime:"application/json"`
  35. // UserId int64 `p:"userId" v:"required" dc:"用户 ID"`
  36. // ArticleTitle string `p:"articleTitle" v:"required#标题不能为空" dc:"文章标题"`
  37. // ArticleContent string `p:"articleContent" v:"required#内容不能为空" dc:"文章内容"`
  38. // VoteStatus int `p:"voteStatus" v:"required" dc:"是否投票"`
  39. //}
  40. //
  41. //type VotePoll struct {
  42. // g.Meta `mime:"application/json"`
  43. // ArticleId int64 `p:"articleId" v:"required" dc:"文章ID"`
  44. // VoteTitle string `p:"voteTitle" v:"required#投票标题不能为空|len:max=24#投票标题不能超过24个字" dc:"投票标题"`
  45. // MultiOption int `p:"multiOption" v:"required" dc:"是否多选"`
  46. // DeadlineTime *gtime.Time `p:"deadlineTime" v:"required" dc:"截止时间"`
  47. //}
  48. //
  49. //type VoteOption struct {
  50. // g.Meta `mime:"application/json"`
  51. // OptionList []string `p:"optionList" v:"required#选项不能为空" dc:"投票选项"`
  52. //}