|
|
@@ -6,6 +6,8 @@ import (
|
|
|
"mtp2_if/logger"
|
|
|
"mtp2_if/models"
|
|
|
"net/http"
|
|
|
+ "strconv"
|
|
|
+ "time"
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
)
|
|
|
@@ -105,11 +107,31 @@ type QueryImageConfigsReq struct {
|
|
|
ImageType int `form:"imageType"`
|
|
|
}
|
|
|
|
|
|
+// QueryImageConfigsRsp 查询轮播图配置信息返回模型
|
|
|
+type QueryImageConfigsRsp struct {
|
|
|
+ Configid int64 `json:"configid" xorm:"'CONFIGID'" binding:"required"` // 配置ID(SEQ_SZDZ2_IMAGECONFIG)
|
|
|
+ Imagetype int32 `json:"imagetype" xorm:"'IMAGETYPE'"` // 类型 - 1:首页轮播(移动) 2:我的(移动)
|
|
|
+ Title string `json:"title" xorm:"'TITLE'"` // 标题
|
|
|
+ Imagepath string `json:"imagepath" xorm:"'IMAGEPATH'"` // 图片
|
|
|
+ URL string `json:"url" xorm:"'URL'"` // 链接(地址或商品ID)
|
|
|
+ Sort int64 `json:"sort" xorm:"'SORT'"` // 排序
|
|
|
+ Isshow int32 `json:"isshow" xorm:"'ISSHOW'"` // 是否展示 - 0:不展示 1:展示
|
|
|
+ Createdate time.Time `json:"createdate" xorm:"'CREATEDATE'"` // 创建时间
|
|
|
+ Creatorid int64 `json:"creatorid" xorm:"'CREATORID'"` // 创建人
|
|
|
+ Updatedate time.Time `json:"updatedate" xorm:"'UPDATEDATE'"` // 修改时间
|
|
|
+ Modifierid int64 `json:"modifierid" xorm:"'MODIFIERID'"` // 操作人
|
|
|
+ Areauserid int64 `json:"areauserid" xorm:"'AREAUSERID'"` // 所属机构ID
|
|
|
+ Urltype int32 `json:"urltype" xorm:"'URLTYPE'"` // 链接类型 - 1:直接地址 2:商品ID
|
|
|
+
|
|
|
+ MarketID int `json:"marketid"` // 市场ID
|
|
|
+ TradeMode int `json:"trademode"` // 交易模式
|
|
|
+}
|
|
|
+
|
|
|
// QueryImageConfigs 查询轮播图配置信息
|
|
|
// @Summary 查询轮播图配置信息
|
|
|
// @Produce json
|
|
|
// @Param imageType query int false "类型 - 1:App首页轮播 2:我的"
|
|
|
-// @Success 200 {object} models.Szdz2imageconfig
|
|
|
+// @Success 200 {object} QueryImageConfigsRsp
|
|
|
// @Failure 500 {object} app.Response
|
|
|
// @Router /Common/QueryImageConfigs [get]
|
|
|
// @Tags 通用服务
|
|
|
@@ -132,6 +154,34 @@ func QueryImageConfigs(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ for _, v := range imageConfigs {
|
|
|
+ item := QueryImageConfigsRsp{
|
|
|
+ Configid: v.Configid,
|
|
|
+ Imagetype: v.Imagetype,
|
|
|
+ Title: v.Title,
|
|
|
+ Imagepath: v.Imagepath,
|
|
|
+ URL: v.URL,
|
|
|
+ Sort: v.Sort,
|
|
|
+ Isshow: v.Isshow,
|
|
|
+ Createdate: v.Createdate,
|
|
|
+ Creatorid: v.Creatorid,
|
|
|
+ Updatedate: v.Updatedate,
|
|
|
+ Modifierid: v.Modifierid,
|
|
|
+ Areauserid: v.Areauserid,
|
|
|
+ Urltype: v.Urltype,
|
|
|
+ }
|
|
|
+
|
|
|
+ if item.Urltype == 2 {
|
|
|
+ if i, err := strconv.Atoi(v.URL); err == nil {
|
|
|
+ if market, _ := models.GetMarketByGoodsID(i); market != nil {
|
|
|
+ item.MarketID = int(market.Marketid)
|
|
|
+ item.TradeMode = int(market.Trademode)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 查询成功
|
|
|
logger.GetLogger().Debugln("QueryImageConfigs successed: %v", imageConfigs)
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, imageConfigs)
|