Forráskód Böngészése

wip:阳光采购信息

wangshan 5 hónapja
szülő
commit
09a752d972

+ 1 - 0
src/jfw/modules/publicapply/src/config.yaml

@@ -7,3 +7,4 @@ entManageApplication: "entmanageapplication.rpc" #企业管理中台
 jyPointKey: "integral.rpc" #积分中台
 resourceCenterKey: "resource.rpc" #资源中台
 smswxswitch: true
+miniDetailLimit: 1

+ 32 - 0
src/jfw/modules/publicapply/src/detail/dao/baseInfo.go

@@ -9,6 +9,8 @@ import (
 	"app.yhyue.com/moapp/jypkg/public"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/os/gctx"
 	"jy/src/jfw/modules/publicapply/src/config"
 	"jy/src/jfw/modules/publicapply/src/db"
 	dc "jy/src/jfw/modules/publicapply/src/detail/config"
@@ -190,6 +192,36 @@ func (b *BaseInfo) BidBaseInfo() (bi *BidInfo, err error) {
 		if bErr != nil {
 			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 {
+						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") { //新版超级订阅||免费用户   不能看采购意向和拟建
 			if subtype == "拟建" || subtype == "采购意向" {

+ 16 - 9
src/jfw/modules/publicapply/src/detail/dao/bidding.go

@@ -277,7 +277,7 @@ func (bi *BidInfo) BiddingDataFormatNoPower(obj map[string]interface{}, id, deta
 		}
 		bi.Next = false
 		if bi.BaseInfo.IsPay {
-			var subStr = "******"
+			var subStr = "****"
 			bi.Abstract.Default.Buyer = subStr
 			bi.Abstract.Default.BuyerPerson = subStr
 			bi.Abstract.Default.BuyerTel = subStr
@@ -291,18 +291,22 @@ func (bi *BidInfo) BiddingDataFormatNoPower(obj map[string]interface{}, id, deta
 				b, err := json.Marshal(purchasingList)
 				if err == nil && len(b) > 0 {
 					var pls []entity.Purchasing
+					var purchasingStr = "XXXXXX"
 					err = json.Unmarshal(b, &pls)
 					if err == nil && len(pls) > 0 {
 						for _, v := range pls {
+							if strings.TrimSpace(v.ItemName) == "" {
+								continue
+							}
 							bi.Abstract.Default.PurchasingList = append(bi.Abstract.Default.PurchasingList, entity.PurchasingList{
-								Number:    v.Number,
-								Table:     subStr,
-								ItemName:  subStr,
-								Model:     subStr,
-								Root:      subStr,
-								BrandName: subStr,
-								UnitName:  subStr,
-								Code:      subStr,
+								Number:    v.Number,      //
+								Table:     purchasingStr, //
+								ItemName:  v.ItemName,    //
+								Model:     purchasingStr, //
+								Root:      purchasingStr, //
+								BrandName: purchasingStr, //
+								UnitName:  v.UnitName,    //
+								Code:      purchasingStr, //
 							})
 						}
 					}
@@ -428,6 +432,9 @@ func (bi *BidInfo) BiddingDataFormat(obj map[string]interface{}, b *BaseInfo) {
 					err = json.Unmarshal(b, &pls)
 					if err == nil && len(pls) > 0 {
 						for _, v := range pls {
+							if strings.TrimSpace(v.ItemName) == "" {
+								continue
+							}
 							bi.Abstract.Default.PurchasingList = append(bi.Abstract.Default.PurchasingList, entity.PurchasingList{
 								Number:      v.Number,
 								Table:       v.Table,