wcj %!s(int64=5) %!d(string=hai) anos
pai
achega
88186ba1e3
Modificáronse 1 ficheiros con 19 adicións e 25 borrados
  1. 19 25
      src/jfw/modules/pushsubscribe/src/push/job/movejob.go

+ 19 - 25
src/jfw/modules/pushsubscribe/src/push/job/movejob.go

@@ -16,7 +16,7 @@ import (
 )
 
 var (
-	MoveFields = []string{"s_m_openid", "a_m_openid", "phone", "usertype", "jpushid", "opushid", "words", "ratemode", "wxpush", "apppush", "mailpush", "pchelperpush", "timestamp", "subscribe", "applystatus", "appphonetype", "email", "size", "modifydate", "mergeorder", "nickname", "firstpushtime", "vipstatus"}
+	MoveFields = []string{"s_m_openid", "a_m_openid", "phone", "usertype", "jpushid", "opushid", "words", "ratemode", "wxpush", "apppush", "mailpush", "pchelperpush", "timestamp", "subscribe", "applystatus", "appphonetype", "email", "modifydate", "mergeorder", "nickname", "firstpushtime", "vipstatus"}
 )
 
 type MoveUser struct {
@@ -184,31 +184,25 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 					}
 					newList = append(newList, vv)
 				}
-				pLength := len(newList)
-				if pLength == 0 {
-					invalidArray_delete = append(invalidArray_delete, moveUser.ids...)
-					if len(invalidArray_delete) == BigBulkSize {
-						m.delBulk(sess, &invalidArray_delete)
-					}
-					return
-				}
-				rLength := len(*oldList)
-				maxPushSize := Config.MaxPushSize
-				if moveUser.isVipUser {
-					maxPushSize = Config.VipMaxPushSize
-				}
 				upSet := map[string]interface{}{}
-				if rLength+pLength > maxPushSize {
-					newList = append(newList, *oldList...)
-					sort.Sort(newList)
-					setMap["list"] = newList[:maxPushSize]
-					setMap["size"] = maxPushSize
-				} else { //追加
-					setMap["size"] = rLength + pLength
-					upSet["$push"] = map[string]interface{}{
-						"list": map[string]interface{}{
-							"$each": newList,
-						},
+				if pLength := len(newList); pLength > 0 {
+					rLength := len(*oldList)
+					maxPushSize := Config.MaxPushSize
+					if moveUser.isVipUser {
+						maxPushSize = Config.VipMaxPushSize
+					}
+					if rLength+pLength > maxPushSize {
+						newList = append(newList, *oldList...)
+						sort.Sort(newList)
+						setMap["list"] = newList[:maxPushSize]
+						setMap["size"] = maxPushSize
+					} else { //追加
+						setMap["size"] = rLength + pLength
+						upSet["$push"] = map[string]interface{}{
+							"list": map[string]interface{}{
+								"$each": newList,
+							},
+						}
 					}
 				}
 				upSet["$set"] = setMap