|
@@ -101,7 +101,9 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
|
|
|
ok, msg := true, ""
|
|
|
var wg sync.WaitGroup
|
|
|
maxCount := config.BidCollConfig.FreeUserCollLimit
|
|
|
- isPay := Power(userid)
|
|
|
+ isPay, _ := Power(userid)
|
|
|
+ redisCollKey := fmt.Sprintf("coll_%s", userid)
|
|
|
+ redisArr := []string{}
|
|
|
if isPay {
|
|
|
maxCount = config.BidCollConfig.PayUserCollLimit
|
|
|
}
|
|
@@ -139,6 +141,9 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
|
|
|
"createdate": qu.FormatDateByInt64(&now, qu.Date_Full_Layout),
|
|
|
}
|
|
|
if it := db.Mysql.Insert(db.DbConf.Bdcollection, inserMap); it > 0 {
|
|
|
+ if !isPay {
|
|
|
+ redisArr = append(redisArr, util.DecodeId(bd.Bid))
|
|
|
+ }
|
|
|
i++
|
|
|
collCount++
|
|
|
} else {
|
|
@@ -153,6 +158,12 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
|
|
|
}(v)
|
|
|
}
|
|
|
wg.Wait()
|
|
|
+ if len(redisArr) > 0 {
|
|
|
+ // coll := redis.Get(config.BidCollConfig.FreeCollRedisKey, redisCollKey).([]string)
|
|
|
+ // ar := append(redisArr, coll)
|
|
|
+ // redis.Put(config.BidCollConfig.FreeCollRedisKey, ar)
|
|
|
+ log.Println(redisCollKey)
|
|
|
+ }
|
|
|
m := map[string]interface{}{
|
|
|
"status": qu.If(ok, i <= len(bidAction.Binfo), ok),
|
|
|
"msg": msg,
|
|
@@ -231,7 +242,7 @@ func LabelAction(labInfo *LabelInfo, userid string) map[string]interface{} {
|
|
|
//收藏招标信息
|
|
|
if labInfo.Lids != "" && len(labInfo.Binfo) > 0 {
|
|
|
maxCount := config.BidCollConfig.FreeUserCollLimit
|
|
|
- isPay := Power(userid)
|
|
|
+ isPay, _ := Power(userid)
|
|
|
if isPay {
|
|
|
maxCount = config.BidCollConfig.PayUserCollLimit
|
|
|
}
|
|
@@ -326,7 +337,7 @@ func GetCollList(c *CollList, userid string) map[string]interface{} {
|
|
|
"pageSize": pagesize_max,
|
|
|
}
|
|
|
sql := fmt.Sprintf(`select bid from %s where userid ='%s'`, db.DbConf.Bdcollection, userid)
|
|
|
- isPay := Power(userid)
|
|
|
+ isPay, _ := Power(userid)
|
|
|
limit := config.BidCollConfig.FreeUserCollLimit
|
|
|
if isPay {
|
|
|
now := time.Now()
|
|
@@ -435,15 +446,24 @@ func GetCollList(c *CollList, userid string) map[string]interface{} {
|
|
|
}
|
|
|
|
|
|
//是否是付费用户 -bool: true:是 fasle:不是
|
|
|
-func Power(userid string) bool {
|
|
|
+func Power(userid string) (bool, map[string]interface{}) {
|
|
|
isVip, isMember, isEnt := false, false, false
|
|
|
+ vipstatus := 0
|
|
|
phone := ""
|
|
|
- data, ok := db.Mgo.FindById("user", userid, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1`)
|
|
|
+ data, ok := db.Mgo.FindById("user", userid, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1`)
|
|
|
if data != nil && len(*data) > 0 && ok {
|
|
|
i_vip_status := qu.IntAll((*data)["i_vip_status"])
|
|
|
- if i_vip_status > 0 {
|
|
|
+ if i_vip_status > 1 {
|
|
|
+ vipstatus = 1
|
|
|
isVip = true
|
|
|
}
|
|
|
+ ovipjy, _ := (*data)["o_vipjy"].(map[string]interface{})
|
|
|
+ if ovipjy["o_buyset"] != nil {
|
|
|
+ o_buyset := ovipjy["o_buyset"].(map[string]interface{})
|
|
|
+ if o_buyset["upgrade"] != nil && isVip {
|
|
|
+ vipstatus = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
if i_member_status := qu.IntAllDef((*data)["i_member_status"], 0); i_member_status > 0 {
|
|
|
isMember = true
|
|
|
}
|
|
@@ -458,7 +478,11 @@ func Power(userid string) bool {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return isVip || isEnt || isMember
|
|
|
+ return isVip || isEnt || isMember, map[string]interface{}{
|
|
|
+ "vip": vipstatus,
|
|
|
+ "member": isMember,
|
|
|
+ "entniche": isEnt,
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
type InfoList struct {
|