Browse Source

Merge branch 'fix/ppt_sort_v2' into debug

Roc 3 weeks ago
parent
commit
ad0c38bc0a
2 changed files with 8 additions and 4 deletions
  1. 4 2
      services/ppt/ppt_english_group.go
  2. 4 2
      services/ppt/ppt_group.go

+ 4 - 2
services/ppt/ppt_english_group.go

@@ -578,14 +578,16 @@ func MoveGroupPptEnglish(groupId, groupPptId, prevGroupPptId, nextGroupPptId int
 	if prevGroupPpt != nil && prevGroupPpt.PptId > 0 && nextGroupPpt != nil && nextGroupPpt.PptId > 0 { // 两个之间
 		pptSort, _ = decimal.NewFromFloat(prevGroupPpt.PptSort).Add(decimal.NewFromFloat(nextGroupPpt.PptSort)).Div(decimal.NewFromInt(2)).Float64()
 	} else if prevGroupPpt != nil && prevGroupPpt.PptId > 0 {
-		maxSort, tmpErr := ppt_english.GetMaxSortByEnglishGroupId(prevGroupPpt.GroupId)
+		// 最下面
+		maxSort, tmpErr := ppt_english.GetMinSortByEnglishGroupId(prevGroupPpt.GroupId)
 		if tmpErr != nil {
 			err = errors.New("获取最小排序失败:" + tmpErr.Error())
 			return
 		}
 		pptSort, _ = decimal.NewFromFloat(maxSort).Add(decimal.NewFromInt(1)).Float64()
 	} else if nextGroupPpt != nil && nextGroupPpt.PptId > 0 {
-		minSort, tmpErr := ppt_english.GetMinSortByEnglishGroupId(nextGroupPpt.GroupId)
+		// 最上面
+		minSort, tmpErr := ppt_english.GetMaxSortByEnglishGroupId(nextGroupPpt.GroupId)
 		if tmpErr != nil {
 			err = errors.New("获取最小排序失败:" + tmpErr.Error())
 			return

+ 4 - 2
services/ppt/ppt_group.go

@@ -828,14 +828,16 @@ func MoveGroupPpt(groupId, groupPptId, prevGroupPptId, nextGroupPptId int64, adm
 	if prevGroupPpt != nil && prevGroupPpt.PptId > 0 && nextGroupPpt != nil && nextGroupPpt.PptId > 0 { // 两个之间
 		pptSort, _ = decimal.NewFromFloat(prevGroupPpt.PptSort).Add(decimal.NewFromFloat(nextGroupPpt.PptSort)).Div(decimal.NewFromInt(2)).Float64()
 	} else if prevGroupPpt != nil && prevGroupPpt.PptId > 0 {
-		maxSort, tmpErr := models.GetMaxSortByGroupId(prevGroupPpt.GroupId)
+		// 最下面
+		maxSort, tmpErr := models.GetMinSortByGroupId(prevGroupPpt.GroupId)
 		if tmpErr != nil {
 			err = errors.New("获取最小排序失败:" + tmpErr.Error())
 			return
 		}
 		pptSort, _ = decimal.NewFromFloat(maxSort).Add(decimal.NewFromInt(1)).Float64()
 	} else if nextGroupPpt != nil && nextGroupPpt.PptId > 0 {
-		minSort, tmpErr := models.GetMinSortByGroupId(nextGroupPpt.GroupId)
+		// 最上面
+		minSort, tmpErr := models.GetMaxSortByGroupId(nextGroupPpt.GroupId)
 		if tmpErr != nil {
 			err = errors.New("获取最小排序失败:" + tmpErr.Error())
 			return