|
@@ -377,6 +377,11 @@ class Ruku():
|
|
# 查重
|
|
# 查重
|
|
if self.source != "xue_guan":
|
|
if self.source != "xue_guan":
|
|
repeat_r, repeat_time = self.repeat_check(nn, one_items, repeat_time)
|
|
repeat_r, repeat_time = self.repeat_check(nn, one_items, repeat_time)
|
|
|
|
+ if type(repeat_r) == str:
|
|
|
|
+ res_xbk = {"items": [], "errcode": 1, "errmsg": repeat_r, "callback_type": 2}
|
|
|
|
+ res_zyk = {"errcode": 1, "errmsgs": repeat_r, "data": {}}
|
|
|
|
+ self.callback_user(res_xbk, self.callback_url)
|
|
|
|
+ return res_zyk
|
|
new_one_item["repeat_res"] = repeat_r
|
|
new_one_item["repeat_res"] = repeat_r
|
|
new_one_item["topic_type_id"] = one_items["checkType"]["id"]
|
|
new_one_item["topic_type_id"] = one_items["checkType"]["id"]
|
|
if "options_rank" in one_items and one_items["options_rank"]:
|
|
if "options_rank" in one_items and one_items["options_rank"]:
|
|
@@ -430,6 +435,11 @@ class Ruku():
|
|
# 查重
|
|
# 查重
|
|
if self.source != "xue_guan":
|
|
if self.source != "xue_guan":
|
|
repeat_r, repeat_time = self.repeat_check(nn, one_items, repeat_time)
|
|
repeat_r, repeat_time = self.repeat_check(nn, one_items, repeat_time)
|
|
|
|
+ if type(repeat_r) == str:
|
|
|
|
+ res_xbk = {"items": [], "errcode": 1, "errmsg": repeat_r, "callback_type": 2}
|
|
|
|
+ res_zyk = {"errcode": 1, "errmsgs": repeat_r, "data": {}}
|
|
|
|
+ self.callback_user(res_xbk, self.callback_url)
|
|
|
|
+ return res_zyk
|
|
new_one_item["repeat_res"] = repeat_r
|
|
new_one_item["repeat_res"] = repeat_r
|
|
new_one_item["topic_type_id"] = one_items["checkType"]["id"]
|
|
new_one_item["topic_type_id"] = one_items["checkType"]["id"]
|
|
if "options_rank" in one_items and one_items["options_rank"]:
|
|
if "options_rank" in one_items and one_items["options_rank"]:
|
|
@@ -619,12 +629,16 @@ class Ruku():
|
|
chachong_item_dict["options"] = one_items["options"]
|
|
chachong_item_dict["options"] = one_items["options"]
|
|
if "slave" in one_items:
|
|
if "slave" in one_items:
|
|
chachong_item_dict["slave"] = one_items["slave"]
|
|
chachong_item_dict["slave"] = one_items["slave"]
|
|
- repeat_r = requests.post(url=configs.repeat_ip, json=[chachong_item_dict]).json()
|
|
|
|
- print("查重结果:", repeat_r) # [str(id + 1)]
|
|
|
|
- if repeat_r:
|
|
|
|
- repeat_r = repeat_r[str(id + 1)]
|
|
|
|
- else:
|
|
|
|
- repeat_r = []
|
|
|
|
|
|
+ try:
|
|
|
|
+ repeat_r = requests.post(url=configs.repeat_ip, json=[chachong_item_dict]).json()
|
|
|
|
+ print("查重结果:", repeat_r) # [str(id + 1)]
|
|
|
|
+ if repeat_r:
|
|
|
|
+ repeat_r = repeat_r[str(id + 1)]
|
|
|
|
+ else:
|
|
|
|
+ repeat_r = []
|
|
|
|
+ except Exception as e:
|
|
|
|
+ logger.info("----【paper_id:{}】查重服务异常:{}".format(self.wordid, e))
|
|
|
|
+ repeat_r = "保存入库查重服务异常"
|
|
repeat_time += time.time() - t22
|
|
repeat_time += time.time() - t22
|
|
return repeat_r, repeat_time
|
|
return repeat_r, repeat_time
|
|
|
|
|
|
@@ -647,6 +661,7 @@ class Ruku():
|
|
try:
|
|
try:
|
|
r = requests.post(callback_url,
|
|
r = requests.post(callback_url,
|
|
# json=res, # 可以,但是会进行转义
|
|
# json=res, # 可以,但是会进行转义
|
|
|
|
+ headers={"Content-Type": "application/json"},
|
|
data=json.dumps(res_xbk, ensure_ascii=False).encode("utf-8"), # 文件开头有编码显示
|
|
data=json.dumps(res_xbk, ensure_ascii=False).encode("utf-8"), # 文件开头有编码显示
|
|
)
|
|
)
|
|
print("------【paper_id:{}】,post 回调地址状态:{}===>回调结果: {} -------\n".format(self.wordid, r.status_code, r.text))
|
|
print("------【paper_id:{}】,post 回调地址状态:{}===>回调结果: {} -------\n".format(self.wordid, r.status_code, r.text))
|