jianghan7 1 tahun lalu
induk
melakukan
5a1ac024a8

+ 4 - 4
CMPlatform/client/customerRule.go

@@ -3,8 +3,8 @@ package client
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"cmplatform/util"
 	"encoding/json"
@@ -221,7 +221,7 @@ func (c *CustomerRule) ProductData() {
 			totalCount += rangeCount
 		}
 
-		logger.Debug("multi_match", multiMatchcount, s_esquery)
+		log.Debug("multi_match", multiMatchcount, s_esquery)
 		if totalCount > 1000 && (s_startTime == 0 || s_endTime == 0) {
 			c.ServeJson(map[string]interface{}{
 				"rep": false,
@@ -327,7 +327,7 @@ func (this *CustomerRule) DataTest(id string) {
 		"title":  title,
 		"detail": detail,
 	}
-	logger.Debug("测试数据是否匹配开始...")
+	log.Debug("测试数据是否匹配开始...")
 	//加载一个客户
 	customer, _ := util.Mgo.Find("cuserdepartrule", map[string]interface{}{"_id": mongodb.StringTOBsonId(id)}, nil, nil, false, -1, -1)
 	if len(*customer) == 1 {
@@ -506,5 +506,5 @@ func (this *CustomerRule) DataTest(id string) {
 		})
 		return
 	}
-	logger.Debug("测试数据是否匹配结束...")
+	log.Debug("测试数据是否匹配结束...")
 }

+ 3 - 2
CMPlatform/config.json

@@ -9,7 +9,7 @@
   "mongoenc": "winner_enterprise",
   "subday": 15,
   "customer": {
-    "api": "http://web-jytest.jydev.jianyu360.com/api1/user/jy_newuser",
+    "api": "https://jybx3-webtest.jydev.jianyu360.com/api1/user/jy_newuser",
     "mgodb": "192.168.3.206:27080",
     "dbname": "jyqyfw",
     "dbsize": 5
@@ -294,5 +294,6 @@
   "isNewSql": 1,
   "filter_owner_appid": [
   ],
-  "rpcServer": "192.168.3.11:8699"
+  "rpcServer_jy": "192.168.3.206:8699",
+  "rpcServer_project": "192.168.3.206:7979"
 }

+ 1 - 1
CMPlatform/front/front.go

@@ -70,7 +70,7 @@ func (f *Front) Login() {
 				"id":    mongodb.BsonIdToSId((*user)["_id"]),
 			})
 			UserMenu[email] = GetUserMenu(common.ObjToString((*user)["s_role"]))
-			if (*user)["s_role"] == "3" {
+			if common.ObjToString((*user)["s_role"]) == "3" {
 				users, ok := util.Mgo.FindOne("cuser", map[string]interface{}{"s_name": (*user)["s_name"], "b_delete": false})
 				if users != nil && ok {
 					s_id = mongodb.BsonIdToSId((*users)["_id"])

+ 6 - 6
CMPlatform/history/biddingRepeat.go

@@ -2,7 +2,7 @@ package history
 
 import (
 	"app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/logger"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"cmplatform/util"
 	"fmt"
 	"regexp"
@@ -19,7 +19,7 @@ func (this *HistoryData) BiddingRepeat(historyId string) {
 	if common.IntAll((*datatable)["i_datatable"]) > 0 {
 		dbName = "usermail"
 	}
-	logger.Debug("公告去重开始,historyId: ", historyId)
+	log.Debug("公告去重开始,historyId: ", historyId)
 	count_total := util.MgoSave.Count(dbName, map[string]interface{}{"historyId": historyId})
 	msg += "查询条数 " + fmt.Sprintln(count_total)
 	times_start := time.Now().Format("2006-01-02 15:04:05")
@@ -28,9 +28,9 @@ func (this *HistoryData) BiddingRepeat(historyId string) {
 		if ok && data != nil && *data != nil {
 			for _, v := range *data {
 				count += 1
-				logger.Debug("第" + fmt.Sprintln(count) + "条")
+				log.Debug("第" + fmt.Sprintln(count) + "条")
 				if count%500 == 0 {
-					logger.Debug(count)
+					log.Debug(count)
 					msg += fmt.Sprintln(count)
 				}
 				start_time := common.Int64All(v["publishtime"])
@@ -293,7 +293,7 @@ func (this *HistoryData) BiddingRepeat(historyId string) {
 						}
 					}
 					if len(repeat_2_id) > 0 {
-						logger.Debug("有重复数据", repeat_2_id)
+						log.Debug("有重复数据", repeat_2_id)
 						util.MgoSave.UpdateById(dbName, v["_id"], map[string]interface{}{"$set": map[string]interface{}{"used_2": 1, "repeat_2": 1, "repeat_2_id": strings.Join(repeat_2_id, ",")}})
 					}
 				}
@@ -312,7 +312,7 @@ func (this *HistoryData) BiddingRepeat(historyId string) {
 	msg += "重复数据: " + fmt.Sprintln(util.MgoSave.Count(dbName, map[string]interface{}{"historyId": historyId, "repeat_2_data": 1}))
 	times_end := time.Now().Format("2006-01-02 15:04:05")
 	msg += "开始时间: " + times_start + " 结束时间: " + times_end
-	logger.Debug(msg)
+	log.Debug(msg)
 	util.Mgo.UpdateById("historylog", historyId, map[string]interface{}{"$set": map[string]interface{}{"state": 3}})
 	this.ServeJson(map[string]interface{}{"msg": msg})
 }

+ 19 - 19
CMPlatform/history/historytask.go

@@ -2,8 +2,8 @@ package history
 
 import (
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"cmplatform/util"
 	"encoding/json"
@@ -42,10 +42,10 @@ var (
 )
 
 func (this *HistoryData) HistoryTask(history_id string) {
-	logger.Debug("开始历史任务...")
+	log.Debug("开始历史任务...")
 	go UpdateHistoryState(1, history_id, 0)
 	//加载一个客户
-	logger.Debug("history_id", history_id)
+	log.Debug("history_id", history_id)
 	//是否根据项目id去重
 	xlsxData := &XlsxData{}
 	customer, _ := util.Mgo.Find("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(history_id)}, nil, nil, false, -1, -1)
@@ -101,9 +101,9 @@ func (this *HistoryData) HistoryTask(history_id string) {
 		//
 		//if ProjectAppidMap[appId] {
 		if isFilter == 1 {
-			logger.Debug("g根据项目id去重。。。")
+			log.Debug("g根据项目id去重。。。")
 			start := time.Now().Unix()
-			logger.Debug("加载projectId---开始")
+			log.Debug("加载projectId---开始")
 			if dataTable == 0 {
 				InitProjectId(appId)
 			}
@@ -111,7 +111,7 @@ func (this *HistoryData) HistoryTask(history_id string) {
 				InitUsermailProjectId(appId)
 			}
 			end := time.Now().Unix()
-			logger.Debug("加载projectId---结束,耗时", end-start, "秒")
+			log.Debug("加载projectId---结束,耗时", end-start, "秒")
 		} else {
 			projectIdMap = sync.Map{}
 		}
@@ -150,7 +150,7 @@ func (this *HistoryData) HistoryTask(history_id string) {
 		dep_rules := common.ObjArrToMapArr(dep_rule)
 		cus.GetTagRules(tag_rules, tag_rules2, tag_rules3) //获取客户打标签规则
 		cus.GetDepartments("history", dep_rules)           //获取客户信息
-		logger.Debug("customer:", cus.ID, cus.Name, cus.PushModel, cus.AppId, cus.IsTagRule, cus.IsTagRule2, cus.IsTagRule3, cus.IsSearchHosp, cus.IsSearchEnps, len(cus.TagRules), len(cus.TagRules2), len(cus.TagRules3), len(cus.Departments))
+		log.Debug("customer:", cus.ID, cus.Name, cus.PushModel, cus.AppId, cus.IsTagRule, cus.IsTagRule2, cus.IsTagRule3, cus.IsSearchHosp, cus.IsSearchEnps, len(cus.TagRules), len(cus.TagRules2), len(cus.TagRules3), len(cus.Departments))
 		cus.GetData("history", i_dataSource)                                                              //获取数据
 		cus.RemoveRepeatData()                                                                            //数据去重
 		cus.AssembelAndSaveData(history_id, isFilter, noticeFilter, dataTable, entId, iContact, xlsxData) //组装、保存数据
@@ -164,7 +164,7 @@ func (this *HistoryData) HistoryTask(history_id string) {
 		if i_pushtype == 0 {
 			time.Sleep(3 * time.Second)
 			if len(xlsxData.xlsxArr) != xlsxData.xlsxCount {
-				logger.Error("excel数据量错误")
+				log.Error("excel数据量错误")
 			}
 			GetXlsxs(xlsxData.xlsxArr, iContact, customer_name, email, history_id, isfile, isHenanMobile, isfilehref, appId)
 			UpdateHistoryState(2, history_id, xlsxData.xlsxCount)
@@ -177,7 +177,7 @@ func (this *HistoryData) HistoryTask(history_id string) {
 		}
 		projectIdMap = sync.Map{}
 	} else {
-		logger.Error("初始化客户信息失败")
+		log.Error("初始化客户信息失败")
 	}
 }
 
@@ -659,10 +659,10 @@ func (this *HistoryData) DataTest(id string) {
 func UpdateJyqyfwDatacount(appid string, newGetLen int) {
 	update_b := util.MgoCus.Update("user", bson.M{"appid": appid}, bson.M{"$inc": bson.M{"plan.current": -newGetLen}}, false, false)
 	if update_b {
-		logger.Debug("历史数据导入mysql表扣量成功 appid:" + appid + "扣除数据量:" + fmt.Sprintln(newGetLen))
+		log.Debug("历史数据导入mysql表扣量成功 appid:" + appid + "扣除数据量:" + fmt.Sprintln(newGetLen))
 		return
 	}
-	logger.Debug("历史数据导入mysql表扣量失败 appid:" + appid + "应扣除数据量:" + fmt.Sprintln(newGetLen))
+	log.Debug("历史数据导入mysql表扣量失败 appid:" + appid + "应扣除数据量:" + fmt.Sprintln(newGetLen))
 }
 
 func (this *HistoryData) HistoryDelete(hid string) {
@@ -673,10 +673,10 @@ func (this *HistoryData) HistoryDelete(hid string) {
 	}
 	ok := util.Mgo.UpdateById("historylog", mongodb.StringTOBsonId(hid), set)
 	if ok {
-		logger.Debug("历史任务逻辑删除成功", hid)
+		log.Debug("历史任务逻辑删除成功", hid)
 		delOk := util.Mgo.Del("usermail_history", bson.M{"historyId": hid})
 		if delOk {
-			logger.Debug("历史任务下数据总量删除成功")
+			log.Debug("历史任务下数据总量删除成功")
 		}
 	}
 }
@@ -857,7 +857,7 @@ func exactMatch(rule string, data []map[string]interface{}, nameArr []string) bo
 	//可以将编译后的表达式,存放在缓存中
 	program, err := expr.Compile(rule, expr.Env(realdata))
 	if err != nil {
-		logger.Error("表达式错误 ", err)
+		log.Error("表达式错误 ", err)
 		return false
 	}
 
@@ -876,10 +876,10 @@ func exactMatch(rule string, data []map[string]interface{}, nameArr []string) bo
 			}
 		}
 	}
-	logger.Debug("匹配结果 ", realdata)
+	log.Debug("匹配结果 ", realdata)
 	output, err := expr.Run(program, realdata)
 	if err != nil {
-		logger.Error("表达式执行错误 ", err)
+		log.Error("表达式执行错误 ", err)
 		return false
 	}
 	return output.(bool)
@@ -904,7 +904,7 @@ func exactMatchs(rule, title, detail string, match []map[string]string, nameArr
 	//可以将编译后的表达式,存放在缓存中
 	program, err := expr.Compile(rule, expr.Env(realdata))
 	if err != nil {
-		logger.Error("表达式错误 ", err)
+		log.Error("表达式错误 ", err)
 		return false
 	}
 
@@ -927,10 +927,10 @@ func exactMatchs(rule, title, detail string, match []map[string]string, nameArr
 			}
 		}
 	}
-	logger.Debug("匹配结果 ", realdata)
+	log.Debug("匹配结果 ", realdata)
 	output, err := expr.Run(program, realdata)
 	if err != nil {
-		logger.Error("表达式执行错误 ", err)
+		log.Error("表达式执行错误 ", err)
 		return false
 	}
 	return output.(bool)

+ 35 - 35
CMPlatform/history/task.go

@@ -3,7 +3,7 @@ package history
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/logger"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/redis"
 	"cmplatform/util"
@@ -20,7 +20,7 @@ import (
 
 // 获取客户打标签规则
 func (c *Customer) GetTagRules(tagRules, tagRules2, tagRules3 []map[string]interface{}) {
-	logger.Debug("开始加载标签规则...")
+	log.Debug("开始加载标签规则...")
 	defer common.Catch()
 	if len(tagRules) > 0 {
 		c.IsTagRule = true //查到打标签规则,表示打标签
@@ -116,7 +116,7 @@ func (c *Customer) GetTagRules(tagRules, tagRules2, tagRules3 []map[string]inter
 
 // 获取部门信息
 func (c *Customer) GetDepartments(stype string, departments []map[string]interface{}) {
-	logger.Debug("开始获取部门信息...")
+	log.Debug("开始获取部门信息...")
 	defer common.Catch()
 	if len(departments) > 0 {
 		departMap := map[string]interface{}{}
@@ -152,7 +152,7 @@ func (c *Customer) GetDepartments(stype string, departments []map[string]interfa
 
 // 获取数据
 func (c *Customer) GetData(stype string, dataSource int) {
-	logger.Debug("开始匹配数据...")
+	log.Debug("开始匹配数据...")
 	defer common.Catch()
 	esConfig := util.Sysconfig["es"].(map[string]interface{})
 	esversion := common.ObjToString(esConfig["version"])
@@ -162,10 +162,10 @@ func (c *Customer) GetData(stype string, dataSource int) {
 		for {
 			listLen := redis.GetInt("session", "es_status")
 			if listLen == 0 {
-				logger.Debug("es空闲!")
+				log.Debug("es空闲!")
 				break
 			} else if listLen == 1 || listLen == 2 {
-				logger.Debug("es繁忙,", listLen)
+				log.Debug("es繁忙,", listLen)
 			}
 			time.Sleep(5 * time.Second)
 		}
@@ -177,7 +177,7 @@ func (c *Customer) GetData(stype string, dataSource int) {
 				redis.LPOP("datag", "jyqyfw_es_query")
 				break
 			} else {
-				logger.Debug("企业级服务es进程数过多,", listLens)
+				log.Debug("企业级服务es进程数过多,", listLens)
 			}
 			time.Sleep(5 * time.Second)
 		}
@@ -197,8 +197,8 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 				esIndex = util.EsAllIndex
 			}
 			escount := esCon.Count(esIndex, "", sr.EsQuery)
-			logger.Debug("index", esIndex, "type")
-			logger.Debug("查询总数:", escount, "规则ID:", sr.ID, "EsQuery:", sr.EsQuery)
+			log.Debug("index", esIndex, "type")
+			log.Debug("查询总数:", escount, "规则ID:", sr.ID, "EsQuery:", sr.EsQuery)
 			if escount == 0 {
 				continue
 			}
@@ -219,7 +219,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 				count := 1
 				for {
 					if scrollId == "" {
-						logger.Debug("ScrollId Is Error")
+						log.Debug("ScrollId Is Error")
 						break
 					}
 					var searchResult *esV7.SearchResult
@@ -230,14 +230,14 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 						searchResult, err = client.Scroll(esIndex).Size(200).ScrollId(scrollId).Do(ctx) //查询
 						if err != nil {
 							if err.Error() == "EOS" { //迭代完毕
-								logger.Debug("Es Search Data Over:", err)
+								log.Debug("Es Search Data Over:", err)
 							} else {
-								logger.Debug("Es Search Data Error:", err)
+								log.Debug("Es Search Data Error:", err)
 							}
 							break
 						}
 					}
-					logger.Debug("此次处理条数 ", len(searchResult.Hits.Hits))
+					log.Debug("此次处理条数 ", len(searchResult.Hits.Hits))
 					for _, hit := range searchResult.Hits.Hits {
 						//开始处理数据
 						wg.Add(1)
@@ -251,7 +251,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 							if json.Unmarshal(tmpHit.Source, &tmp) == nil {
 								if stype != "history" {
 									if !SkipData(tmp) {
-										logger.Debug("跳过该条数据,发布时间在入库时间7天之前,", common.ObjToString(tmp["_id"]))
+										log.Debug("跳过该条数据,发布时间在入库时间7天之前,", common.ObjToString(tmp["_id"]))
 										return
 									}
 								}
@@ -262,7 +262,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 										bidopentime := common.Int64All(tmp["bidopentime"])
 										comeintime := common.Int64All(tmp["comeintime"])
 										if bidopentime-comeintime <= 7*24*60*60 {
-											logger.Debug("跳过该条数据,开标时间-入库时间<=7天,", id)
+											log.Debug("跳过该条数据,开标时间-入库时间<=7天,", id)
 											return
 										}
 									}
@@ -270,7 +270,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 								//河南移动,过滤掉中国移动采购网招标数据
 								if CheckBidHrefRuleIdMap[dm.ID] {
 									if strings.Contains(common.ObjToString(tmp["href"]), "b2b.10086.cn") {
-										logger.Debug("跳过该条数据,公告原网址中包含 b2b.10086.cn,", id)
+										log.Debug("跳过该条数据,公告原网址中包含 b2b.10086.cn,", id)
 										return
 									}
 								}
@@ -338,7 +338,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 										}
 									}
 									exactResult := exactMatchs(sr.ExactRule, common.ObjToString(tmp["title"]), common.ObjToString(tmp["detail"]), sr.Maths, nameArr)
-									logger.Debug("-------------------精准匹配", id, exactResult)
+									log.Debug("-------------------精准匹配", id, exactResult)
 									if !exactResult {
 										return
 									}
@@ -372,7 +372,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 								/*
 									到此已经匹配完数据
 								*/
-								logger.Debug("---------------------", id, IsMatch)
+								log.Debug("---------------------", id, IsMatch)
 								if IsMatch { //匹配成功,数据上新增规则id,matchKey,item并临时保存数据
 									// tmpMatchKey := MapDataToArr(matchKey)
 									tmpMatchKeyType := MapDataToArr(matchKeyType)
@@ -414,7 +414,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																			tempList = append(tempList, k)
 																		}
 																		tagname = strings.Join(tempList, ",")
-																		logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																		log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																	}
 																	tagNameMap[tagname] = true
 																	tagIdMap[tr.ID] = true
@@ -426,7 +426,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																		tempList = append(tempList, k)
 																	}
 																	tagname = strings.Join(tempList, ",")
-																	logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																	log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																}
 																tagNameMap[tagname] = true
 																tagIdMap[tr.ID] = true
@@ -467,7 +467,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 												matchKeyTypeTag := map[string]bool{} //记录标签里的关键词对应的匹配方式
 												//common.Debug("-------------------------开始排除词匹配--------------------------")
 												for j, tag_nw := range tr.NW { //排除词匹配
-													logger.Debug("打标签2222tag_nw ", tag_nw, fieldText)
+													log.Debug("打标签2222tag_nw ", tag_nw, fieldText)
 													IsMatchNotKey := RegMatch(fieldText, tag_nw.MatchType, tag_nw.KeyReg, nil, nil, false, false)
 													if !IsMatchNotKey { //排除词未匹配,匹配附加词关键词
 														if RegMatch(fieldText, tr.AW[j].MatchType, tr.AW[j].KeyReg, nil, nil, false, true) && RegMatch(fieldText, tr.KW[j].MatchType, tr.KW[j].KeyReg, matchKeyTag, matchKeyTypeTag, true, false) {
@@ -481,7 +481,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																			tempList = append(tempList, k)
 																		}
 																		tagname = strings.Join(tempList, ",")
-																		logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																		log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																	}
 																	tagNameMap[tagname] = true
 																	tagIdMap[tr.ID] = true
@@ -493,7 +493,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																		tempList = append(tempList, k)
 																	}
 																	tagname = strings.Join(tempList, ",")
-																	logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																	log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																}
 																tagNameMap[tagname] = true
 																tagIdMap[tr.ID] = true
@@ -547,7 +547,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																			tempList = append(tempList, k)
 																		}
 																		tagname = strings.Join(tempList, ",")
-																		logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																		log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																	}
 																	tagNameMap[tagname] = true
 																	tagIdMap[tr.ID] = true
@@ -559,7 +559,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 																		tempList = append(tempList, k)
 																	}
 																	tagname = strings.Join(tempList, ",")
-																	logger.Debug("=====tagname为空取匹配词为标签名称", tagname)
+																	log.Debug("=====tagname为空取匹配词为标签名称", tagname)
 																}
 																tagNameMap[tagname] = true
 																tagIdMap[tr.ID] = true
@@ -614,7 +614,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 						}(hit)
 						numDocs += 1
 						if numDocs%500 == 0 {
-							logger.Debug("Current:", numDocs)
+							log.Debug("Current:", numDocs)
 						}
 					}
 					scrollId = searchResult.ScrollId
@@ -622,9 +622,9 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 				}
 				wg.Wait()
 				client.ClearScroll().ScrollId(scrollId).Do(ctx) //清理游标
-				logger.Debug("SearchRule ID", sr.ID, "Result Data Count:", numDocs)
+				log.Debug("SearchRule ID", sr.ID, "Result Data Count:", numDocs)
 			} else {
-				logger.Debug("Customer:", c.Name, "Departmnet", dm.Name, "TagName", sr.Name, "Es Search Data Error,Tag ID:", sr.ID)
+				log.Debug("Customer:", c.Name, "Departmnet", dm.Name, "TagName", sr.Name, "Es Search Data Error,Tag ID:", sr.ID)
 			}
 		}
 	}
@@ -632,7 +632,7 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.E
 
 // 数据去重
 func (c *Customer) RemoveRepeatData() {
-	logger.Debug("开始数据去重...")
+	log.Debug("开始数据去重...")
 	defer common.Catch()
 	for _, dm := range c.Departments {
 		for _, dataMapArr := range dm.DepartmentData { //一个部门的所有数据
@@ -684,7 +684,7 @@ func (c *Customer) RemoveRepeatData() {
 
 // 组装保存数据
 func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter, dataTable, entId, i_contact int, xlsxData *XlsxData) {
-	logger.Debug("开始组装保存数据...")
+	log.Debug("开始组装保存数据...")
 	defer common.Catch()
 	ch := make(chan bool, 10)
 	wg := &sync.WaitGroup{}
@@ -705,7 +705,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 			}(tmp)
 			n++
 			if n%500 == 0 {
-				logger.Debug("Current:", n)
+				log.Debug("Current:", n)
 			}
 		}
 		wg.Wait()
@@ -726,7 +726,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 					}(tmp)
 					n++
 					if n%500 == 0 {
-						logger.Debug("Current:", n)
+						log.Debug("Current:", n)
 					}
 				}
 			}
@@ -752,7 +752,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 		}
 		wg.Wait()
 	}*/
-	logger.Debug("数据保存完毕...		Save Number:", n)
+	log.Debug("数据保存完毕...		Save Number:", n)
 }
 
 // 获取用户所有规则
@@ -851,10 +851,10 @@ func (sr *SearchRule) GetEs(department, esquery string, tmpRange bson.M) {
 		if err == nil {
 			sr.EsQuery = string(strquery)
 		} else {
-			logger.Debug("Department:", department, "Es Error,Tag ID:", sr.ID)
+			log.Debug("Department:", department, "Es Error,Tag ID:", sr.ID)
 		}
 	} else {
-		logger.Debug("Department:", department, "Es Error,Tag ID:", sr.ID)
+		log.Debug("Department:", department, "Es Error,Tag ID:", sr.ID)
 	}
 }
 

+ 87 - 87
CMPlatform/history/util_history.go

@@ -3,7 +3,7 @@ package history
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/logger"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/mail"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/redis"
@@ -255,7 +255,7 @@ func GetIdRange() (bson.M, bool) {
 				return tmpRange, true
 			}
 		} else { //结束id不大于起始id 退出
-			logger.Debug("Search End ID Range Error. Sid:", util.LatestId, "Eid:", endId)
+			log.Debug("Search End ID Range Error. Sid:", util.LatestId, "Eid:", endId)
 			break
 		}
 	}
@@ -295,11 +295,11 @@ func GetIdRange() (bson.M, bool) {
 	// 		LatestId = endId
 	// 		return tmpRange, true
 	// 	} else {
-	// 		logger.Debug("ID Range Error,Start ID:", LatestId, "End ID:", endId)
+	// 		log.Debug("ID Range Error,Start ID:", LatestId, "End ID:", endId)
 	// 		return bson.M{}, false
 	// 	}
 	// }
-	// logger.Debug("Search End ID No Data", query, "Error:", err)
+	// log.Debug("Search End ID No Data", query, "Error:", err)
 
 }
 
@@ -489,7 +489,7 @@ func MergeDatas(history, tmp map[string]interface{}, isTagRule, isDepartRmvRep b
 	item2 := common.ObjToString(tmp["item"])
 	history["item"] = MergeField(item1, item2)
 	history["itemdist"].(map[string]interface{})[item2] = matchkey2
-	logger.Debug("组装后的item:", history["item"], history["itemdist"])
+	log.Debug("组装后的item:", history["item"], history["itemdist"])
 
 	if isTagRule { //标签模式 tagname、tagid合并
 		tagname1 := common.ObjToString(history["tagname"])
@@ -566,9 +566,9 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 	if dataTable == 2 {
 		isExist, err := redis.Exists("other", "entexportdata_"+id+"_"+fmt.Sprintln(entId))
 		if err != nil {
-			logger.Debug("企业订阅数据导出redis判重失败")
+			log.Debug("企业订阅数据导出redis判重失败")
 		} else if isExist {
-			logger.Debug("数据重复,id ", id, "entid ", entId)
+			log.Debug("数据重复,id ", id, "entid ", entId)
 			return
 		}
 	}
@@ -597,7 +597,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 			if !isOk {
 				util.MgoSave.Save(util.SaveCollProject, tmp)
 			}
-			logger.Debug("项目id去重,项目id:", projectId, isOk)
+			log.Debug("项目id去重,项目id:", projectId, isOk)
 		}
 	} else {
 		tmp["projectId"] = ""
@@ -744,7 +744,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 							}
 						}
 					}
-					logger.Debug("查询附件结果:", id, "附件数量:", len(filesArr))
+					log.Debug("查询附件结果:", id, "附件数量:", len(filesArr))
 					if len(filesArr) > 0 {
 						if FilterFilehrefAppidMap[appid] {
 							filesArrs := []map[string]interface{}{}
@@ -801,7 +801,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 								}
 							}
 						}
-						logger.Debug("查询附件结果:", id, "附件数量:", len(filesArr))
+						log.Debug("查询附件结果:", id, "附件数量:", len(filesArr))
 						if len(filesArr) > 0 {
 							if FilterFilehrefAppidMap[appid] {
 								filesArrs := []map[string]interface{}{}
@@ -982,7 +982,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 	}
 	if noticeFilter == 1 && (dataTable == 0 || dataTable == 1) && isOk {
 		ok := checkBidId(appid, id, dataTable)
-		logger.Debug("公告去重结果", id, dataTable, ok)
+		log.Debug("公告去重结果", id, dataTable, ok)
 		if !ok {
 			isOk = false
 			tmp["chongfu"] = id
@@ -1245,7 +1245,7 @@ func SaveMgo() {
 
 // 数据存库
 func SaveUsermailMgo() {
-	logger.Debug("Mgo Save Usermail...")
+	log.Debug("Mgo Save Usermail...")
 	arru := make([]map[string]interface{}, 500)
 	indexu := 0
 	counts := 0
@@ -1284,84 +1284,84 @@ func SaveUsermailMgo() {
 
 // 打印初始化信息
 func PrintLog(cus *Customer) {
-	logger.Debug("----------------------打标签规则----------------------------")
+	log.Debug("----------------------打标签规则----------------------------")
 	for i, tr := range cus.TagRules {
-		logger.Debug("tagrules:", i, tr.ID, tr.Name, tr.CustomerId, tr.DepartRuleIds, tr.Fields)
+		log.Debug("tagrules:", i, tr.ID, tr.Name, tr.CustomerId, tr.DepartRuleIds, tr.Fields)
 		for j, kw := range tr.KW {
-			logger.Debug("kw_matchkey---", kw.MatchType, len(kw.MatchType))
-			logger.Debug("------------CReg--------------")
+			log.Debug("kw_matchkey---", kw.MatchType, len(kw.MatchType))
+			log.Debug("------------CReg--------------")
 			for ck1, cr := range kw.KeyReg.CReg {
-				logger.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
+				log.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
 			}
-			logger.Debug("------------AReg--------------")
+			log.Debug("------------AReg--------------")
 			for ck1, ar := range kw.KeyReg.AReg {
-				logger.Debug("AR---", ck1, ar.CsVal)
+				log.Debug("AR---", ck1, ar.CsVal)
 				for _, arc := range ar.AndRegKid {
-					logger.Debug("ARC---", arc.CrVal, arc.IsLetter)
+					log.Debug("ARC---", arc.CrVal, arc.IsLetter)
 				}
 			}
-			logger.Debug("+++++++++++++++++++++AW++++++++++++++++++++++")
-			logger.Debug("aw_matchkey---", tr.AW[j].MatchType, len(tr.AW[j].MatchType))
-			logger.Debug("------------CReg--------------")
+			log.Debug("+++++++++++++++++++++AW++++++++++++++++++++++")
+			log.Debug("aw_matchkey---", tr.AW[j].MatchType, len(tr.AW[j].MatchType))
+			log.Debug("------------CReg--------------")
 			for ck2, cr := range tr.AW[j].KeyReg.CReg {
-				logger.Debug("CR---", ck2, cr.CrVal, cr.CsVal, cr.IsLetter)
+				log.Debug("CR---", ck2, cr.CrVal, cr.CsVal, cr.IsLetter)
 			}
-			logger.Debug("------------AReg--------------")
+			log.Debug("------------AReg--------------")
 			for ck2, ar := range tr.AW[j].KeyReg.AReg {
-				logger.Debug("AR---", ck2, ar.CsVal)
+				log.Debug("AR---", ck2, ar.CsVal)
 				for _, arc := range ar.AndRegKid {
-					logger.Debug("ARC---", arc.CrVal, arc.IsLetter)
+					log.Debug("ARC---", arc.CrVal, arc.IsLetter)
 				}
 			}
-			logger.Debug("++++++++++++++++++++NW+++++++++++++++++++++++")
-			logger.Debug("nw_matchkey---", tr.NW[j].MatchType, len(tr.NW[j].MatchType))
-			logger.Debug("------------CReg--------------")
+			log.Debug("++++++++++++++++++++NW+++++++++++++++++++++++")
+			log.Debug("nw_matchkey---", tr.NW[j].MatchType, len(tr.NW[j].MatchType))
+			log.Debug("------------CReg--------------")
 			for ck1, cr := range tr.NW[j].KeyReg.CReg {
-				logger.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
+				log.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
 			}
-			logger.Debug("------------AReg--------------")
+			log.Debug("------------AReg--------------")
 			for ck1, ar := range tr.NW[j].KeyReg.AReg {
-				logger.Debug("AR---", ck1, ar.CsVal)
+				log.Debug("AR---", ck1, ar.CsVal)
 				for _, arc := range ar.AndRegKid {
-					logger.Debug("ARC---", arc.CrVal, arc.IsLetter)
+					log.Debug("ARC---", arc.CrVal, arc.IsLetter)
 				}
 			}
-			logger.Debug("tagname-------------", tr.TagNames[j])
-			logger.Debug("-------------------------------------------------")
+			log.Debug("tagname-------------", tr.TagNames[j])
+			log.Debug("-------------------------------------------------")
 		}
 	}
-	logger.Debug("----------------------查询规则----------------------------")
+	log.Debug("----------------------查询规则----------------------------")
 	for i, dm := range cus.Departments {
-		logger.Debug("deparment:", i, dm.ID, dm.Name, dm.CustomerID)
+		log.Debug("deparment:", i, dm.ID, dm.Name, dm.CustomerID)
 		for j, sr := range dm.Rules {
-			logger.Debug("ck---", j, sr.ID, sr.Name, sr.CustomerID, sr.DepartmentID, sr.GCW.KeyReg, len(sr.GCW.KeyReg), sr.GCW.MatchType, len(sr.GCW.MatchType), sr.Fields, len(sr.Fields), sr.EsQuery)
+			log.Debug("ck---", j, sr.ID, sr.Name, sr.CustomerID, sr.DepartmentID, sr.GCW.KeyReg, len(sr.GCW.KeyReg), sr.GCW.MatchType, len(sr.GCW.MatchType), sr.Fields, len(sr.Fields), sr.EsQuery)
 			for j, kw := range sr.KW {
-				logger.Debug("kw_matchkey---", kw.MatchType, len(kw.MatchType))
-				logger.Debug("------------CReg--------------")
+				log.Debug("kw_matchkey---", kw.MatchType, len(kw.MatchType))
+				log.Debug("------------CReg--------------")
 				for ck1, cr := range kw.KeyReg.CReg {
-					logger.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
+					log.Debug("CR---", ck1, cr.CrVal, cr.CsVal, cr.IsLetter)
 				}
-				logger.Debug("------------AReg--------------")
+				log.Debug("------------AReg--------------")
 				for ck1, ar := range kw.KeyReg.AReg {
-					logger.Debug("AR---", ck1, ar.CsVal)
+					log.Debug("AR---", ck1, ar.CsVal)
 					for _, arc := range ar.AndRegKid {
-						logger.Debug("ARC---", arc.CrVal, arc.IsLetter)
+						log.Debug("ARC---", arc.CrVal, arc.IsLetter)
 					}
 				}
-				logger.Debug("+++++++++++++++++++++AW++++++++++++++++++++++")
-				logger.Debug("aw_matchkey---", sr.AW[j].MatchType, len(sr.AW[j].MatchType))
-				logger.Debug("------------CReg--------------")
+				log.Debug("+++++++++++++++++++++AW++++++++++++++++++++++")
+				log.Debug("aw_matchkey---", sr.AW[j].MatchType, len(sr.AW[j].MatchType))
+				log.Debug("------------CReg--------------")
 				for ck2, cr := range sr.AW[j].KeyReg.CReg {
-					logger.Debug("CR---", ck2, cr.CrVal, cr.CsVal, cr.IsLetter)
+					log.Debug("CR---", ck2, cr.CrVal, cr.CsVal, cr.IsLetter)
 				}
-				logger.Debug("------------AReg--------------")
+				log.Debug("------------AReg--------------")
 				for ck2, ar := range sr.AW[j].KeyReg.AReg {
-					logger.Debug("AR---", ck2, ar.CsVal)
+					log.Debug("AR---", ck2, ar.CsVal)
 					for _, arc := range ar.AndRegKid {
-						logger.Debug("ARC---", arc.CrVal, arc.IsLetter)
+						log.Debug("ARC---", arc.CrVal, arc.IsLetter)
 					}
 				}
-				logger.Debug("--------------------------------------------------------------------------------------")
+				log.Debug("--------------------------------------------------------------------------------------")
 			}
 		}
 	}
@@ -1370,25 +1370,25 @@ func PrintLog(cus *Customer) {
 // 匹配
 func RegMatchTest(fieldText map[string]interface{}, matchType []string, matchReg *Reg, matchKey map[string]bool, matchKeyType map[string]bool, goon, isAddWord bool) (match bool) {
 	defer common.Catch()
-	logger.Debug("matchType---", matchType)
+	log.Debug("matchType---", matchType)
 	if len(matchType) == 0 && isAddWord { //特殊处理附加词为空的情况
 		match = true
 		return
 	}
 	for _, mt := range matchType {
 		if text := common.ObjToString(fieldText[mt]); text != "" {
-			logger.Debug("匹配方式---", mt, "text---", text)
-			logger.Debug("--------------开始查找逗号分隔----------------", len(matchReg.CReg))
+			log.Debug("匹配方式---", mt, "text---", text)
+			log.Debug("--------------开始查找逗号分隔----------------", len(matchReg.CReg))
 			for i, cr := range matchReg.CReg { //逗号分隔,任意一个匹配表示匹配成功
-				logger.Debug("iiii---", i, cr.CrVal, goon, matchKey)
+				log.Debug("iiii---", i, cr.CrVal, goon, matchKey)
 				if goon && matchKey[cr.CsVal] { //matchkey已存在不在匹配
 					continue
 				}
 				if indexArr := cr.CrVal.FindAllStringIndex(text, -1); len(indexArr) > 0 { //匹配成功
 					if !cr.IsLetter { //reg无字母
-						logger.Debug("goon---", goon)
+						log.Debug("goon---", goon)
 						if goon {
-							logger.Debug("key++++++++++ ++++++++++", cr.CsVal)
+							log.Debug("key++++++++++ ++++++++++", cr.CsVal)
 							matchKey[cr.CsVal] = true
 							matchKeyType[mt] = true
 							match = true
@@ -1397,9 +1397,9 @@ func RegMatchTest(fieldText map[string]interface{}, matchType []string, matchReg
 							return
 						}
 					} else if cr.IsLetter && CheckLetter(text, cr.CrVal, indexArr) { //reg有字母,判断是否是包含关系(AAAIBBB or AI){//
-						logger.Debug("goon---", goon)
+						log.Debug("goon---", goon)
 						if goon {
-							logger.Debug("key++++++++++++++++++++", cr.CsVal)
+							log.Debug("key++++++++++++++++++++", cr.CsVal)
 							matchKey[cr.CsVal] = true
 							matchKeyType[mt] = true
 							match = true
@@ -1410,16 +1410,16 @@ func RegMatchTest(fieldText map[string]interface{}, matchType []string, matchReg
 					}
 				}
 			}
-			logger.Debug("--------------开始查找&&分隔----------------", len(matchReg.AReg))
+			log.Debug("--------------开始查找&&分隔----------------", len(matchReg.AReg))
 			for j, ar := range matchReg.AReg { //&&分割,所有匹配表示匹配成功
-				logger.Debug("jjjj---", j, ar.CsVal, goon, matchKey)
+				log.Debug("jjjj---", j, ar.CsVal, goon, matchKey)
 				if goon && matchKey[ar.CsVal] {
 					continue
 				}
 				IsAregMatch := false
-				logger.Debug("ar.AndRegKid---", j, ar.AndRegKid, len(ar.AndRegKid))
+				log.Debug("ar.AndRegKid---", j, ar.AndRegKid, len(ar.AndRegKid))
 				for n, arc := range ar.AndRegKid { //ar.AndRegKid若有值必不小于2
-					logger.Debug("nnnn---", n, arc.CrVal, arc.IsLetter)
+					log.Debug("nnnn---", n, arc.CrVal, arc.IsLetter)
 					if indexArr := arc.CrVal.FindAllStringIndex(text, -1); len(indexArr) < 1 { //匹配失败(ar.AndRegKid中任意一个未匹配则失败)
 						break
 					} else { //匹配成功,判断字母
@@ -1431,11 +1431,11 @@ func RegMatchTest(fieldText map[string]interface{}, matchType []string, matchReg
 						IsAregMatch = true
 					}
 				}
-				logger.Debug("IsAregMatch---", IsAregMatch)
+				log.Debug("IsAregMatch---", IsAregMatch)
 				if IsAregMatch {
-					logger.Debug("goon---", goon)
+					log.Debug("goon---", goon)
 					if goon {
-						logger.Debug("key++++++++++++++++++++", ar.CsVal)
+						log.Debug("key++++++++++++++++++++", ar.CsVal)
 						matchKey[ar.CsVal] = true
 						matchKeyType[mt] = true
 						match = true
@@ -1500,7 +1500,7 @@ func GetXlsxs(mMap []map[string]interface{}, i_contact int, fn, email, id string
 			if dataSource == 1 {
 				xf, err := xlsx.OpenFile("web/res/fields.xlsx")
 				if err != nil {
-					logger.Error("fields file not foud", err.Error())
+					log.Error("fields file not foud", err.Error())
 				}
 				style := xlsx.NewStyle()
 				style.Font.Size = 12
@@ -2228,21 +2228,21 @@ func GetXlsxs(mMap []map[string]interface{}, i_contact int, fn, email, id string
 				if b, _ := PathExists(dir); !b {
 					err1 := os.MkdirAll(dir, os.ModePerm)
 					if err1 != nil {
-						logger.Debug("mkdir err", dir)
+						log.Debug("mkdir err", dir)
 					}
 					//fname := t + ".xlsx"
 				}
 				fname := fmt.Sprintf("%s_%s_%s.xlsx", fn, t, common.GetRandom(4))
-				logger.Debug("fname", fname)
+				log.Debug("fname", fname)
 				err = xf.Save(dir + fname)
 				if err != nil {
-					logger.Debug("xls error", fname)
+					log.Debug("xls error", fname)
 				} else {
 					for i := 0; i < len(Gmails); i++ {
 						gmail := Gmails[i]
 						status := mail.GSendMail_q("剑鱼标讯", email, "", "", fn, "", dir+fname, fname, gmail)
 						if status {
-							logger.Debug("send mail success", fname, email)
+							log.Debug("send mail success", fname, email)
 							break
 						}
 					}
@@ -2250,7 +2250,7 @@ func GetXlsxs(mMap []map[string]interface{}, i_contact int, fn, email, id string
 			} else {
 				xf, err := xlsx.OpenFile("web/res/full_field.xlsx")
 				if err != nil {
-					logger.Debug("fields file not foud", err.Error())
+					log.Debug("fields file not foud", err.Error())
 				}
 				style := xlsx.NewStyle()
 				style.Font.Size = 12
@@ -2281,21 +2281,21 @@ func GetXlsxs(mMap []map[string]interface{}, i_contact int, fn, email, id string
 				if b, _ := PathExists(dir); !b {
 					err1 := os.MkdirAll(dir, os.ModePerm)
 					if err1 != nil {
-						logger.Debug("mkdir err", dir)
+						log.Debug("mkdir err", dir)
 					}
 				}
 				//fname := t + ".xlsx"
 				fname := fmt.Sprintf("%s_%s_%s.xlsx", fn, t, common.GetRandom(4))
-				logger.Debug("fname", fname)
+				log.Debug("fname", fname)
 				err = xf.Save(dir + fname)
 				if err != nil {
-					logger.Debug("xls error", fname)
+					log.Debug("xls error", fname)
 				} else {
 					for i := 0; i < len(Gmails); i++ {
 						gmail := Gmails[i]
 						status := mail.GSendMail_q("剑鱼标讯", email, "", "", fn, "", dir+fname, fname, gmail)
 						if status {
-							logger.Debug("send mail success", fname, email)
+							log.Debug("send mail success", fname, email)
 							break
 						}
 					}
@@ -2338,10 +2338,10 @@ func GetProjectId(id string) (string, int64, int64) {
 			}
 		}
 		projectId = strings.Join(projectIdArr, ",")
-		logger.Debug("projectId", projectId)
+		log.Debug("projectId", projectId)
 		//
 	} else {
-		logger.Debug("ES未查到项目id", id)
+		log.Debug("ES未查到项目id", id)
 	}
 	return projectId, zbtime, yitime
 }
@@ -2351,7 +2351,7 @@ func InitProjectId(appid string) {
 	count := 0
 	defer func() {
 		util.MgoSave.DestoryMongoConn(session)
-		logger.Debug("本次共取到%d个projectId\n", count)
+		log.Debug("本次共取到%d个projectId\n", count)
 	}()
 	save := util.Sysconfig["save"].(map[string]interface{})
 	query := map[string]interface{}{"appid": appid}
@@ -2376,7 +2376,7 @@ func InitUsermailProjectId(appid string) {
 	count := 0
 	defer func() {
 		util.MgoCus.DestoryMongoConn(session)
-		logger.Debug("本次共取到%d个projectId\n", count)
+		log.Debug("本次共取到%d个projectId\n", count)
 	}()
 	customer := util.Sysconfig["customer"].(map[string]interface{})
 	query := map[string]interface{}{"appid": appid}
@@ -2401,14 +2401,14 @@ func checkBidId(appid, id string, dataTable int) bool {
 	if dataTable == 1 {
 		countData, ok := util.MgoSave.FindOne(util.SaveUserMail, map[string]interface{}{"appid": appid, "id": id})
 		if ok && countData != nil && len(*countData) > 0 {
-			logger.Debug("用户 ", appid, " 在 ", util.SaveUserMail, " 中找到重复公告id ", id)
+			log.Debug("用户 ", appid, " 在 ", util.SaveUserMail, " 中找到重复公告id ", id)
 			isOk = false
 		}
 	}
 	if dataTable == 0 {
 		countData, ok := util.MgoSave.FindOne(util.SaveColl, map[string]interface{}{"appid": appid, "id": id})
 		if ok && countData != nil && len(*countData) > 0 {
-			logger.Debug("用户 ", appid, " 在 ", util.SaveColl, " 中找到重复公告id ", id)
+			log.Debug("用户 ", appid, " 在 ", util.SaveColl, " 中找到重复公告id ", id)
 			isOk = false
 		}
 	}
@@ -2475,7 +2475,7 @@ func GetWinnerStyle(s_winner string, v map[string]interface{}) {
 		for _, vw := range strings.Split(s_winner, ",") {
 			//j := 1
 			for _, key := range keyList {
-				logger.Debug("中标类型匹配", key)
+				log.Debug("中标类型匹配", key)
 				vvs := util.Sysconfig["winner_style_match"].(map[string]interface{})[key].(map[string]interface{})
 				keyWord := common.ObjToString(vvs["keyWord"])
 				name := common.ObjToString(vvs["name"])
@@ -2507,7 +2507,7 @@ func GetWinnerStyle(s_winner string, v map[string]interface{}) {
 				}
 			}
 		}
-		logger.Debug("中标类型:", wname)
+		log.Debug("中标类型:", wname)
 		v["winner_style"] = wname
 	} else {
 		v["winner_style"] = ""
@@ -2558,7 +2558,7 @@ func saveMysqlPush(tmp map[string]interface{}, entId int) bool {
 	}
 	b := util.JyMysql.Insert("pushentniche", saveMap)
 	if b <= 0 {
-		logger.Debug("数据插入pushentniche表失败,id ", common.ObjToString(tmp["id"]), "entid ", entId)
+		log.Debug("数据插入pushentniche表失败,id ", common.ObjToString(tmp["id"]), "entid ", entId)
 		return false
 	} else {
 		redis.Put("other", "entexportdata_"+infoid+"_"+fmt.Sprintln(entId), 1, -1)

+ 3 - 1
CMPlatform/main.go

@@ -45,7 +45,7 @@ func init() {
 	xweb.AddAction(&push.Push{})
 	xweb.AddAction(&service.Groups{})
 	xweb.RootApp().AppConfig.SessionTimeout = 24 * time.Hour
-	xweb.RootApp().Logger.SetOutputLevel(3)
+	xweb.RootApp().Logger.SetOutputLevel(1)
 	//go history.SaveMgo()
 	//go history.SaveUsermailMgo()
 	//mails, _ := util.Sysconfig["mail"].([]interface{})
@@ -105,6 +105,8 @@ func initOther() {
 }
 
 func main() {
+
 	log.Println("port:", util.Sysconfig["port"])
 	xweb.Run(":" + common.ObjToString(util.Sysconfig["port"]))
+
 }

+ 19 - 19
CMPlatform/push/push.go

@@ -3,8 +3,8 @@ package push
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/redis"
 	"cmplatform/util"
 	"encoding/json"
@@ -72,20 +72,20 @@ func (this *Push) DataPush() {
 	} else if getDataType == "1" {
 		dataMap["dataList"] = ExcelParse(dataType)
 	}
-	logger.Debug(dataMap)
+	log.Debug(dataMap)
 	databyte, _ := json.Marshal(dataMap)
 	dataStr := string(databyte)
 	//
 	token := getAccessToken()
 	// token := "f9cb92a6-356b-433f-a8bd-09f1deef6d52"
-	logger.Debug("token111:", token)
+	log.Debug("token111:", token)
 	//
 	tokens := getAccessTokens(token)
-	logger.Debug("token222:", tokens)
+	log.Debug("token222:", tokens)
 	//
 	dataStr = strings.ReplaceAll(dataStr, `"`, `\"`)
 	data := `{"access_token":"` + tokens + `","postjson":"` + dataStr + `"}`
-	logger.Debug("data:", data)
+	log.Debug("data:", data)
 	dataTypes := ""
 	if dataType == "0" {
 		dataTypes = "JY_TO_DICT_fishBid2"
@@ -93,7 +93,7 @@ func (this *Push) DataPush() {
 		dataTypes = "JY_TO_DICT_WinBid2"
 	}
 	apiurl := "http://111.7.112.55:20110/oppf?method=" + dataTypes + "&appId=1068246&appKey=15c1da231a946f9615ee9d56138952a2&format=json&busiSerial=1&OPCODE=A888888&version=1.0&accessToken=" + tokens + "&timestamp=" + fmt.Sprint(time.Now().Format("20060102150405")) + "&sign=abc"
-	logger.Debug("apiurl:", apiurl)
+	log.Debug("apiurl:", apiurl)
 	errstr := ""
 	response, err := util.HttpPostJson(apiurl, data)
 	result := map[string]interface{}{}
@@ -101,18 +101,18 @@ func (this *Push) DataPush() {
 		errstr = string(response)
 		resMap := common.ObjToMap(string(response))
 		result = *resMap
-		logger.Debug("响应信息 ", *resMap)
+		log.Debug("响应信息 ", *resMap)
 		if resMap != nil && *resMap != nil {
 			respCode := common.ObjToString((*resMap)["respCode"])
 			if respCode == "00000" {
-				logger.Debug("成功")
+				log.Debug("成功")
 			} else {
-				logger.Debug("异常")
+				log.Debug("异常")
 			}
 		}
 	} else {
 		errstr = "响应失败 " + err.Error()
-		logger.Debug("响应失败 ", err)
+		log.Debug("响应失败 ", err)
 	}
 	util.MgoSave.Save("dataPushLog", map[string]interface{}{
 		"dataLenth":   len(dataMap["dataList"]),
@@ -181,21 +181,21 @@ func getAccessToken() string {
 		bs, err := util.HttpPostForm(apiurls, map[string]string{
 			"timestamp": fmt.Sprint(now),
 		}, data)
-		logger.Debug("返回内容", err, string(bs))
+		log.Debug("返回内容", err, string(bs))
 		resMap := common.ObjToMap(string(bs))
 		if *resMap != nil {
-			logger.Debug("调用token成功 ", *resMap)
+			log.Debug("调用token成功 ", *resMap)
 			token := common.ObjToString((*resMap)["access_token"])
 			if token != "" {
-				logger.Debug("成功")
+				log.Debug("成功")
 				redis.Put("datag", "yidongtoken1", token, 60*60*24)
 				return token
 			} else {
-				logger.Debug("异常")
+				log.Debug("异常")
 				return ""
 			}
 		} else {
-			logger.Debug("调用token失败")
+			log.Debug("调用token失败")
 			return ""
 		}
 	}
@@ -207,7 +207,7 @@ func getAccessTokens(token string) string {
 		return res
 	} else {
 		apiurls := "http://111.7.112.55:20110/oppf?method=JY_TO_DICT_TOKEN&appId=1068246&appKey=15c1da231a946f9615ee9d56138952a2&format=json&busiSerial=1&OPCODE=A888888&version=1.0&accessToken=" + token + "&timestamp=" + fmt.Sprint(time.Now().Format("20060102150405")) + "&sign=abc"
-		logger.Debug("EPMtokenapiurl:", apiurls)
+		log.Debug("EPMtokenapiurl:", apiurls)
 		grant_type := "client_credentials"
 		scope := "all"
 		client_id := "jianyu_client"
@@ -220,17 +220,17 @@ func getAccessTokens(token string) string {
 		bytestr, _ := json.Marshal(data)
 		bs, err := util.HttpPostJson(apiurls, string(bytestr))
 		if err != nil {
-			logger.Debug("调用 token 失败", err)
+			log.Debug("调用 token 失败", err)
 		}
 		resMap := common.ObjToMap(string(bs))
 		if *resMap != nil {
-			logger.Debug("调用token成功 ", *resMap)
+			log.Debug("调用token成功 ", *resMap)
 			resMaps := common.ObjToMap((*resMap)["result"])
 			jsonMap := common.ObjToMap((*resMaps)["response"])
 			redis.Put("datag", "yidongtoken2", common.ObjToString((*jsonMap)["access_token"]), 7200)
 			return common.ObjToString((*jsonMap)["access_token"])
 		} else {
-			logger.Debug("调用token失败")
+			log.Debug("调用token失败")
 			return ""
 		}
 	}

+ 24 - 17
CMPlatform/service/customer_service.go

@@ -3,8 +3,8 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"cmplatform/util"
 	"encoding/json"
@@ -122,7 +122,7 @@ func (c *Customer) CustomerEdit() {
 	depart, _ := util.Mgo.Find("cuserdepart", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
 	(*data)["_id"] = mongodb.BsonIdToSId((*data)["_id"])
 	tagRule, tagRule2, tagRule3 := []map[string]interface{}{}, []map[string]interface{}{}, []map[string]interface{}{}
-	if (*data)["i_state"] == 1 {
+	if common.IntAll((*data)["i_state"]) == 1 {
 		tagRules, _ := util.Mgo.Find("eusertagrule", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
 		if tagRules != nil && len(*tagRules) > 0 {
 			for _, v := range *tagRules {
@@ -182,12 +182,13 @@ func (c *Customer) CustomerSave() {
 			data["i_state"] = 0
 			// 有手机号客户 注册企业
 			if ph := common.ObjToString(data["s_phone"]); ph != "" {
-				if id := createCusRpc(common.ObjToString(data["s_name"]), ph); id == 0 {
-					logger.Error("createCusRpc:", "创建企业失败")
+				if eid := createCusRpc(common.ObjToString(data["s_name"]), ph); eid == 0 {
+					log.Error("createCusRpc:", "创建企业失败")
 				} else {
-					data["i_entid"] = id
+					data["i_entid"] = eid
 				}
 			}
+			log.Debug(data)
 			id = util.Mgo.Save("cuser", data)
 			if id != "" {
 				for _, v := range departArr {
@@ -210,10 +211,10 @@ func (c *Customer) CustomerSave() {
 			if bfo != nil && len(*bfo) > 0 {
 				if (*bfo)["i_entid"] == nil {
 					if ph := common.ObjToString(data["s_phone"]); ph != "" {
-						if id := createCusRpc(common.ObjToString(data["s_name"]), ph); id == 0 {
-							logger.Error("createCusRpc:", "创建企业失败")
+						if eid := createCusRpc(common.ObjToString(data["s_name"]), ph); eid == 0 {
+							log.Error("createCusRpc:", "创建企业失败")
 						} else {
-							data["i_entid"] = id
+							data["i_entid"] = eid
 						}
 					}
 				}
@@ -221,6 +222,7 @@ func (c *Customer) CustomerSave() {
 			query := bson.M{
 				"_id": mongodb.StringTOBsonId(id),
 			}
+			log.Debug(data)
 			rep = util.Mgo.Update("cuser", query, bson.M{"$set": data}, false, false)
 		}
 		c.ServeJson(map[string]interface{}{
@@ -378,7 +380,7 @@ func (c *Customer) CuserToEuser() {
 		return
 	}
 	//2、复制信息(部门、规则)
-	b = util.Mgo.Update("euser", bson.M{"_id": mongodb.StringTOBsonId(_id)}, cuser, true, false)
+	b = util.Mgo.Update("euser", bson.M{"_id": mongodb.StringTOBsonId(_id)}, bson.M{"$set": cuser}, true, false)
 	if !b {
 		c.ServeJson(map[string]interface{}{
 			"rep": b,
@@ -386,9 +388,13 @@ func (c *Customer) CuserToEuser() {
 		return
 	}
 	departMap, _ := util.Mgo.Find("cuserdepart", bson.M{"s_userid": _id, "b_delete": false}, nil, nil, false, -1, -1)
-	util.Mgo.SaveBulk("euserdepart", *departMap...)
+	if len(*departMap) > 0 {
+		util.Mgo.SaveBulk("euserdepart", *departMap...)
+	}
 	ruleMap, _ := util.Mgo.Find("cuserdepartrule", bson.M{"s_userid": _id, "b_delete": false}, nil, nil, false, -1, -1)
-	util.Mgo.SaveBulk("euserdepartrule", *ruleMap...)
+	if len(*ruleMap) > 0 {
+		util.Mgo.SaveBulk("euserdepartrule", *ruleMap...)
+	}
 
 	c.ServeJson(map[string]interface{}{
 		"rep": b,
@@ -420,7 +426,7 @@ func GetCustomerAppId(customer string) string {
 				}
 			}
 		} else {
-			logger.Debug("调企业用户接口失败", err)
+			log.Debug("调企业用户接口失败", err)
 		}
 	}
 	//if appid != "" { //保存
@@ -1697,10 +1703,10 @@ type EntResponse struct {
 }
 
 func createCusRpc(name, phone string) int {
-	conn, err := rpc.DialHTTP("tcp", util.RpcServer)
+	conn, err := rpc.DialHTTP("tcp", util.RpcJyServer)
 	defer conn.Close()
 	if err != nil {
-		logger.Error("rpc dail error: ", err)
+		log.Error("rpc dail error: ", err)
 	}
 	req := EntRequest{
 		Name:  name,
@@ -1708,10 +1714,11 @@ func createCusRpc(name, phone string) int {
 	}
 	var res EntResponse
 	err = conn.Call("CreateEnt.AutomaticallyCreateEnt", req, &res)
+	log.Debug(res.Status, res.Id)
 	if err == nil || res.Status == 1 {
-		return 0
-	} else {
-		logger.Error("createCusRpc error: ", err)
 		return res.Id
+	} else {
+		log.Error("createCusRpc error: ", err)
+		return 0
 	}
 }

+ 56 - 36
CMPlatform/service/data_ent.go

@@ -3,9 +3,11 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
+	"app.yhyue.com/moapp/jybase/mongodb"
 	"cmplatform/util"
 	"fmt"
 	es "github.com/olivere/elastic/v7"
@@ -42,9 +44,9 @@ func (e *EntData) ImportData() {
 			e.ServeJson(map[string]interface{}{"success": false, "msg": "获取上传文件为空"})
 			return
 		}
-		importDataNum, pici := ImportDataByExcel(mf, eid, entid)
+		importDataNum, pici, msg := ImportDataByExcel(mf, eid, entid)
 		if importDataNum == 0 {
-			e.ServeJson(map[string]interface{}{"success": false, "msg": "文件数据导入异常"})
+			e.ServeJson(map[string]interface{}{"success": false, "msg": msg})
 			return
 		}
 		userName := ""
@@ -59,7 +61,7 @@ func (e *EntData) ImportData() {
 			"pici":       pici,
 			"createTime": time.Now().Unix(),
 		})
-		e.ServeJson(map[string]interface{}{"success": true, "msg": "导入成功"})
+		e.ServeJson(map[string]interface{}{"success": true, "msg": msg})
 	}
 }
 
@@ -86,7 +88,7 @@ func (e *EntData) ImportRecord() {
 }
 
 // ImportDataByExcel 通过excel获取数据源
-func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64) {
+func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64, string) {
 	defer common.Catch()
 	now := time.Now()
 	importDataNum := 0
@@ -106,7 +108,7 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64)
 				}
 
 			}
-			logger.Debug(fMap)
+			log.Debug(fMap)
 			continue
 		}
 		tmp := map[string]interface{}{}
@@ -116,52 +118,68 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64)
 		for index, cell := range row.Cells {
 			if val := cell.Value; val != "" {
 				if fMap[index] == "infoid" {
-					//tmp["infoid"] = encrypt.SE.DecodeString(val) //解密后id
-					tmp["infoid"] = val
+					if mongodb.IsObjectIdHex(val) {
+						tmp["infoid"] = val
+					} else {
+						tmp["infoid"] = encrypt.SE.DecodeString(val) //解密后id
+					}
 				} else if fMap[index] == "region" {
 					// 业务地区
-					if v := AreaM[val]; v != 0 {
+					if v := AreaM[val]; v != nil && v != 0 {
 						tmp[fMap[index]] = v
 					} else {
-						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"entid": entid, "name": val,
+						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"ent_id": eid, "name": val,
 							"type": 1})
 						tmp[fMap[index]] = id
 					}
 				} else if fMap[index] == "industry" {
 					// 行业
-					if v := IndustryM[val]; v != 0 {
+					if v := IndustryM[val]; v != nil && v != 0 {
 						tmp[fMap[index]] = v
 					} else {
-						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"entid": entid, "name": val,
+						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"ent_id": eid, "name": val,
 							"type": 2})
 						tmp[fMap[index]] = id
 					}
 				} else if fMap[index] == "winner_tag" {
 					// 中标单位标签
-					if v := WtM[val]; v != 0 {
+					if v := WtM[val]; v != nil && v != 0 {
 						tmp[fMap[index]] = v
 					} else {
-						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"entid": entid, "name": val,
+						id := util.EntMysql.Insert("d_yys_analyze_dimensions", bson.M{"ent_id": eid, "name": val,
 							"type": 3})
 						tmp[fMap[index]] = id
 					}
 				} else {
-					tmp[fMap[index]] = val
+					if fMap[index] != "" {
+						tmp[fMap[index]] = val
+					}
 				}
 			}
 		}
+		if tmp["infoid"] == nil {
+			return 0, now.Unix(), "文档没有唯一标识字段"
+		}
 		importDataNum++
 		tmp["eid"] = eid
 		tmp["entid"] = entid
+		tmp["jybxhref"] = "https://www.jianyu360.cn/succbi/yyssjdz/app/sjdz.app/detail.spg?E_id=" + common.ObjToString(tmp["infoid"])
 		tmp["pici"] = now.Format(date.Date_Full_Layout)
-		if info := util.EntMysql.FindOne("customer_data", bson.M{"entid": entid, "infoid": tmp["infoid"]}, "", ""); len(*info) > 0 {
+		if info := util.EntMysql.FindOne("customer_data", bson.M{"entid": entid, "infoid": tmp["infoid"]}, "", ""); info != nil && len(*info) > 0 {
+			tmp["status"] = 1
 			util.EntMysql.Update("customer_data", bson.M{"entid": entid, "infoid": tmp["infoid"]}, tmp)
 			id := (*info)["id"]
 			infoid := (*info)["infoid"]
-			util.Es.DelById("bidding_customer", "", id.(string))
-			binfo := util.EntMysql.FindOne("customer_data_gl", bson.M{"infoid": infoid}, "", "")
-			esSaveFuc(tmp, common.ObjToString((*binfo)["detail"]), &saveEsArr)
+			tmp["id"] = id
+			//util.Es.DelById("bidding_customer", "", fmt.Sprint(id))
+			binfo := util.EntMysql.FindOne("customer_data_yys_gl", bson.M{"info_id": infoid}, "", "")
+			if binfo != nil && len(*binfo) > 0 {
+				esSaveFuc(tmp, common.ObjToString((*binfo)["detail"]), &saveEsArr)
+			} else {
+				esSaveFuc(tmp, "", &saveEsArr)
+			}
 		} else {
+			log.Debug(tmp)
 			id := util.EntMysql.Insert("customer_data", tmp)
 			tmp["id"] = id
 			detail := detailFuc(common.ObjToString(tmp["infoid"]))
@@ -171,8 +189,8 @@ func ImportDataByExcel(mf multipart.File, eid int64, entid string) (int, int64)
 	if len(saveEsArr) > 0 {
 		util.BulkSave("bidding_customer", &saveEsArr, false, util.Es.(*elastic.EsV7))
 	}
-	logger.Debug("Load Excel Count:", importDataNum)
-	return importDataNum, now.Unix()
+	log.Debug("Load Excel Count:", importDataNum)
+	return importDataNum, now.Unix(), "文档导入成功"
 }
 
 func FiledFuc() (map[string]interface{}, map[string]interface{}) {
@@ -190,7 +208,7 @@ func CodeFieldFuc(entid int64) (map[string]interface{}, map[string]interface{},
 	AreaMap := make(map[string]interface{})
 	IndustryMap := make(map[string]interface{})
 	WinnerTagMap := make(map[string]interface{})
-	info := util.EntMysql.Find("d_yys_analyze_dimensions", bson.M{"entid": entid}, "", "", -1, -1)
+	info := util.EntMysql.Find("d_yys_analyze_dimensions", bson.M{"ent_id": entid}, "", "", -1, -1)
 	for _, m := range *info {
 		if common.IntAll(m["type"]) == 1 {
 			AreaMap[common.ObjToString(m["name"])] = m["code"]
@@ -234,9 +252,9 @@ func (e *EntData) RecordRevoke() {
 		query := make(map[string]interface{})
 		query["pici"] = date.FormatDateByInt64(&pici, date.Date_Full_Layout)
 		query["entid"] = entid
-		b := util.EntMysql.Update("customer_data", query, bson.M{"status": -1})
+		b := util.EntMysql.Update("customer_data", query, bson.M{"status": -1, "projectId": nil})
 		qEs := es.NewBoolQuery().Must(es.NewTermQuery("pici", pici)).Must(es.NewTermQuery("ent_id", eid))
-		logger.Debug(pici, eid)
+		log.Debug(pici, eid)
 		util.DelBy("bidding_customer", qEs, util.Es.(*elastic.EsV7))
 		if b {
 			util.Mgo.UpdateById("customer_import_record", _id, bson.M{"$set": bson.M{"del": true, "revokeTime": time.Now().Unix(), "revokeUser": userName}})
@@ -253,8 +271,8 @@ func (e *EntData) DelData() {
 		id, _ := e.GetInt("id")
 		eid, _ := e.GetInt("eid")
 		// todo rpc
-		DelFuc(id, eid)
-		b := util.EntMysql.Update("customer_data", bson.M{"id": id}, bson.M{"status": -2})
+		go DelFuc(id, eid)
+		b := util.EntMysql.Update("customer_data", bson.M{"id": id}, bson.M{"status": -2, "projectId": nil})
 		util.Es.DelById("bidding_customer", "", fmt.Sprint(id))
 		if b {
 			e.ServeJson(map[string]interface{}{"rep": true})
@@ -264,11 +282,11 @@ func (e *EntData) DelData() {
 	}
 }
 
-// 保证正文信息
+// 正文信息
 func detailFuc(infoid string) string {
-	binfo := util.EntMysql.FindOne("customer_data_gl", bson.M{"infoid": infoid}, "", "")
+	binfo := util.EntMysql.FindOne("customer_data_yys_gl", bson.M{"info_id": infoid}, "", "")
 	if binfo != nil && len(*binfo) > 0 {
-		return common.ObjToString((*binfo)["detail"])
+		return common.ObjToString((*binfo)["ES_detail"])
 	}
 	info, _ := util.MgoBidding.FindById("bidding", infoid, bson.M{"detail": 1, "contenthtml": 1})
 	if info != nil && len(*info) == 0 {
@@ -276,10 +294,10 @@ func detailFuc(infoid string) string {
 	}
 	if info != nil && len(*info) > 0 {
 		save := make(map[string]interface{})
-		save["infoid"] = infoid
-		save["detail"] = (*info)["detail"]
-		save["contenthtml"] = (*info)["contenthtml"]
-		util.EntMysql.Insert("customer_data_gl", save)
+		save["info_id"] = infoid
+		save["ES_detail"] = (*info)["detail"]
+		save["details"] = (*info)["contenthtml"]
+		util.EntMysql.Insert("customer_data_yys_gl", save)
 		return common.ObjToString((*info)["detail"])
 	}
 	return ""
@@ -306,7 +324,10 @@ func esSaveFuc(tmp map[string]interface{}, detail string, saveEsArr *[]map[strin
 			if err == nil {
 				saveEs[f] = thisTime.Unix()
 			} else {
-				logger.Debug(err)
+				thisTime, err = time.ParseInLocation(date.Date_Short_Layout, common.ObjToString(tmp[f]), time.Local)
+				if err == nil {
+					saveEs[f] = thisTime.Unix()
+				}
 			}
 		} else if f == "detail" {
 			saveEs[f] = detail
@@ -317,9 +338,8 @@ func esSaveFuc(tmp map[string]interface{}, detail string, saveEsArr *[]map[strin
 			saveEs[f] = tmp[f]
 		}
 	}
-
 	*saveEsArr = append(*saveEsArr, saveEs)
-	if len(*saveEsArr) > 100 {
+	if len(*saveEsArr) > 50 {
 		util.BulkSave("bidding_customer", saveEsArr, false, util.Es.(*elastic.EsV7))
 		saveEsArr = &[]map[string]interface{}{}
 	}

+ 5 - 5
CMPlatform/service/private_service.go

@@ -3,8 +3,8 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/mail"
 	"cmplatform/util"
 	"encoding/json"
@@ -38,7 +38,7 @@ func (f *Private) Keydatademo(world string) {
 	destr := encrypt.SE.DecodeString(world)
 	typeStr := f.GetString("type")
 
-	logger.Debug(destr)
+	log.Debug(destr)
 	if len(destr) > 10 {
 		// ctime := destr[:10]
 		// ctimeint := common.Int64All(ctime)
@@ -209,7 +209,7 @@ func (f *Private) Keydataoption(world string) {
 				feedback["o_matchkey"] = keyssort
 				pid := util.Mgo.Save("feedback", feedback)
 				if len(pid) < 1 {
-					logger.Debug("mongo save err")
+					log.Debug("mongo save err")
 					return
 				}
 
@@ -275,12 +275,12 @@ func sendMail(tag map[string]interface{}, option string) {
 	if jkmail != nil {
 		tomail, _ := jkmail["to"].(string)
 		api, _ := jkmail["api"].(string)
-		logger.Debug("start send", tomail, util.Sysconfig["jkmail"])
+		log.Debug("start send", tomail, util.Sysconfig["jkmail"])
 		res, err := http.Get(fmt.Sprintf("%s?to=%s&title=%s&body=%s", api, tomail, title, content))
 		if err == nil {
 			defer res.Body.Close()
 			read, err := io.ReadAll(res.Body)
-			logger.Debug("邮件发送:", string(read), err)
+			log.Debug("邮件发送:", string(read), err)
 		}
 	}
 }

+ 5 - 4
CMPlatform/service/rpc_serveice.go

@@ -1,8 +1,8 @@
 package service
 
 import (
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"cmplatform/util"
-	"log"
 	"net/rpc"
 )
 
@@ -17,9 +17,9 @@ type DelResponse struct {
 }
 
 func DelFuc(eid, infoid int64) {
-	conn, err := rpc.DialHTTP("tcp", util.RpcServer)
+	conn, err := rpc.DialHTTP("tcp", util.RpcProServer)
 	if err != nil {
-		log.Fatalln("dailing error: ", err)
+		log.Debug("dailing error: ", err)
 	}
 	req := DelRequest{
 		Eid:    eid,
@@ -28,7 +28,8 @@ func DelFuc(eid, infoid int64) {
 	var res DelResponse
 	err = conn.Call("JyService.InfoDel", req, &res)
 	if err != nil {
-		log.Fatalln("JyService error: ", err)
+		log.Debug("JyService error: ", err)
 	}
+	log.Debug(res)
 	_ = conn.Close()
 }

+ 12 - 12
CMPlatform/service/second_push.go

@@ -3,8 +3,8 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/mail"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"cmplatform/history"
@@ -222,7 +222,7 @@ func (s *SecondPush) SaveSpushRule() {
 }
 
 func (s *SecondPush) SecondPushTask() {
-	logger.Debug("开始二次推送任务...")
+	log.Debug("开始二次推送任务...")
 	s_pushid := s.GetString("s_pushid")
 	if s_pushid != "" {
 		customer, _ := util.Mgo.Find("second_push", map[string]interface{}{"_id": mongodb.StringTOBsonId(s_pushid)}, nil, nil, false, -1, -1)
@@ -238,7 +238,7 @@ func (s *SecondPush) SecondPushTask() {
 				if c["dep_rules"] != nil && len(c["dep_rules"].([]interface{})) != 0 {
 					idMap := map[primitive.ObjectID]bool{}
 					for _, m := range c["dep_rules"].([]interface{}) {
-						logger.Debug("ruleid", mongodb.BsonIdToSId(m.(map[string]interface{})["_id"]))
+						log.Debug("ruleid", mongodb.BsonIdToSId(m.(map[string]interface{})["_id"]))
 						q := bson.M{
 							"ruleid": bson.M{"$regex": mongodb.BsonIdToSId(m.(map[string]interface{})["_id"])},
 							"bget":   1,
@@ -287,9 +287,9 @@ func (s *SecondPush) SecondPushTask() {
 					}
 				}
 				if len(xlsxArr) == 0 {
-					logger.Debug("查询数据为空")
+					log.Debug("查询数据为空")
 				} else {
-					logger.Debug(len(xlsxArr))
+					log.Debug(len(xlsxArr))
 					GetXlsxs(xlsxArr, customer_name, email, s_pushid, common.ObjToString(c["s_appid"]))
 					go UpdateHistoryState(2, s_pushid, len(xlsxArr))
 					s.ServeJson(map[string]interface{}{
@@ -299,7 +299,7 @@ func (s *SecondPush) SecondPushTask() {
 				}
 			}
 		} else {
-			logger.Debug("初始化客户信息失败")
+			log.Debug("初始化客户信息失败")
 		}
 
 	}
@@ -342,7 +342,7 @@ func GetProjectId(id string) string {
 			projectIdArr = append(projectIdArr, common.ObjToString(v["_id"]))
 		}
 		projectId = strings.Join(projectIdArr, ",")
-		logger.Debug("id", id, "projectId", projectId)
+		log.Debug("id", id, "projectId", projectId)
 	}
 	return projectId
 }
@@ -465,7 +465,7 @@ func GetXlsxs(mMap []map[string]interface{}, fn, email, id, appid string) {
 			dataType := common.IntAll((*data)["i_extfieldstype"])
 			xf, err := xlsx.OpenFile("web/res/fields.xlsx")
 			if err != nil {
-				logger.Debug("fields file not foud", err.Error())
+				log.Debug("fields file not foud", err.Error())
 			}
 			newFile := xlsx.NewFile()
 			style := xlsx.NewStyle()
@@ -1028,20 +1028,20 @@ func GetXlsxs(mMap []map[string]interface{}, fn, email, id, appid string) {
 			if b, _ := history.PathExists(dir); !b {
 				err1 := os.MkdirAll(dir, os.ModePerm)
 				if err1 != nil {
-					logger.Debug("mkdir err", dir)
+					log.Debug("mkdir err", dir)
 				}
 			}
 			fname := fmt.Sprintf("%s_%s_%s.xlsx", fn, t, common.GetRandom(4))
-			logger.Debug("fname", fname)
+			log.Debug("fname", fname)
 			err = newFile.Save(dir + fname)
 			if err != nil {
-				logger.Debug("xls error", err, fname)
+				log.Debug("xls error", err, fname)
 			} else {
 				for i := 0; i < len(history.Gmails); i++ {
 					gmail := history.Gmails[i]
 					status := mail.GSendMail_q("剑鱼标讯", email, "", "", fn, "", dir+fname, fname, gmail)
 					if status {
-						logger.Debug("send mail success", fname, email)
+						log.Debug("send mail success", fname, email)
 						break
 					}
 				}

+ 3 - 2
CMPlatform/util/config.go

@@ -59,7 +59,7 @@ var (
 	SiteColl        string
 	IsNewSql        int
 
-	RpcServer string
+	RpcJyServer, RpcProServer string
 )
 
 var (
@@ -130,7 +130,8 @@ func InitOther() {
 	initSite()
 	IsNewSql = common.IntAll(Sysconfig["isNewSql"])
 
-	RpcServer = common.ObjToString(Sysconfig["rpcServer"])
+	RpcJyServer = common.ObjToString(Sysconfig["rpcServer_jy"])
+	RpcProServer = common.ObjToString(Sysconfig["rpcServer_project"])
 }
 
 func initCitys() {

+ 72 - 0
CMPlatform/util/jylog.go

@@ -0,0 +1,72 @@
+package util
+
+/**
+日志文件自动切换,默认保留15天内日志
+**/
+
+import (
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"github.com/robfig/cron"
+	"log"
+	"os"
+	"path/filepath"
+	"regexp"
+	"time"
+)
+
+// 日志格式
+var fileReg = regexp.MustCompile("^(\\d{4}_[0-9_]{14})\\.log$")
+
+// 当前日志文件句柄
+var LogFile *os.File
+
+// 时间格式
+var FMT = "2006_01_02_15_04_05"
+
+// 日志目录
+var LogPath = "./jylog"
+
+func init() {
+	os.Mkdir(LogPath, os.ModePerm)
+	//默认保留15天内的日志,-1为永久保留
+	initLog(15)
+}
+
+func initLog(saveDay int) {
+	go logfile()
+	task := cron.New()
+	task.Start()
+	task.AddFunc("0 0 0 * * ?", func() {
+		go logfile()
+		time.Sleep(50 * time.Second)
+		if saveDay > 0 {
+			filepath.Walk(LogPath, func(path string, info os.FileInfo, err error) error {
+				str := fileReg.FindStringSubmatch(info.Name())
+				if len(str) == 2 {
+					t, er := time.ParseInLocation(FMT, str[1], time.Local)
+					if er == nil {
+						if (time.Now().Unix()-t.Unix())/86400 > int64(saveDay) {
+							log.Println("delete log file:", path, os.Remove(path))
+						}
+					}
+				}
+				return nil
+			})
+		}
+	})
+}
+
+// 创建并切换输出文件
+func logfile() {
+	now := time.Now().Format(FMT)
+	file, _ := os.Create(LogPath + "/" + now + ".log")
+	log.SetOutput(file)
+	xweb.RootApp().Logger.SetOutput(file)
+	go func(file *os.File) {
+		time.Sleep(5 * time.Second)
+		if LogFile != nil {
+			LogFile.Close()
+		}
+		LogFile = file
+	}(file)
+}

+ 5 - 5
CMPlatform/util/parsxlsx.go

@@ -4,7 +4,7 @@ import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
-	"app.yhyue.com/moapp/jybase/logger"
+	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"fmt"
 	"github.com/tealeg/xlsx"
@@ -264,7 +264,7 @@ func ResponseXlsx_Data(id string) string {
 			}
 			xf, err := xlsx.OpenFile("web/res/fields.xlsx")
 			if err != nil {
-				logger.Error("fields file not foud", err.Error())
+				log.Error("fields file not foud", err.Error())
 				return ""
 			}
 			if isStandard {
@@ -299,7 +299,7 @@ func ResponseXlsx_Data(id string) string {
 				fname := fmt.Sprintf(bzpath, ruleName, t, common.GetRandom(4))
 				err := xf.Save(fname)
 				if err != nil {
-					logger.Error(err)
+					log.Error(err)
 					return ""
 				}
 				return fname
@@ -358,7 +358,7 @@ func ResponseXlsx_Data(id string) string {
 				fname := fmt.Sprintf(gjpath, ruleName, t, common.GetRandom(4))
 				err := xf.Save(fname)
 				if err != nil {
-					logger.Error(err)
+					log.Error(err)
 					return ""
 				}
 				return fname
@@ -378,7 +378,7 @@ func ResponseXlsx_Rule(id string) string {
 	exact := 0
 	xf, err := xlsx.OpenFile("web/res/export_rule.xlsx") //读取导出标签模板表
 	if err != nil {
-		logger.Error("export_rule file not foud", err.Error())
+		log.Error("export_rule file not foud", err.Error())
 		return ""
 	}
 	sh := xf.Sheets[0]

+ 12 - 13
CMPlatform/util/utiltag.go

@@ -5,7 +5,6 @@ import (
 	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/go-xweb/log"
-	"app.yhyue.com/moapp/jybase/logger"
 	"app.yhyue.com/moapp/jybase/redis"
 	"cmplatform/models"
 	sql "cmplatform/util/sqlmodel"
@@ -168,7 +167,7 @@ func searchDataArr(index, esquery, sdataid, userId string, i_maxnum int64, tags
 			// } else {
 			// 	redis.Put("datag", "jyqyfw_es_query_times_"+userId, 1, 60)
 			// }
-			logger.Debug("es空闲,当前进程数 ", listLens)
+			log.Debug("es空闲,当前进程数 ", listLens)
 			redis.RPUSH("datag", "jyqyfw_es_query", 1)
 			err, counts = searchData(index, esquery, sdataid, i_maxnum, tags, maths)
 			redis.LPOP("datag", "jyqyfw_es_query")
@@ -177,7 +176,7 @@ func searchDataArr(index, esquery, sdataid, userId string, i_maxnum int64, tags
 			err = errors.New("系统繁忙,请稍后再试")
 			break
 		} else {
-			logger.Error("企业级服务es进程数过多,", listLens)
+			log.Error("企业级服务es进程数过多,", listLens)
 		}
 		times2 += 2
 		time.Sleep(2 * time.Second)
@@ -206,8 +205,8 @@ func searchData(index, esquery, sdataid string, i_maxnum int64, tags map[string]
 	searchResult, err := client.Search(index).Query(cc).Size(int(i_maxnum)).Do(ctx)
 	if err == nil && searchResult.Hits != nil {
 		datas := make([]map[string]interface{}, 0)
-		logger.Debug("es查询到的数量:", searchResult.Hits.TotalHits.Value)
-		logger.Debug("es查询数据数量:", len(searchResult.Hits.Hits))
+		log.Debug("es查询到的数量:", searchResult.Hits.TotalHits.Value)
+		log.Debug("es查询数据数量:", len(searchResult.Hits.Hits))
 		for _, v := range searchResult.Hits.Hits {
 			item := make(map[string]interface{})
 			if json.Unmarshal(v.Source, &item) == nil {
@@ -299,14 +298,14 @@ func searchData(index, esquery, sdataid string, i_maxnum int64, tags map[string]
 			}
 		}
 		counts := Es.Count(index, Itype, esquery)
-		logger.Debug("esCount查询的数据量 ", counts)
+		log.Debug("esCount查询的数据量 ", counts)
 		Mgo.Update("cuserdepartrule", bson.M{"_id": tags["_id"]}, bson.M{
 			"$set": bson.M{
 				"i_estotal": counts,
 			}}, false, false)
 		return UtilEsSaveData(sdataid, index, &datas), counts
 	} else {
-		logger.Error("err", err)
+		log.Error("err", err)
 		return err, 0
 	}
 }
@@ -347,7 +346,7 @@ func FilterTimeSql(esquery string, startTime, endTime int64) (string, error) {
 				if err == nil {
 					return string(strQuery), nil
 				} else {
-					logger.Error("失败", err)
+					log.Error("失败", err)
 					return esquery, err
 				}
 			} else {
@@ -357,7 +356,7 @@ func FilterTimeSql(esquery string, startTime, endTime int64) (string, error) {
 			}
 		}
 	} else {
-		logger.Error(json.Unmarshal([]byte(esquery), &query), "err")
+		log.Error(json.Unmarshal([]byte(esquery), &query), "err")
 		return esquery, errors.New("err")
 	}
 	return esquery, nil
@@ -474,8 +473,8 @@ func UtilEsFind2(tags map[string]interface{}, n int) (error, int64) {
 		}
 		searchResult, err := client.Search(index).Query(cc).Do(ctx)
 		if err == nil && searchResult.Hits != nil {
-			logger.Debug("es查询到的数量:", searchResult.Hits.TotalHits)
-			logger.Debug("开始处理")
+			log.Debug("es查询到的数量:", searchResult.Hits.TotalHits)
+			log.Debug("开始处理")
 
 			for _, v := range searchResult.Hits.Hits {
 				item := make(map[string]interface{})
@@ -580,12 +579,12 @@ func UtilEsFind2(tags map[string]interface{}, n int) (error, int64) {
 
 				}
 			}
-			logger.Debug("处理完成", len(datas))
+			log.Debug("处理完成", len(datas))
 
 			count := searchResult.Hits.TotalHits.Value
 			totalCount += count
 		} else {
-			logger.Debug(err)
+			log.Debug(err)
 			return err, 0
 		}
 	}

+ 1 - 1
CMPlatform/web/templates/private/customer_edit.html

@@ -69,7 +69,7 @@
                                     <div class="form-group">
                                         <label class="col-sm-2 control-label">管理员手机号</label>
                                         <div class="col-sm-3">
-                                            <input type="tel" class="form-control" id="phone" value="{{.T.data.phone}}" placeholder="管理员手机号" />
+                                            <input type="tel" class="form-control" id="phone" value="{{.T.data.s_phone}}" placeholder="管理员手机号" />
                                             <label for="phone" style="font-size: 12px;color: red">注:该手机号用户登录剑鱼工作台,将作为企业管理员对该企业人员及权限进行管理,保存后不支持修改,请谨慎填写,如需修改请联系研发人员。</label>
                                         </div>
                                     </div>

+ 7 - 9
CMPlatform/web/templates/private/customer_ent_data.html

@@ -239,7 +239,7 @@
                         return tmp
                     }
                 },
-                {"data": "title", width: 400},
+                {"data": "projectname", width: 400},
                 {"data": "projectcode", width: 150, "defaultContent": ""},
                 {"data": "projectid", width: 100, "defaultContent": ""},
                 {"data": "infoid", width: 100, "defaultContent": ""},
@@ -342,10 +342,9 @@
                     data:{"pici": p, "entid": entid, "_id": id, "eid": eid},
                     success:function(r){
                         if(r.rep){
-                            showTip("撤销成功", 1000, function (){
-                                ttable.ajax.reload()
-                                mtable.ajax.reload()
-                            })
+                            ttable.ajax.reload()
+                            mtable.ajax.reload()
+                            showTip("撤销成功", 1000)
                         }else{
                             showTip(r.msg, 1000);
                         }
@@ -360,12 +359,11 @@
             $.ajax({
                 url:"/service/entdata/del",
                 type:"post",
-                data:{"id": _id},
+                data:{"id": _id, "eid": eid},
                 success:function(r){
                     if(r.rep){
-                        showTip("删除成功", 1000, function () {
-                            mtable.ajax.reload()
-                        })
+                        mtable.ajax.reload()
+                        showTip("删除成功", 1000)
                     }else{
                         showTip(r.msg, 1000);
                     }