Add new fields into matter. Remove migrate20To30.

This commit is contained in:
zicla
2020-03-16 01:44:27 +08:00
parent 4611defe36
commit 7ff7907e11
8 changed files with 25 additions and 253 deletions

View File

@ -25,8 +25,6 @@ const (
MODE_CRAWL = "crawl"
//Current version.
MODE_VERSION = "version"
//migrate 2.0 to 3.0
MODE_MIGRATE_20_TO_30 = "migrate20to30"
)
type TankApplication struct {
@ -120,10 +118,6 @@ func (this *TankApplication) Start() {
this.HandleMirror()
} else if strings.ToLower(this.mode) == MODE_MIGRATE_20_TO_30 {
this.HandleMigrate20to30()
} else if strings.ToLower(this.mode) == MODE_CRAWL {
this.HandleCrawl()
@ -260,41 +254,3 @@ func (this *TankApplication) HandleVersion() {
fmt.Printf("EyeblueTank %s\r\n", core.VERSION)
}
//migrate 2.0 to 3.0
func (this *TankApplication) HandleMigrate20to30() {
if this.src == "" {
panic("src is required")
}
fmt.Printf("start migrating 2.0 to 3.0. MatterPath2.0 = %s \r\n", this.src)
urlString := fmt.Sprintf("%s/api/preference/migrate20to30", this.host)
params := url.Values{
"matterPath": {this.src},
core.USERNAME_KEY: {this.username},
core.PASSWORD_KEY: {this.password},
}
response, err := http.PostForm(urlString, params)
core.PanicError(err)
bodyBytes, err := ioutil.ReadAll(response.Body)
webResult := &result.WebResult{}
err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(bodyBytes, webResult)
if err != nil {
fmt.Printf("error response format %s \r\n", err.Error())
return
}
if webResult.Code == result.OK.Code {
fmt.Println("success")
} else {
fmt.Printf("error %s\r\n", webResult.Msg)
}
}