goods.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * @Author: deng.yinping deng.yinping@muchinfo.cn
  3. * @Date: 2024-02-22 11:11:03
  4. * @LastEditors: deng.yinping deng.yinping@muchinfo.cn
  5. * @LastEditTime: 2024-05-10 16:41:13
  6. * @FilePath: \MTP20_IF\controllers\sbyj\goods.go
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. package sbyj
  10. import (
  11. "mtp2_if/global/app"
  12. "mtp2_if/global/e"
  13. "mtp2_if/logger"
  14. "mtp2_if/models"
  15. "net/http"
  16. "github.com/gin-gonic/gin"
  17. )
  18. // GetTouristGoods 获取水贝亿爵游客商品列表
  19. // @Summary 获取水贝亿爵游客商品列表
  20. // @Produce json
  21. // @Success 200 {array} models.TouristGoods
  22. // @Failure 500 {object} app.Response
  23. // @Router /sbyj/GetTouristGoods [get]
  24. // @Tags 水贝亿爵
  25. func GetTouristGoods(c *gin.Context) {
  26. appG := app.Gin{C: c}
  27. // 获取数据
  28. goodses, err := models.GetTouristGoods([]int{52, 97, 99})
  29. if err != nil {
  30. // 查询失败
  31. logger.GetLogger().Errorf("GetTouristGoods failed: %s", err.Error())
  32. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  33. return
  34. }
  35. // 查询成功返回
  36. appG.Response(http.StatusOK, e.SUCCESS, goodses)
  37. }
  38. type GetMyOrdersReq struct {
  39. GoodsId int `form:"goodsId"` // 商品ID
  40. UserId int `form:"userId" binding:"required"` // 用户ID
  41. }