|
|
@@ -87,3 +87,43 @@ func QueryMarketsByLoginID(c *gin.Context) {
|
|
|
logger.GetLogger().Debugln("QueryMarketsByLoginID successed: %v", markets)
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, markets)
|
|
|
}
|
|
|
+
|
|
|
+// QueryGoodsesByLoginIDReq 获取登录账号有权限的商品信息请求参数
|
|
|
+type QueryGoodsesByLoginIDReq struct {
|
|
|
+ LoginID int `form:"loginID" binding:"required"`
|
|
|
+ MarketIDs string `form:"marketIDs"`
|
|
|
+}
|
|
|
+
|
|
|
+// QueryGoodsesByLoginID 获取登录账号有权限的商品信息
|
|
|
+// @Summary 获取登录账号有权限的商品信息
|
|
|
+// @Produce json
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @Param loginID query int true "登录账号"
|
|
|
+// @Param marketIDs query string false "市场ID列表,格式:1,2,3"
|
|
|
+// @Success 200 {object} models.Market
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Market/QueryGoodsesByLoginID [get]
|
|
|
+// @Tags 通用市场
|
|
|
+func QueryGoodsesByLoginID(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req QueryGoodsesByLoginIDReq
|
|
|
+ if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("QueryGoodsesByLoginID failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ goodses, err := models.GetGoodsByLoginID(req.LoginID, req.MarketIDs)
|
|
|
+ if err != nil {
|
|
|
+ // 查询失败
|
|
|
+ logger.GetLogger().Errorf("QueryGoodsesByLoginID failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询成功返回
|
|
|
+ logger.GetLogger().Debugln("QueryGoodsesByLoginID successed: %v", goodses)
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, goodses)
|
|
|
+}
|