浏览代码

改成单条记录翻译

xiexiaoyuan 2 年之前
父节点
当前提交
c21d255ab3
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      services/day_new.go

+ 3 - 3
services/day_new.go

@@ -280,7 +280,7 @@ func DayNewTranslateContent() (err error) {
 	var ups []interface{}
 	for _, v := range list {
 		//如果单条翻译的字符数超过1000,则直接翻译,否则批量翻译
-		if len(v.Content) > 1000 {
+		//if len(v.Content) > 1000 {
 			en, e := AliTranslate(v.Content)
 			if e != nil {
 				err = e
@@ -289,7 +289,7 @@ func DayNewTranslateContent() (err error) {
 			needChangeIds += strconv.Itoa(int(v.Id)) + ","
 			multi += ` WHEN `+strconv.Itoa(int(v.Id))+` THEN ?`
 			ups = append(ups, en)
-		}else{
+		/*}else{
 			if count >= 50 {  //待翻译的条数不能超过50; 单条翻译字符数不能超过1000字符
 				contentEnMap, err = batchTranslateHandler(contentMap)
 				if err != nil {
@@ -306,7 +306,7 @@ func DayNewTranslateContent() (err error) {
 			}
 			contentMap[strconv.Itoa(int(v.Id))] = dealPunctuationToEn(strings.Trim(v.Content, " "))+`{end}`
 			count += 1
-		}
+		}*/
 	}
 	//剩余不满50条的content
 	if count > 0 {