WH01243 2 gadi atpakaļ
vecāks
revīzija
30b4d8a850

+ 2 - 3
jyBXSubscribe/go.mod

@@ -3,12 +3,10 @@ module jyBXSubscribe
 go 1.18
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230427031503-e78871a3f7d8
+	app.yhyue.com/moapp/jybase v0.0.0-20230504094413-7eab0c56bca0
 	app.yhyue.com/moapp/jypkg v0.0.0-20230218064127-1de4f4f3e6a3
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
-	bp.jydev.jianyu360.cn/BaseService/jyCodeService v0.0.0-20220927093612-72958b15cdf0
 	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230207054315-b05f3dd4c4d3
-	bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230418084942-11fba19bd9bf
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/gogf/gf/v2 v2.0.6
 	github.com/zeromicro/go-zero v1.4.4
@@ -57,6 +55,7 @@ require (
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/compress v1.13.6 // indirect
+	github.com/kr/pretty v0.3.0 // indirect
 	github.com/longbridgeapp/sqlparser v0.3.1 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
 	github.com/mattn/go-isatty v0.0.16 // indirect

+ 2 - 8
jyBXSubscribe/go.sum

@@ -6,12 +6,11 @@ app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220419023055-f406279ff7e3/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220719064915-2fef79005dfa/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
 app.yhyue.com/moapp/jybase v0.0.0-20220802080941-07f401baab8b/go.mod h1:HelrO6tcD9TcKb/HOP2BLbzppyDz2kpQSFhPMQTUgbQ=
 app.yhyue.com/moapp/jybase v0.0.0-20230109015757-aa3d5e19b196/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jybase v0.0.0-20230427031503-e78871a3f7d8 h1:mLI8P4TnohyRYLGrWu0I0td6pymEeepR4hduQePmGrE=
-app.yhyue.com/moapp/jybase v0.0.0-20230427031503-e78871a3f7d8/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
+app.yhyue.com/moapp/jybase v0.0.0-20230504094413-7eab0c56bca0 h1:7nytYrlgWX4Wh3tYEPTZco5dTYPLZTXuObkdr0oaups=
+app.yhyue.com/moapp/jybase v0.0.0-20230504094413-7eab0c56bca0/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
 app.yhyue.com/moapp/jypkg v0.0.0-20230218064127-1de4f4f3e6a3 h1:7vKwqvf/7dvKO0Q5B9Yj6yaDf8EDL3jJrbFqJ/vsIEk=
 app.yhyue.com/moapp/jypkg v0.0.0-20230218064127-1de4f4f3e6a3/go.mod h1:s5dthI0jGiOB+eHG8GAV15jlsu2YX1XA2gsLxw2m1sA=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
@@ -20,12 +19,8 @@ bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230209051900-1e7
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4 h1:zl5eZrKDBENVVBUiPpzyQQ0/SBdGUmZS3thXycSEO1g=
 bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4/go.mod h1:BMLd/5wb3BIEGhnEgF9y1sJN9P5/Dw9kYsoiE9V8I9g=
-bp.jydev.jianyu360.cn/BaseService/jyCodeService v0.0.0-20220927093612-72958b15cdf0 h1:IxOy/G/OzOmDql81jdDfgiwvh0GYcTcuCob875KsF6o=
-bp.jydev.jianyu360.cn/BaseService/jyCodeService v0.0.0-20220927093612-72958b15cdf0/go.mod h1:Def9i6RggnFvYswG767+jI+S7wMPkzx3D7Bs6Gnj2Q8=
 bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230207054315-b05f3dd4c4d3 h1:jeItQ6RM1T6yPWc/5i4R6h3kViD+Rm2VnIEsc1gCFJA=
 bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20230207054315-b05f3dd4c4d3/go.mod h1:5nimT8GJh46AyfeeDeyRlDQygMlO7TRM8Pwm41Gxemc=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230418084942-11fba19bd9bf h1:z6R4L8HW+psGn4hLBfo7I3rvOGTLDy9UG9PilVLDF3U=
-bp.jydev.jianyu360.cn/BaseService/pushpkg v0.0.0-20230418084942-11fba19bd9bf/go.mod h1:kWsTXorjHexi/0IrZ6iFIyNmv5ookkkt5B/8zRi5Uu8=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220418005748-8ba5d936dd53/go.mod h1:E5lcDI3k4FESLxiAetCfWQTq8qfpy9cv0yN1oKoEO34=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419023723-0b32d4a41751/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
 bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.0-20220419063004-233fc7ce006c/go.mod h1:6KL5LMEku83uRbre0W/bj5kXG2I6pJGBFtktmtp51yM=
@@ -1366,7 +1361,6 @@ golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=

+ 2 - 2
jyBXSubscribe/rpc/init/db.go

@@ -5,9 +5,9 @@ package init
 
 import (
 	elastic "app.yhyue.com/moapp/jybase/esv1"
+	P "app.yhyue.com/moapp/jybase/mapping"
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
-	P "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
 	"github.com/zeromicro/go-zero/core/logx"
 	"strings"
 
@@ -95,7 +95,7 @@ func MysqlInit(mm *entity.Mysql) {
 		}
 		GlobalCommonData.Init()
 	}
-	P.PushMapping.Init(BaseServiceMysql)
+	P.BidCodeMapping.Init(BaseServiceMysql)
 }
 
 //

+ 0 - 2
jyBXSubscribe/rpc/init/init.go

@@ -6,14 +6,12 @@ import (
 
 	"app.yhyue.com/moapp/jypkg/compatible"
 	"app.yhyue.com/moapp/jypkg/middleground"
-	codePb "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
 var C config.Config
 var err error
-var CodeLib codePb.CodeService
 
 //
 var DB config.Db

+ 133 - 134
jyBXSubscribe/rpc/model/push.go

@@ -16,10 +16,10 @@ import (
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/esv1"
+	P "app.yhyue.com/moapp/jybase/mapping"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
-	P "bp.jydev.jianyu360.cn/BaseService/pushpkg/p"
 	"github.com/zeromicro/go-zero/core/logx"
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
@@ -413,8 +413,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			//城市
 			city := []string{}
 			for _, v := range strings.Split(spqp.City, ",") {
-				if P.PushMapping.City[v] > 0 {
-					city = append(city, fmt.Sprint(P.PushMapping.City[v]))
+				if P.BidCodeMapping.City[v] != "" {
+					city = append(city, fmt.Sprint(P.BidCodeMapping.City[v]))
 				} else {
 					city = append(city, "-1")
 				}
@@ -429,8 +429,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			var sqlArea = ""
 			area := []string{}
 			for _, v := range strings.Split(spqp.Area, ",") {
-				if P.PushMapping.Area[v] > 0 {
-					area = append(area, fmt.Sprint(P.PushMapping.Area[v]))
+				if P.BidCodeMapping.Area[v] != "" {
+					area = append(area, fmt.Sprint(P.BidCodeMapping.Area[v]))
 				} else {
 					area = append(area, "-1")
 				}
@@ -454,7 +454,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		if spqp.Buyerclass != "" {
 			buyerclass := []string{}
 			for _, v := range strings.Split(spqp.Buyerclass, ",") {
-				buyerclass = append(buyerclass, fmt.Sprint(P.PushMapping.Buyerclass[v]))
+				buyerclass = append(buyerclass, fmt.Sprint(P.BidCodeMapping.Buyerclass[v]))
 			}
 			if len(buyerclass) == 1 {
 				buyerclass = append(buyerclass, "9999")
@@ -468,20 +468,20 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		if spqp.Subtype != "" {
 			subtype := []string{}
 			for _, v := range strings.Split(spqp.Subtype, ",") {
-				subtype = append(subtype, fmt.Sprintf("find_in_set('%d',a.subscopeclass)", P.PushMapping.Subscopeclass[v]))
+				subtype = append(subtype, P.BidCodeMapping.Subtype[v])
 			}
 			if len(subtype) == 1 {
 				subtype = append(subtype, "9999")
 			}
 			if len(subtype) > 0 {
-				querys = append(querys, fmt.Sprintf("a.subtype_code in (%s)", strings.Join(subtype, ",")))
+				querys = append(querys, fmt.Sprintf("subtype in (%s)", strings.Join(subtype, ",")))
 			}
 		}
 		//信息行业
 		if spqp.Subscopeclass != "" {
 			find_in_set := []string{}
 			for _, v := range strings.Split(spqp.Subscopeclass, ",") {
-				find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%d',a.subscopeclass)", P.PushMapping.Subscopeclass[v]))
+				find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',a.subscopeclass)", P.BidCodeMapping.Subscopeclass[v]))
 			}
 			if len(find_in_set) == 1 {
 				querys = append(querys, find_in_set[0])
@@ -521,146 +521,145 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			} else if spqp.FileExists == "-1" {
 				querys = append(querys, fmt.Sprintf("a.attachment_count is null"))
 			}
-			// 是否已读
-			if spqp.IsRead != "" {
-				if spqp.IsRead == "0" {
-					userStr += " and a.isvisit IS NULL"
-				} else if spqp.IsRead == "1" {
-					userStr += " and a.isvisit=1"
-				}
-			}
-			// 信息来源
-			if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
-				userStr += " and a.source=" + spqp.Source
-			}
-			if spqp.IsEnt {
-				var staffs []string
-				userStr += fmt.Sprintf(" and  a.entid='%s' ", spqp.EntId)
-				//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
-				userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
-				if !(userEnt.Role_admin_system || userEnt.Role_admin_department) {
-					result = []*bxsubscribe.SubscribeInfo{}
-					return
-				}
-				if userEnt.Role_admin_department { //部门管理员 获取所有部门和子部门员工
-					users := GetDisUsers(common.IntAll(spqp.EntId), userEnt.Dept.Id)
-					if users != nil && len(*users) > 0 {
-						for _, v := range *users {
-							if len(spqp.Staffs) > 0 {
-								for _, vv := range spqp.Staffs {
-									if fmt.Sprintf("%d", v.Id) == vv {
-										staffs = append(staffs, common.InterfaceToStr(v.Id))
-									}
+		}
+		// 是否已读
+		if spqp.IsRead != "" {
+			if spqp.IsRead == "0" {
+				userStr += " and a.isvisit IS NULL"
+			} else if spqp.IsRead == "1" {
+				userStr += " and a.isvisit=1"
+			}
+		}
+		// 信息来源
+		if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
+			userStr += " and a.source=" + spqp.Source
+		}
+		if spqp.IsEnt {
+			var staffs []string
+			userStr += fmt.Sprintf(" and  a.entid='%s' ", spqp.EntId)
+			//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
+			userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
+			if !(userEnt.Role_admin_system || userEnt.Role_admin_department) {
+				result = []*bxsubscribe.SubscribeInfo{}
+				return
+			}
+			if userEnt.Role_admin_department { //部门管理员 获取所有部门和子部门员工
+				users := GetDisUsers(common.IntAll(spqp.EntId), userEnt.Dept.Id)
+				if users != nil && len(*users) > 0 {
+					for _, v := range *users {
+						if len(spqp.Staffs) > 0 {
+							for _, vv := range spqp.Staffs {
+								if fmt.Sprintf("%d", v.Id) == vv {
+									staffs = append(staffs, common.InterfaceToStr(v.Id))
 								}
-							} else {
-								staffs = append(staffs, common.InterfaceToStr(v.Id))
 							}
+						} else {
+							staffs = append(staffs, common.InterfaceToStr(v.Id))
 						}
-					} else {
-						log.Printf("部门管理员为获取到部门员工:%s", spqp.EntUserId)
-						result = []*bxsubscribe.SubscribeInfo{}
-						return
 					}
-				} else if len(spqp.Staffs) > 0 {
-					staffs = spqp.Staffs
-				}
-				//老板商机管理需要查询全部来源
-				isNew := true
-				//商机管理判断
-				newCount := IC.MainMysql.CountBySql("select  count(id) from  entniche_info where  id =? and  isNew != 1 and  status=1", spqp.EntId)
-				if newCount > 0 {
-					isNew = false
-				}
-				// 无查询分配人员、是否已读
-				if spqp.IsRead == "" && len(staffs) == 0 {
-					//查询数量(需要去重)
-					countSql = fmt.Sprintf("select count(1) from %s a    where %s %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
-					//列表查询
-					findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a  where  %s %s %s order by a.date desc,a.id desc",
-						aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, common.If(isNew, " and a.source = 2 ", ""))
 				} else {
-					//查询分配人员或是否已读
-					staffQuery := " 1=1 "
-					if len(staffs) > 0 {
-						staffQuery += fmt.Sprintf(" and  a.userid in ('%s')  ", strings.Join(staffs, "','"))
-					}
-					if spqp.IsRead != "" {
-						if spqp.IsRead == "0" {
-							staffQuery += " and a.isvisit IS NULL"
-						} else if spqp.IsRead == "1" {
-							staffQuery += " and a.isvisit=1"
-						}
-					}
-					countSql = fmt.Sprintf("select count(1) from %s a s where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
-					//列表查询
-					findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
+					log.Printf("部门管理员为获取到部门员工:%s", spqp.EntUserId)
+					result = []*bxsubscribe.SubscribeInfo{}
+					return
 				}
+			} else if len(spqp.Staffs) > 0 {
+				staffs = spqp.Staffs
+			}
+			//老板商机管理需要查询全部来源
+			isNew := true
+			//商机管理判断
+			newCount := IC.MainMysql.CountBySql("select  count(id) from  entniche_info where  id =? and  isNew != 1 and  status=1", spqp.EntId)
+			if newCount > 0 {
+				isNew = false
+			}
+			// 无查询分配人员、是否已读
+			if spqp.IsRead == "" && len(staffs) == 0 {
+				//查询数量(需要去重)
+				countSql = fmt.Sprintf("select count(1) from %s a    where %s %s %s", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""))
+				//列表查询
+				findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a  where  %s %s %s order by a.date desc,a.id desc",
+					aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, common.If(isNew, " and a.source = 2 ", ""))
 			} else {
-				// 是否已读
+				//查询分配人员或是否已读
+				staffQuery := " 1=1 "
+				if len(staffs) > 0 {
+					staffQuery += fmt.Sprintf(" and  a.userid in ('%s')  ", strings.Join(staffs, "','"))
+				}
 				if spqp.IsRead != "" {
 					if spqp.IsRead == "0" {
-						userStr += " and a.isvisit IS NULL"
+						staffQuery += " and a.isvisit IS NULL"
 					} else if spqp.IsRead == "1" {
-						userStr += " and a.isvisit=1"
+						staffQuery += " and a.isvisit=1"
 					}
 				}
-				// 信息来源
-				if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
-					userStr += " and a.source=" + spqp.Source
+				countSql = fmt.Sprintf("select count(1) from %s a s where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
+				//列表查询
+				findSql = fmt.Sprintf("select a.id,a.infoid,a.matchkeys,a.attachment_count from %s a where %s %s %s and ((%s) or EXISTS (SELECT 1 from %s c  WHERE c.source=3 %s and %s and a.id=c.pid and (%s))) order by a.date desc,a.id desc ", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr, common.If(isNew, " and a.source = 2 ", ""), staffQuery, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.ReplaceAll(userStr, "a.", "c."), strings.Join(querys, " and "), strings.ReplaceAll(staffQuery, "a.", "c."))
+			}
+		} else {
+			// 是否已读
+			if spqp.IsRead != "" {
+				if spqp.IsRead == "0" {
+					userStr += " and a.isvisit IS NULL"
+				} else if spqp.IsRead == "1" {
+					userStr += " and a.isvisit=1"
 				}
-				if spqp.PositionType == 1 {
-					//企业主体是企业的个人查询
-					if spqp.UserType == SubVipFlag {
-						userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=1 or a.product=3 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					} else if spqp.UserType == MemberFlag {
-						userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=2 or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					} else if spqp.UserType == EntnicheFlag {
-						userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product is null or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					} else {
-						userStr += fmt.Sprintf(" and  a.userid='%s' ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					}
+			}
+			// 信息来源
+			if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
+				userStr += " and a.source=" + spqp.Source
+			}
+			if spqp.PositionType == 1 {
+				//企业主体是企业的个人查询
+				if spqp.UserType == SubVipFlag {
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=1 or a.product=3 or a.source>1     ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+				} else if spqp.UserType == MemberFlag {
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product=2 or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+				} else if spqp.UserType == EntnicheFlag {
+					userStr += fmt.Sprintf(" and  a.userid='%s' and (  a.product is null or a.product=3  or a.source>1  ) ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				} else {
-					if s.ModuleFlag == EntnicheFlag {
-						//老商机管理个人订阅查询
-						userStr += fmt.Sprintf(" and  a.userid='%s'  and a.product is null", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					} else {
-						//个人订阅查询
-						userStr += fmt.Sprintf(" and  a.userid='%s'", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
-					}
+					userStr += fmt.Sprintf(" and  a.userid='%s' ", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
-				//查询数量
-				countSql = fmt.Sprintf("select count(1) as count from %s  a  where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, strings.Join(querys, " and "))
-				//列表查询语句
-				findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count"
+			} else {
 				if s.ModuleFlag == EntnicheFlag {
-					findSql += ", IF(a.source is NULL,1,a.source) as  source "
-				}
-				if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
-					findSql += ",a.isvip"
+					//老商机管理个人订阅查询
+					userStr += fmt.Sprintf(" and  a.userid='%s'  and a.product is null", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
+				} else {
+					//个人订阅查询
+					userStr += fmt.Sprintf(" and  a.userid='%s'", common.If(s.ModuleFlag == EntnicheFlag, spqp.EntUserId, common.InterfaceToStr(spqp.NewUserId)))
 				}
-				findSql = fmt.Sprintf("%s from %s  a  where  %s %s "+
-					" order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr)
 			}
-			//查询总数
-			logx.Info("countSql", countSql)
-			count = spqp.BaseServiceMysql.CountBySql(countSql)
-		}
-		if isLimit {
-			findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
-		}
-		logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
-		list := spqp.BaseServiceMysql.SelectBySql(findSql)
-		if list != nil && len(*list) > 0 {
-			pushCas := s.GetJyPushs(*list)
-			if !spqp.Export {
-				result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas, spqp.IsPayUser)
-			} else {
-				result = s.GetOnlyExportInfo(pushCas)
+			//查询数量
+			countSql = fmt.Sprintf("select count(1) as count from %s  a  where 1=1 %s and %s", aboutDbMsg[s.ModuleFlag].MysqlTable, userStr, strings.Join(querys, " and "))
+			//列表查询语句
+			findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,a.attachment_count"
+			if s.ModuleFlag == EntnicheFlag {
+				findSql += ", IF(a.source is NULL,1,a.source) as  source "
 			}
+			if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
+				findSql += ",a.isvip"
+			}
+			findSql = fmt.Sprintf("%s from %s  a  where  %s %s "+
+				" order by a.date desc,a.id desc", findSql, aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "), userStr)
+		}
+		//查询总数
+		logx.Info("countSql", countSql)
+		count = spqp.BaseServiceMysql.CountBySql(countSql)
+	}
+	if isLimit {
+		findSql += fmt.Sprintf(" limit %d,%d", (spqp.PageNum-1)*size, size)
+	}
+	logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
+	list := spqp.BaseServiceMysql.SelectBySql(findSql)
+	if list != nil && len(*list) > 0 {
+		pushCas := s.GetJyPushs(*list)
+		if !spqp.Export {
+			result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas, spqp.IsPayUser)
 		} else {
-			result = []*bxsubscribe.SubscribeInfo{}
+			result = s.GetOnlyExportInfo(pushCas)
 		}
-		return
+	} else {
+		result = []*bxsubscribe.SubscribeInfo{}
 	}
 	return
 }
@@ -1072,11 +1071,11 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 		matchkeys := getKeys(title, keyword)
 		matchkey := strings.Join(matchkeys, " ")
 		subscopeclassStr := ""
-		area := common.If(v["area"] == nil, nil, common.If(common.ObjToString(v["area"]) == "A", 0, common.If(P.PushMapping.Area[common.ObjToString(v["area"])] > 0, P.PushMapping.Area[common.ObjToString(v["area"])], 0)))
-		city := common.If(P.PushMapping.City[common.ObjToString(v["city"])] == 0, nil, P.PushMapping.City[common.ObjToString(v["city"])])
-		subtype := common.If(P.PushMapping.Subtype[common.ObjToString(v["subtype"])] == 0, nil, P.PushMapping.Subtype[common.ObjToString(v["subtype"])])
-		toptype := common.If(P.PushMapping.Toptype[common.ObjToString(v["toptype"])] == 0, nil, P.PushMapping.Toptype[common.ObjToString(v["toptype"])])
-		buyerclass := common.If(P.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] == 0, nil, P.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])])
+		area := common.If(v["area"] == nil, nil, common.If(common.ObjToString(v["area"]) == "A", 0, common.If(P.BidCodeMapping.Area[common.ObjToString(v["area"])] != "", P.BidCodeMapping.Area[common.ObjToString(v["area"])], 0)))
+		city := common.If(P.BidCodeMapping.City[common.ObjToString(v["city"])] != "", nil, P.BidCodeMapping.City[common.ObjToString(v["city"])])
+		subtype := common.If(P.BidCodeMapping.Subtype[common.ObjToString(v["subtype"])] != "", nil, P.BidCodeMapping.Subtype[common.ObjToString(v["subtype"])])
+		toptype := common.If(P.BidCodeMapping.Toptype[common.ObjToString(v["toptype"])] != "", nil, P.BidCodeMapping.Toptype[common.ObjToString(v["toptype"])])
+		buyerclass := common.If(P.BidCodeMapping.Buyerclass[common.ObjToString(v["buyerclass"])] != "", nil, P.BidCodeMapping.Buyerclass[common.ObjToString(v["buyerclass"])])
 		attachment_count := 0
 		if v["isValidFile"] != nil {
 			isValidFile, _ := v["isValidFile"].(bool)
@@ -1087,7 +1086,7 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 		if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
 			subscopeclass := []string{}
 			for _, v := range strings.Split(s_subscopeclass, ",") {
-				if subscopeclass_mapping, ok := P.PushMapping.Subscopeclass[v]; ok {
+				if subscopeclass_mapping, ok := P.BidCodeMapping.Subscopeclass[v]; ok {
 					subscopeclass = append(subscopeclass, fmt.Sprint(subscopeclass_mapping))
 				}
 			}