|
|
|
@ -1,14 +1,16 @@
|
|
|
|
|
package diamond_show
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
mysql2 "git.oa00.com/go/mysql"
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
|
|
"recook/internal/back"
|
|
|
|
|
"recook/internal/domain"
|
|
|
|
|
"recook/internal/v2/model/rotation"
|
|
|
|
|
"recook/tools"
|
|
|
|
|
"strconv"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
mysql2 "git.oa00.com/go/mysql"
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
"github.com/golangkit/formatime"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 返回的数据中多了个 活动链接
|
|
|
|
@ -24,7 +26,18 @@ type diamondResp struct {
|
|
|
|
|
BackgroundColor string `json:"background_color"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type diamondReq struct {
|
|
|
|
|
IsSale bool `json:"is_sale"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func QueryDiamondShow(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
var args diamondReq
|
|
|
|
|
err := tools.Params(&args, c)
|
|
|
|
|
if err != nil {
|
|
|
|
|
back.Fail(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
//var di []diamond_show.Information
|
|
|
|
|
//dbc.DB.Where("is_active=?", 1).Find(&di)
|
|
|
|
|
//var cdn = domain.GetCDN() + "/website/www/activity/t.html?id="
|
|
|
|
@ -44,7 +57,9 @@ func QueryDiamondShow(c *gin.Context) {
|
|
|
|
|
//}
|
|
|
|
|
//back.Suc(c, "", &list)
|
|
|
|
|
var p []rotation.RecookRotationModel
|
|
|
|
|
mysql2.Db.Table((&rotation.RecookRotationModel{}).TableName()).Where("is_active=?", 1).Where("start_time<=?", time.Now()).Where("end_time>=?", time.Now()).Order("sort_id").Find(&p)
|
|
|
|
|
mysql2.Db.Table((&rotation.RecookRotationModel{}).TableName()).
|
|
|
|
|
Where("is_active=? AND is_sale=?", 1, args.IsSale).
|
|
|
|
|
Where("start_time<=?", time.Now()).Where("end_time>=?", time.Now()).Order("sort_id").Find(&p)
|
|
|
|
|
|
|
|
|
|
var cdn = domain.GetCDN() + "/website/www/activity/t.html?id="
|
|
|
|
|
var list = make([]diamondResp, len(p))
|
|
|
|
|