|
@@ -126,8 +126,7 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
|
|
|
} else {
|
|
|
if db.Mysql.Count(db.DbConf.Bdcollection, queryMap) == 0 {
|
|
|
if int(collCount) >= maxCount {
|
|
|
- ok = false
|
|
|
- msg = "收藏已达上限"
|
|
|
+ ok, msg = false, qu.If(isPay, "付费用户收藏已达上限", "免费用户收藏已达上限").(string)
|
|
|
log.Printf("userid :%s,收藏失败 id : %s ,已收藏数量:%v ,上限数量:%v", userid, util.DecodeId(bd.Bid), collCount, maxCount)
|
|
|
} else {
|
|
|
now := time.Now().Unix()
|
|
@@ -259,7 +258,7 @@ func LabelAction(labInfo *LabelInfo, userid string) map[string]interface{} {
|
|
|
}
|
|
|
if db.Mysql.Count(db.DbConf.Bdcollection, queryMap) == 0 {
|
|
|
if int(collCount) >= maxCount {
|
|
|
- ok, msg = false, "收藏已达上限"
|
|
|
+ ok, msg = false, qu.If(isPay, "付费用户收藏已达上限", "免费用户收藏已达上限").(string)
|
|
|
log.Printf("userid :%s,收藏失败 id : %s ,已收藏数量:%v ,上限数量:%v", userid, util.DecodeId(bd.Bid), collCount, maxCount)
|
|
|
} else {
|
|
|
inserMap := map[string]interface{}{
|
|
@@ -299,14 +298,22 @@ func LabelAction(labInfo *LabelInfo, userid string) map[string]interface{} {
|
|
|
}
|
|
|
|
|
|
//收藏列表
|
|
|
+/*
|
|
|
+ SelectTime:
|
|
|
+ 最近7天:lately-7
|
|
|
+ 最近30天:lately-30
|
|
|
+ 去年:lastyear
|
|
|
+ 开始时间-结束时间:1622476800-1623859200
|
|
|
+*/
|
|
|
type CollList struct {
|
|
|
- Pagenum int `json:"pagenum"` //页数
|
|
|
- Label string `json:"label"` //标签 用,分隔开
|
|
|
- Colltime_start int64 `json:"colltime_start"` //收藏开始时间
|
|
|
- Colltime_end int64 `json:"colltime_end"` //收藏结束时间
|
|
|
- Buyerclass string `json:"buyerclass"` //采购单位 用,分隔开
|
|
|
- BuyerPhone int `json:"buyerPhone"` //是否需要采购单位联系方式 1:需要 -1:不需要 0:未选中
|
|
|
- WinnerPhone int `json:"winnerPhone"` //是否需要中标单位联系方式 1:需要 -1:不需要 0:未选中
|
|
|
+ Pagenum int `json:"pagenum"` //页数
|
|
|
+ Label string `json:"label"` //标签 用,分隔开
|
|
|
+ // Colltime_start int64 `json:"colltime_start"` //收藏开始时间
|
|
|
+ // Colltime_end int64 `json:"colltime_end"` //收藏结束时间
|
|
|
+ SelectTime string `json:"selectTime"` //收藏时间
|
|
|
+ Buyerclass string `json:"buyerclass"` //采购单位 用,分隔开
|
|
|
+ BuyerPhone int `json:"buyerPhone"` //是否需要采购单位联系方式 1:需要 -1:不需要 0:未选中
|
|
|
+ WinnerPhone int `json:"winnerPhone"` //是否需要中标单位联系方式 1:需要 -1:不需要 0:未选中
|
|
|
}
|
|
|
|
|
|
func GetCollList(c *CollList, userid string) map[string]interface{} {
|
|
@@ -316,25 +323,39 @@ func GetCollList(c *CollList, userid string) map[string]interface{} {
|
|
|
"count": 0,
|
|
|
"haveNextPage": false,
|
|
|
"res": []map[string]interface{}{},
|
|
|
+ "pageSize": pagesize_max,
|
|
|
}
|
|
|
sql := fmt.Sprintf(`select bid from %s where userid ='%s'`, db.DbConf.Bdcollection, userid)
|
|
|
isPay := Power(userid)
|
|
|
limit := config.BidCollConfig.FreeUserCollLimit
|
|
|
if isPay {
|
|
|
- //收藏时间
|
|
|
+ now := time.Now()
|
|
|
start, end := "", ""
|
|
|
- if c.Colltime_start > 0 {
|
|
|
- start = time.Unix(c.Colltime_start, 0).Format(qu.Date_Full_Layout)
|
|
|
- }
|
|
|
- if c.Colltime_end > 0 {
|
|
|
- end = time.Unix(c.Colltime_end, 0).Format(qu.Date_Full_Layout)
|
|
|
+ //收藏时间
|
|
|
+ if c.SelectTime == "lately-7" { //最近7天
|
|
|
+ start = fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local).Format(qu.Date_Full_Layout))
|
|
|
+ } else if c.SelectTime == "lately-30" { //最近30天
|
|
|
+ start = fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day()-30, 0, 0, 0, 0, time.Local).Format(qu.Date_Full_Layout))
|
|
|
+ } else if c.SelectTime == "thisyear" { //去年
|
|
|
+ start = fmt.Sprint(time.Date(now.Year()-1, 1, 1, 0, 0, 0, 0, time.Local).Format(qu.Date_Full_Layout))
|
|
|
+ end = fmt.Sprint(time.Date(now.Year()-1, 12, 31, 23, 59, 59, 0, time.Local).Format(qu.Date_Full_Layout))
|
|
|
+ } else {
|
|
|
+ if c.SelectTime != "" {
|
|
|
+ starttime := strings.Split(c.SelectTime, "-")[0]
|
|
|
+ startstamp, _ := strconv.Atoi(starttime)
|
|
|
+ start = time.Unix(int64(startstamp), 0).Format(qu.Date_Full_Layout)
|
|
|
+ endtime := strings.Split(c.SelectTime, "-")[1]
|
|
|
+ et, _ := strconv.ParseInt(endtime, 0, 64)
|
|
|
+ etTime := time.Unix(et, 0)
|
|
|
+ end = fmt.Sprint(time.Date(etTime.Year(), etTime.Month(), etTime.Day()+1, 0, 0, 0, 0, time.Local).Format(qu.Date_Full_Layout))
|
|
|
+ }
|
|
|
}
|
|
|
if start != "" && end != "" {
|
|
|
- sql += ` and createdate >= '` + start + `' and createdate <= '` + end + `'`
|
|
|
+ sql += ` and createdate >= '` + start + `' and createdate < '` + end + `'`
|
|
|
} else if start != "" && end == "" {
|
|
|
sql += ` and createdate >= '` + start + `'`
|
|
|
} else if start == "" && end != "" {
|
|
|
- sql += ` and createdate <= '` + end + `'`
|
|
|
+ sql += ` and createdate < '` + end + `'`
|
|
|
}
|
|
|
//采购单位 用,分隔开
|
|
|
if c.Buyerclass != "" {
|
|
@@ -664,8 +685,8 @@ func AddLab(name, userid string) map[string]interface{} {
|
|
|
}
|
|
|
//是否有重名
|
|
|
if labArr := *db.Mysql.SelectBySql(fmt.Sprintf("select * from %s where labelname = ? and userid = ?", db.DbConf.Bdlabel), name, userid); len(labArr) == 1 {
|
|
|
- res := labArr[0]
|
|
|
- m["labid"] = qu.SE.EncodeString(strconv.FormatInt(qu.Int64All(res["id"]), 10))
|
|
|
+ // res := labArr[0]
|
|
|
+ m["labid"] = ""
|
|
|
m["msg"] = "已存在"
|
|
|
return m
|
|
|
} else { //新增标签
|