|
|
@@ -8,6 +8,7 @@ import (
|
|
|
"mtp2_if/mtpcache"
|
|
|
"mtp2_if/utils"
|
|
|
"net/http"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
@@ -147,13 +148,13 @@ type QueryQuoteDayRsp struct {
|
|
|
|
|
|
// QueryQuoteDay 获取商品盘面信息
|
|
|
// @Summary 获取商品盘面信息
|
|
|
-// @Produce json
|
|
|
+// @Produce json
|
|
|
// @Security ApiKeyAuth
|
|
|
// @Param goodsCodes query string false "此参数不填则查所有;商品代码列表,格式:CU2102,CU2103,AL2107"
|
|
|
// @Success 200 {object} QueryQuoteDayRsp
|
|
|
-// @Failure 500 {object} app.Response
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
// @Router /Quote/QueryQuoteDay [get]
|
|
|
-// @Tags 行情服务
|
|
|
+// @Tags 行情服务
|
|
|
func QueryQuoteDay(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
|
|
|
|
@@ -308,3 +309,39 @@ func QueryQuoteDay(c *gin.Context) {
|
|
|
logger.GetLogger().Debugln("QueryQuoteDay successed, rows: %v", len(rsp))
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, rsp)
|
|
|
}
|
|
|
+
|
|
|
+type GetTouristQuoteDayReq struct {
|
|
|
+ Goodscodes string `form:"goodsCodes" binding:"required"` // 商品代码列表,格式:1,2,3
|
|
|
+}
|
|
|
+
|
|
|
+// GetTouristQuoteDay 获取游客商品盘面信息
|
|
|
+// @Summary 获取游客商品盘面信息
|
|
|
+// @Produce json
|
|
|
+// @Param goodsCodes query string true "商品代码列表,格式:1,2,3"
|
|
|
+// @Success 200 {object} GetTouristQuoteDayReq
|
|
|
+// @Failure 500 {object} app.Response
|
|
|
+// @Router /Quote/GetTouristQuoteDay [get]
|
|
|
+// @Tags 行情服务
|
|
|
+func GetTouristQuoteDay(c *gin.Context) {
|
|
|
+ appG := app.Gin{C: c}
|
|
|
+
|
|
|
+ // 获取请求参数
|
|
|
+ var req GetTouristQuoteDayReq
|
|
|
+ if err := appG.C.ShouldBindQuery(&req); err != nil {
|
|
|
+ logger.GetLogger().Errorf("GetTouristQuoteDay failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ g := strings.Split(req.Goodscodes, ",")
|
|
|
+ rsp, err := models.GetRedisQuoteDays(g)
|
|
|
+ if err != nil {
|
|
|
+ logger.GetLogger().Errorf("GetTouristQuoteDay failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询成功
|
|
|
+ // logger.GetLogger().Debugln("GetTouristQuoteDay successed, rows: %v", len(rsp))
|
|
|
+ appG.Response(http.StatusOK, e.SUCCESS, rsp)
|
|
|
+}
|