wangshan 4 жил өмнө
parent
commit
b26f5e289f

+ 1 - 1
src/jfw/modules/bigmember/src/service/analysis/decision.go

@@ -77,7 +77,7 @@ func (this *Analysis) DecInfo() {
 					i_member_status := qutil.IntAll((*userInfo)["i_member_status"])
 					if ai == 2 && i_member_status == 4 { //试用用户
 						redis.Put("other", "decision_trial_"+base64Key, 1, 7*24*60*60) //一周试用期
-						UpdatePower(userId, "P")
+						UpdatePower(userId, "P")                                       //更新试用用户试用权限次数
 					}
 					decQuery := DecQuery(area, buyerClass, buyerContent)
 					regMap.Data = getDecInfo(decQuery)

+ 46 - 22
src/jfw/modules/bigmember/src/service/analysis/potential.go

@@ -135,29 +135,53 @@ func (this *Analysis) CsORRsList() {
 			if entName == "" {
 				log.Println("大会员初始化 企业名称有误-", userId)
 			}
-			//客户
-			if pcor == "C" {
-				potComQ := PCQuery(area, industry, buyerClass, business_scope, sort_no, pcor)
-				// log.Println("potComQ:", potComQ)
-				regMap.Data = map[string]interface{}{
-					"list": getPCostomers(userId, entName, potComQ, pcor),
-					"param": map[string]interface{}{
-						"area":           area,
-						"industry":       industry,
-						"buyerClass":     buyerClass,
-						"business_scope": business_scope,
-					},
+			userInfo, ok := db.Mgo.FindById("user", userId, nil)
+			if ok && userInfo != nil && len(*userInfo) > 0 {
+				var i_member_status = qutil.IntAll((*userInfo)["i_member_status"])
+				var c_limitcount = 7
+				var r_limitcount = 7
+				if i_member_status == 4 {
+					bamount := getBAmountInfo(userId)
+					c_limitcount = qutil.IntAll(bamount["potential_customer_count"])
+					r_limitcount = qutil.IntAll(bamount["potential_rival_count"])
 				}
-			} else if pcor == "R" {
-				potRivQ := PCQuery(area, industry, buyerClass, business_scope, sort_no, pcor)
-				regMap.Data = map[string]interface{}{
-					"list": getPRivals(userId, potRivQ, pcor),
-					"param": map[string]interface{}{
-						"area":           area,
-						"industry":       industry,
-						"buyerClass":     buyerClass,
-						"business_scope": business_scope,
-					},
+				//客户
+				if pcor == "C" {
+					potComQ := PCQuery(area, industry, buyerClass, business_scope, sort_no, pcor)
+					list := getPCostomers(userId, entName, potComQ, pcor)
+					surpluscount := -1 //剩余数量
+					if i_member_status == 4 {
+						surpluscount = len(list) - c_limitcount
+						list = list[:c_limitcount]
+					}
+					regMap.Data = map[string]interface{}{
+						"list":         list,
+						"surpluscount": surpluscount,
+						"param": map[string]interface{}{
+							"area":           area,
+							"industry":       industry,
+							"buyerClass":     buyerClass,
+							"business_scope": business_scope,
+						},
+					}
+				} else if pcor == "R" {
+					potRivQ := PCQuery(area, industry, buyerClass, business_scope, sort_no, pcor)
+					list := getPRivals(userId, potRivQ, pcor)
+					surpluscount := -1 //剩余数量
+					if i_member_status == 4 {
+						surpluscount = len(list) - r_limitcount
+						list = list[:r_limitcount]
+					}
+					regMap.Data = map[string]interface{}{
+						"list":         list,
+						"surpluscount": surpluscount,
+						"param": map[string]interface{}{
+							"area":           area,
+							"industry":       industry,
+							"buyerClass":     buyerClass,
+							"business_scope": business_scope,
+						},
+					}
 				}
 			} else {
 				regMap.Error_code = Error_code_1003