Selaa lähdekoodia

feat:不返回留资信息

fuwencai 1 vuosi sitten
vanhempi
commit
e08543f403

+ 10 - 12
src/jfw/modules/publicapply/src/userbase/entity/entity.go

@@ -491,12 +491,13 @@ func (o *OriginalPower) SavePowerRecord(originalUrl string) {
 }
 
 // GetLeads 获取留资信息和判断是否满足
-func (o *OriginalPower) GetLeads() (leadOk bool, rM map[string]interface{}) {
+func (o *OriginalPower) CNode() (leadOk bool) {
 	// 查留资source
 	if hasRetainedCapital(o.UserId, []string{"pc_article_original_one", "app_article_original_one", "wx_article_original_one", "h5_article_original_one"}) {
 		leadOk = true
+		return
 	}
-	rM = map[string]interface{}{}
+	rM := map[string]interface{}{}
 	rdata, ok := db.Mgo.Find("saleLeads", map[string]interface{}{
 		"userid": o.UserId,
 	}, `{"createtime":-1}`, nil, false, 0, 10)
@@ -518,8 +519,8 @@ func (o *OriginalPower) GetLeads() (leadOk bool, rM map[string]interface{}) {
 		delete(rM, "client")
 	}
 	if userinfo := config.Compatible.Select(o.UserId, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1,"o_jy":1,"o_vipjy":1}`); userinfo != nil && len(*userinfo) > 0 {
-		s_phone := util.ObjToString((*userinfo)["s_phone"])
-		phone := util.If(s_phone == "", util.ObjToString((*userinfo)["s_m_phone"]), s_phone)
+		sPhone := util.ObjToString((*userinfo)["s_phone"])
+		phone := util.If(sPhone == "", util.ObjToString((*userinfo)["s_m_phone"]), sPhone)
 		if rM["phone"] == nil || rM["phone"] == "" {
 			rM["phone"] = phone
 		}
@@ -527,15 +528,12 @@ func (o *OriginalPower) GetLeads() (leadOk bool, rM map[string]interface{}) {
 			rM["company"] = util.ObjToString((*userinfo)["s_company"])
 		}
 	}
-
 	// 查之前的留资信息是否满足
-	if !leadOk {
-		if rM["name"] != nil && rM["name"] != "" && rM["phone"] != nil && rM["phone"] != "" && rM["company"] != nil && rM["company"] != "" && rM["position"] != nil && rM["position"] != "" && rM["companyType"] != "" {
-			if rM["position"] != "总裁" && rM["position"] != "总经理" && (rM["branch"] == nil || rM["branch"] == "") {
-				leadOk = false
-			} else {
-				leadOk = true
-			}
+	if rM["name"] != nil && rM["name"] != "" && rM["phone"] != nil && rM["phone"] != "" && rM["company"] != nil && rM["company"] != "" && rM["position"] != nil && rM["position"] != "" && rM["companyType"] != "" {
+		if rM["position"] != "总裁" && rM["position"] != "总经理" && (rM["branch"] == nil || rM["branch"] == "") {
+			leadOk = false
+		} else {
+			leadOk = true
 		}
 	}
 	return

+ 1 - 6
src/jfw/modules/publicapply/src/userbase/service/service.go

@@ -166,7 +166,6 @@ func (this *ServiceStruct) GetOriginalText() {
 		return
 	}
 	var url string
-	var info map[string]interface{}
 	// 判断需不需要登录 和验证不验证权限  直接查询原文地址返回
 	stypeInfo := entity.GetStypeInfo(this.Request.Referer())
 	if stypeInfo == nil {
@@ -271,13 +270,12 @@ func (this *ServiceStruct) GetOriginalText() {
 	default:
 		// 免费
 		var leadOk bool
-		leadOk, info = op.GetLeads()
+		leadOk = op.CNode()
 		if op.TotalCount <= int64(count) {
 			//- 机会已经消耗过  需要留资  升级大会员 status 3
 			this.ServeJson(Result{Data: map[string]interface{}{
 				"url":     "",
 				"surplus": 0,
-				"info":    info,
 				"status":  OriginalStatus3,
 			}})
 			return
@@ -288,7 +286,6 @@ func (this *ServiceStruct) GetOriginalText() {
 			this.ServeJson(Result{Data: map[string]interface{}{
 				"url":     "",
 				"surplus": 0,
-				"info":    info,
 				"status":  OriginalStatus1,
 			}})
 			return
@@ -297,7 +294,6 @@ func (this *ServiceStruct) GetOriginalText() {
 			this.ServeJson(Result{Data: map[string]interface{}{
 				"url":     "",
 				"surplus": op.TotalCount - int64(count),
-				"info":    info,
 				"status":  OriginalStatus2,
 			}})
 			return
@@ -319,7 +315,6 @@ func (this *ServiceStruct) GetOriginalText() {
 		this.ServeJson(Result{Data: map[string]interface{}{
 			"url":     url,
 			"surplus": op.TotalCount - int64(count) - 1,
-			"info":    info,
 		}})
 		return
 	}