piccontrller.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package controller
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "trading-go/model"
  5. "trading-go/response"
  6. )
  7. // Upload
  8. // @Tags 图片模块
  9. // @Summary 上传图片
  10. // @Accept multipart/form-data
  11. // @Produce application/json
  12. // @Param pic formData file true "图片"
  13. // @Success 200 {object} response.Response
  14. // @Router /pic/upload [post]
  15. func Upload(c *gin.Context) {
  16. _, _ = c.FormFile("file")
  17. response.Success(c.Writer, "success", model.Pic{})
  18. }
  19. // GetAllPic
  20. // @Tags 图片模块
  21. // @Summary 获取所有图片
  22. // @Produce application/json
  23. // @Success 200 {object} response.Response
  24. // @Router /pic [get]
  25. func GetAllPic(c *gin.Context) {
  26. var pics []model.Pic
  27. pics = append(pics, model.Pic{})
  28. pics = append(pics, model.Pic{})
  29. response.Success(c.Writer, "success", pics)
  30. }
  31. // DPic
  32. // @Tags 图片模块
  33. // @Summary 删除图片
  34. // @Produce application/json
  35. // @Param id path int64 true "图片id"
  36. // @Success 200 {object} response.Response
  37. // @Router /pic/delete/{id} [delete]
  38. func DPic(c *gin.Context) {
  39. response.Success(c.Writer, "success", nil)
  40. }