fix: is_sale

master
howell 3 years ago
parent 5e827c335c
commit ac7786794b

@ -188,8 +188,8 @@ func (a ControllerActive) AddRecommend(c *gin.Context) {
status, _ := c.GetPostForm("status")
isSale, _ := c.GetPostForm("is_sale")
is_sale, _ := strconv.Atoi(isSale)
err = activebit.LogicActiveBit.AddCommends(result, status, is_sale == 1)
is_sale, _ := strconv.ParseBool(isSale)
err = activebit.LogicActiveBit.AddCommends(result, status, is_sale)
if err != nil {
back.Fail(c, err.Error())
return

@ -424,12 +424,12 @@ func (b logicActiveBit) AddCommends(result []string, status string, isSale bool)
var list []recommendedlist.RecookCommendList
for _, v := range gsList {
var info goods2.RecookGoodsInfoModel
mysql2.Db.Table(info.TableName()).Where("id=?", v).First(&info)
mysql2.Db.Table(info.TableName()).Where("id=? AND is_sale = ?", v, isSale).First(&info)
if info.Id == 0 {
continue
}
var on recommendedlist.RecookCommendList
mysql2.Db.Table(on.TableName()).Where("goods_id=?", v).First(&on)
mysql2.Db.Table(on.TableName()).Where("goods_id=? AND is_sale = ?", v, isSale).First(&on)
if on.Id > 0 {
continue
} else {

Loading…
Cancel
Save