From d1c5d57184839d7707557f8468516089b9b54d8e Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期六, 03 八月 2019 16:24:53 +0800 Subject: [PATCH] fix taskSdkAdd --- controllers/dbtableperson.go | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 57 insertions(+), 1 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index bce4198..bad1888 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -60,6 +60,17 @@ params := string(personbytes) logger.Debug("璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params) data, _ := esutil.PutEsDataReq(url, params) + //if data["_id"] !=""{ + // //閫氱煡姣斿杩涚▼缂撳瓨鏇存柊 + // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ + // Type: protomsg.EsCacheChanged_T_DbTablePerson, + // PersonId: personId, + // TableId: []string{ dbperson.TableId }, + // Feature: dbperson.FaceFeature, + // Action: protomsg.DbAction_Insert, + // }) + //} + //c.JSON(200, changeEsRespData(data, "娣诲姞浜哄憳鎴愬姛")) result = changeEsRespData(data, "娣诲姞鎴愬姛") return result @@ -97,6 +108,23 @@ result := changeEsRespData(data, "淇敼鎴愬姛") if result["success"].(bool) { //code.Success.Message = "淇敼搴曞簱浜哄憳鎴愬姛" + //if dbperson.Enable == 1 { + // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ + // Type: protomsg.EsCacheChanged_T_DbTablePerson, + // PersonId: dbperson.Id, + // TableId: []string{ dbperson.TableId }, + // Feature: "", + // Action: protomsg.DbAction_Insert, + // }) + //} else { + // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ + // Type: protomsg.EsCacheChanged_T_DbTablePerson, + // PersonId: dbperson.Id, + // TableId: []string{ dbperson.TableId }, + // Feature: "", + // Action: protomsg.DbAction_Delete, + // }) + //} util.ResponseFormat(c, code.Success, result["data"]) } else { //code.ServiceInsideError.Message += result["msg"].(string) @@ -127,6 +155,20 @@ result := changeEsRespData(data, "鍒犻櫎鎴愬姛") if result["success"].(bool) { //code.Success.Message = "鍒犻櫎搴曞簱浜哄憳鎴愬姛" + //閫氱煡姣斿杩涚▼锛屾浜哄凡鍒犻櫎 + //dbperArr, e := esApi.Dbpersoninfosbyid([]string{uuid}, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) + //if e ==nil && len(dbperArr) > 0{ + // if dbperArr[0].TableId !=""{ + // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ + // Type: protomsg.EsCacheChanged_T_DbTablePerson, + // PersonId: uuid, + // TableId: []string{ dbperArr[0].TableId }, + // Feature: "", + // Action: protomsg.DbAction_Delete, + // }) + // } + //} + util.ResponseFormat(c, code.Success, result["data"]) } else { //code.ServiceInsideError.Message += result["msg"].(string) @@ -149,7 +191,7 @@ bytes, _ := json.Marshal(uuids) s := string(bytes) url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + - "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_update_by_query?refresh=wait_for" // + config.EsInfo.EsIndex.Dbtablepersons.IndexType + "/" + "/" + s + "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_update_by_query?refresh" // + config.EsInfo.EsIndex.Dbtablepersons.IndexType + "/" + "/" + s params := "{\"script\":{\"lang\":\"painless\",\"inline\":\"ctx._source.isDelete = \\\"1\\\";" + "ctx._source.updateTime = \\\"" + time.Now().Format("2006-01-02 15:04:05") + "\\\"\"},\"query\":{\"terms\":{\"_id\":" + s + "}}}" logger.Debug("鍒犻櫎璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params) @@ -158,6 +200,20 @@ //result := changeEsRespData(data, "鍒犻櫎鎴愬姛") if data["error"] == nil { //code.Success.Message = "鍒犻櫎搴曞簱浜哄憳鎴愬姛" + //dbperArr, e := esApi.Dbpersoninfosbyid(uuids, config.EsInfo.EsIndex.Dbtablepersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) + //if e ==nil && len(dbperArr) > 0{ + // for _,esPer :=range dbperArr { + // if esPer.TableId !=""{ + // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{ + // Type: protomsg.EsCacheChanged_T_DbTablePerson, + // PersonId: esPer.Id, + // TableId: []string{ esPer.TableId }, + // Feature: "", + // Action: protomsg.DbAction_Delete, + // }) + // } + // } + //} util.ResponseFormat(c, code.Success, "鍒犻櫎搴曞簱浜哄憳鎴愬姛") } else { //code.ServiceInsideError.Message += result["msg"].(string) -- Gitblit v1.8.0