|
@@ -193,34 +193,36 @@ func (b *BaseInfo) BidBaseInfo() (bi *BidInfo, err error) {
|
|
|
return bErr
|
|
|
}
|
|
|
//小程序 阳光采购 : 无权限用户 首次访问阳光采购 信息 有权限获取详情数据
|
|
|
- if isLogin && !bi.CanRead && strings.Contains(b.R.UserAgent(), "miniProgram") {
|
|
|
- var (
|
|
|
- cacheKey = fmt.Sprintf("mini_program_%s_%d", b.UserInfo.Phone, b.UserInfo.PositionId)
|
|
|
- biddingIds = redis.GetStr(consts.RedisLimitation, cacheKey)
|
|
|
- splitStr = "#"
|
|
|
- ids []string
|
|
|
- )
|
|
|
- if biddingIds != "" {
|
|
|
- ids = strings.Split(biddingIds, splitStr)
|
|
|
- }
|
|
|
- if len(ids) > 0 {
|
|
|
- for _, id := range ids {
|
|
|
- if id == b.Id {
|
|
|
+ if isLogin && strings.Contains(b.R.UserAgent(), "miniProgram") {
|
|
|
+ if !bi.Purchase {
|
|
|
+ var (
|
|
|
+ cacheKey = fmt.Sprintf("mini_program_%s_%d", b.UserInfo.Phone, b.UserInfo.PositionId)
|
|
|
+ biddingIds = redis.GetStr(consts.RedisLimitation, cacheKey)
|
|
|
+ splitStr = "#"
|
|
|
+ ids []string
|
|
|
+ )
|
|
|
+ if biddingIds != "" {
|
|
|
+ ids = strings.Split(biddingIds, splitStr)
|
|
|
+ }
|
|
|
+ if len(ids) > 0 {
|
|
|
+ for _, id := range ids {
|
|
|
+ if id == b.Id {
|
|
|
+ bi.CanRead = true
|
|
|
+ bi.Purchase = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !bi.Purchase && len(ids) < g.Cfg().MustGet(gctx.New(), "miniDetailLimit").Int() {
|
|
|
+ ids = append(ids, b.Id)
|
|
|
+ if saveBool := redis.Put(consts.RedisLimitation, cacheKey, strings.Join(ids, splitStr), -1); !saveBool {
|
|
|
+ log.Println(fmt.Sprintf("%s redis %s save false", cacheKey, strings.Join(ids, splitStr)))
|
|
|
+ } else {
|
|
|
bi.CanRead = true
|
|
|
bi.Purchase = true
|
|
|
- break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if !bi.CanRead && len(ids) < g.Cfg().MustGet(gctx.New(), "miniDetailLimit").Int() {
|
|
|
- ids = append(ids, b.Id)
|
|
|
- if saveBool := redis.Put(consts.RedisLimitation, cacheKey, strings.Join(ids, splitStr), -1); !saveBool {
|
|
|
- log.Println(fmt.Sprintf("%s redis %s save false", cacheKey, strings.Join(ids, splitStr)))
|
|
|
- } else {
|
|
|
- bi.CanRead = true
|
|
|
- bi.Purchase = true
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
//权限判断 处理
|
|
|
if !bi.Topnet && (detailKey == "new_vip_pay" || detailKey == "saleLeads_free") { //新版超级订阅||免费用户 不能看采购意向和拟建
|