You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: scene.go
    path of file: ./repos/erda/internal/apps/dop/services/migrate
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the Licen
    
func (svc *Service) reorderScenesByDirectoryOrder(sceneBaseInfo *SceneBaseInfo) {
	if len(sceneBaseInfo.AllSceneMap) == 0 {
		return
	}

	for _, scenes := range sceneBaseInfo.AllSceneMap {
		// 使用 sort.Strings 排序
		var sceneNames []string
		sceneMap := make(map[string]*dao.AutoTestScene)
		// scene 可能同名，加数字保证不唯一
		randomI := 0
		for _, scene := range scenes {
			sceneName := scene.Name
			if _, ok := sceneMap[scene.Name]; ok {
				sceneName = fmt.Sprintf("%s_%d", sceneName, randomI)
				randomI++
			}
			sceneMap[sceneName] = scene
			sceneNames = append(sceneNames, sceneName)
		}
		sort.Strings(sceneNames)

		// 排好序重新设置 preID
		for i, sceneName := range sceneNames {
			scene := sceneMap[sceneName]
			if i == 0 {
				scene.PreID = 0
			} else {
				scene.PreID = sceneMap[sceneNames[i-1]].ID
			}
			_ = svc.updateScenePreID(scene)
		}
	}
}