Jelajahi Sumber

feat:移动端最新招标信息

wangshan 2 tahun lalu
induk
melakukan
c5b58d4407
1 mengubah file dengan 24 tambahan dan 16 penghapusan
  1. 24 16
      jyBXBase/rpc/internal/logic/newestbiddinglogic.go

+ 24 - 16
jyBXBase/rpc/internal/logic/newestbiddinglogic.go

@@ -76,13 +76,13 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 				res.ErrMsg = fmt.Errorf("未查询到用户信息").Error()
 				return res
 			}
-			var isPayUser bool = false
+			//var isPayUser bool = false
+			//付费用户如果没有数据 直接返回 需求来源:测试
 			//vip用户
 			vipStatus := MC.IntAll((*userMap)["i_vip_status"])
 			//大会员用户
 			bigStatus := MC.Int64All((*userMap)["i_member_status"])
 			if bigStatus > 0 {
-				isPayUser = true
 				o_msgset := MC.ObjToMap((*userMap)["o_member_jy"])
 				big_items, ok := (*o_msgset)["a_items"].([]interface{})
 				//大会员推送历史
@@ -98,20 +98,30 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 					res.Data.List = result
 					res.Data.SubFlag = "m"
 				}
-			} else if phone := MC.If((*userMap)["s_phone"] != nil, MC.ObjToString((*userMap)["s_phone"]), MC.ObjToString((*userMap)["s_m_phone"])).(string); phone != "" && in.EntUserId != "" {
+				return res
+			}
+			if phone := MC.If((*userMap)["s_phone"] != nil, MC.ObjToString((*userMap)["s_phone"]), MC.ObjToString((*userMap)["s_m_phone"])).(string); phone != "" && in.EntUserId != "" && in.EntId != "" {
 				//商机管理
-				if count := IC.MainMysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone=? and u.power=1 and i.status=1`, phone); count > 0 {
-					//商机管理推送历史
-					isPayUser = true
-					result := model.GetNewestInfo(in.EntUserId, "e", MC.Int64All(in.EntUserId)).GetPushHistory()
-					res.Data.Count = int64(len(result))
-					if res.Data.Count > 0 {
-						res.Data.List = result
-						res.Data.SubFlag = "e"
+				entNicheInfos := IC.MainMysql.SelectBySql(`SELECT i.power_source,r.role_id,u.power FROM (entniche_user u LEFT JOIN entniche_user_role r ON r.user_id = u.id)  LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone = ? and i.id = ?`, phone, in.EntId)
+				if entNicheInfos != nil && len(*entNicheInfos) > 0 {
+					entNicheInfo := (*entNicheInfos)[0]
+					//排除商机管理服务
+					if MC.IntAll(entNicheInfo["power_source"]) != 1 {
+						//商机管理管理员 或 已分发权限的员工
+						if MC.IntAll(entNicheInfo["role_id"]) > 0 || MC.IntAll(entNicheInfo["power"]) > 0 {
+							//商机管理推送历史
+							result := model.GetNewestInfo(in.EntUserId, "e", MC.Int64All(in.EntUserId)).GetPushHistory()
+							res.Data.Count = int64(len(result))
+							if res.Data.Count > 0 {
+								res.Data.List = result
+								res.Data.SubFlag = "e"
+							}
+							return res
+						}
 					}
 				}
-			} else if vipStatus > 0 {
-				isPayUser = true
+			}
+			if vipStatus > 0 {
 				o_msgset := MC.ObjToMap((*userMap)["o_vipjy"])
 				vip_items, ok := (*o_msgset)["a_items"].([]interface{})
 				//vip查询推送历史
@@ -126,11 +136,9 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 				res.Data.Count = int64(len(result))
 				res.Data.List = result
 				res.Data.SubFlag = "v"
-			}
-			//付费用户如果没有数据 直接返回 需求来源:测试
-			if isPayUser {
 				return res
 			}
+
 			//普通用户用户- 有关键词
 			o_msgset := MC.ObjToMap((*userMap)["o_jy"])
 			items, ok := (*o_msgset)["a_key"].([]interface{})