♻️ 重构返回值状态码

This commit is contained in:
Liang Ding 2019-05-24 21:52:17 +08:00
parent 83d52b107a
commit b53d2d28b7
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D
25 changed files with 117 additions and 110 deletions

View File

@ -201,7 +201,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -211,7 +211,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -240,7 +240,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
exprInfo := strings.TrimSpace(string(output))
if "" == exprInfo {
result.Succ = false
result.Code = -1
return
}
@ -277,7 +277,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -287,7 +287,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -316,7 +316,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
found := strings.TrimSpace(string(output))
if "" == found {
result.Succ = false
result.Code = -1
return
}
@ -366,7 +366,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -376,7 +376,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -404,7 +404,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
out := strings.TrimSpace(string(output))
if "" == out {
result.Succ = false
result.Code = -1
return
}

View File

@ -46,7 +46,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -54,7 +54,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
filePath := args["file"].(string)
if gulu.Go.IsAPI(filePath) {
result.Succ = false
result.Code = -1
return
}
@ -63,7 +63,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -73,7 +73,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
fout.WriteString(code)
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -94,7 +94,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
output := string(bytes)
if "" == output {
// format error, returns the original content
result.Succ = true
result.Code = 0
return
}
@ -106,7 +106,7 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
fout.WriteString(code)
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -57,7 +57,7 @@ func CreateZipHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
data.Succ = false
data.Code = -1
return
}
@ -76,7 +76,7 @@ func CreateZipHandler(w http.ResponseWriter, r *http.Request) {
dir := filepath.Dir(path)
if !gulu.File.IsExist(path) {
data.Succ = false
data.Code = -1
data.Msg = "Can't find file [" + path + "]"
return
@ -86,7 +86,7 @@ func CreateZipHandler(w http.ResponseWriter, r *http.Request) {
zipFile, err := gulu.Zip.Create(zipPath + ".zip")
if nil != err {
logger.Error(err)
data.Succ = false
data.Code = -1
return
}

View File

@ -170,7 +170,7 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -185,7 +185,7 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
size := gulu.File.GetFileSize(path)
if size > 5242880 { // 5M
result.Succ = false
result.Code = -1
result.Msg = "This file is too large to open :("
return
@ -221,7 +221,7 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
content := string(buf)
if gulu.File.IsBinary(content) {
result.Succ = false
result.Code = -1
result.Msg = "Can't open a binary file :("
} else {
data["content"] = content
@ -246,7 +246,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -264,7 +264,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -275,7 +275,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
wSession := session.WideSessions.Get(sid)
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
@ -302,7 +302,7 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -321,7 +321,7 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) {
wSession := session.WideSessions.Get(sid)
if !createFile(path, fileType) {
result.Succ = false
result.Code = -1
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
Data: "can't create file " + path}
@ -354,7 +354,7 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -372,7 +372,7 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) {
wSession := session.WideSessions.Get(sid)
if !removeFile(path) {
result.Succ = false
result.Code = -1
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
Data: "can't remove file " + path}
@ -400,7 +400,7 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -425,7 +425,7 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) {
wSession := session.WideSessions.Get(sid)
if !renameFile(oldPath, newPath) {
result.Succ = false
result.Code = -1
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
Data: "can't rename file " + oldPath}
@ -464,7 +464,7 @@ func FindHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -518,7 +518,7 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -526,7 +526,7 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) {
sid := args["sid"].(string)
wSession := session.WideSessions.Get(sid)
if nil == wSession {
result.Succ = false
result.Code = -1
return
}

View File

@ -41,7 +41,7 @@ func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -51,7 +51,7 @@ func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "", code, 0)
if err != nil {
result.Succ = false
result.Code = -1
return
}

4
go.mod
View File

@ -3,7 +3,7 @@ module github.com/b3log/wide
go 1.12
require (
github.com/b3log/gulu v0.0.0-20190524125155-0ed03084217c
github.com/b3log/gulu v0.0.0-20190524134307-1c13d074e5e7
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/fsnotify/fsnotify v1.4.7
@ -18,5 +18,5 @@ require (
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect
golang.org/x/sys v0.0.0-20190524122548-abf6ff778158 // indirect
golang.org/x/tools v0.0.0-20190523174634-38d8bcfa38af // indirect
golang.org/x/tools v0.0.0-20190524125531-991f2949994b // indirect
)

3
go.sum
View File

@ -2,6 +2,8 @@ github.com/b3log/gulu v0.0.0-20190524124046-926f105c6dd8 h1:Ir8QVO1dwv6MEdkAE7L1
github.com/b3log/gulu v0.0.0-20190524124046-926f105c6dd8/go.mod h1:UmyB0pe8jv1K3dZy/4UE3uCpM8zYkB4nbiIgjemuQ7A=
github.com/b3log/gulu v0.0.0-20190524125155-0ed03084217c h1:1+Pr5/IUfYBTiZVyzX7CfdkLVtL+LZa5yrxhjLlPYXY=
github.com/b3log/gulu v0.0.0-20190524125155-0ed03084217c/go.mod h1:UmyB0pe8jv1K3dZy/4UE3uCpM8zYkB4nbiIgjemuQ7A=
github.com/b3log/gulu v0.0.0-20190524134307-1c13d074e5e7 h1:fdRlxbAj3hLIQmllGS7C1VJOoFssDEscxbSIPgugbjQ=
github.com/b3log/gulu v0.0.0-20190524134307-1c13d074e5e7/go.mod h1:UmyB0pe8jv1K3dZy/4UE3uCpM8zYkB4nbiIgjemuQ7A=
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f h1:8GDPb0tCY8LQ+OJ3dbHb5sA6YZWXFORQYZx5sdsTlMs=
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f h1:AUj1VoZUfhPhOPHULCQQDnGhRelpFWHMLhQVWDsS0v4=
@ -51,3 +53,4 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190523174634-38d8bcfa38af/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524125531-991f2949994b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=

View File

@ -51,7 +51,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -68,7 +68,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
fout, err := os.Create(filePath)
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -76,7 +76,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
code := args["code"].(string)
if _, err := fout.WriteString(code); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -110,7 +110,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
output := string(outputBytes)
if nil != err && strings.Contains(output, "go.mod already exists") {
logger.Error(err.Error() + ": " + output)
result.Succ = false
result.Code = -1
return
}
@ -136,7 +136,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -144,18 +144,18 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
if !result.Succ {
if 0 != result.Code {
return
}
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -50,7 +50,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -106,7 +106,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) {
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -114,12 +114,12 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) {
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
if !result.Succ {
if 0 != result.Code {
return
}
@ -146,7 +146,7 @@ func CrossCompilationHandler(w http.ResponseWriter, r *http.Request) {
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -50,7 +50,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -70,7 +70,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -78,12 +78,12 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
if !result.Succ {
if 0 != result.Code {
return
}
@ -110,7 +110,7 @@ func GoInstallHandler(w http.ResponseWriter, r *http.Request) {
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -48,7 +48,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -66,7 +66,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) {
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -74,12 +74,12 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) {
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
if !result.Succ {
if 0 != result.Code {
return
}
@ -106,7 +106,7 @@ func GoTestHandler(w http.ResponseWriter, r *http.Request) {
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -48,7 +48,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -66,7 +66,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) {
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -74,12 +74,12 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) {
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
if !result.Succ {
if 0 != result.Code {
return
}
@ -106,7 +106,7 @@ func GoVetHandler(w http.ResponseWriter, r *http.Request) {
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -42,7 +42,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -66,7 +66,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
data["output"] = template.HTML(string(out))
if nil != err {
result.Succ = false
result.Code = -1
return
}

View File

@ -44,7 +44,7 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -57,7 +57,7 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
stdin, err := cmd.StdinPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -89,7 +89,7 @@ func SaveHandler(w http.ResponseWriter, r *http.Request) {
fout.WriteString(code)
if err := fout.Close(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}

View File

@ -94,7 +94,7 @@ func GithubCallbackHandler(w http.ResponseWriter, r *http.Request) {
msg := addUser(githubId, userName, avatar)
if userCreated != msg {
result := gulu.Ret.NewResult()
result.Succ = false
result.Code = -1
result.Msg = msg
gulu.Ret.RetResult(w, r, result)

View File

@ -52,13 +52,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
}
sid := args["sid"].(string)
wSession := WideSessions.Get(sid)
if nil == wSession {
result.Succ = false
result.Code = -1
}
filePath := args["executable"].(string)
@ -78,13 +78,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
stdout, err := cmd.StdoutPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
}
stderr, err := cmd.StderrPipe()
if nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
}
outReader := bufio.NewReader(stdout)
@ -92,11 +92,11 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util
if err := cmd.Start(); nil != err {
logger.Error(err)
result.Succ = false
result.Code = -1
}
wsChannel := channel[sid]
channelRet := map[string]interface{}{}
if !result.Succ {
if 0 != result.Code {
channelRet["cmd"] = "run-done"
channelRet["output"] = ""
wsChannel.WriteJSON(&channelRet)
@ -204,7 +204,7 @@ func StopHandler(w http.ResponseWriter, r *http.Request) {
var args map[string]interface{}
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -214,7 +214,7 @@ func StopHandler(w http.ResponseWriter, r *http.Request) {
wSession := WideSessions.Get(sid)
if nil == wSession {
result.Succ = false
result.Code = -1
return
}

View File

@ -294,14 +294,14 @@ func SaveContentHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
wSession := WideSessions.Get(args.Sid)
if nil == wSession {
result.Succ = false
result.Code = -1
return
}

View File

@ -117,7 +117,7 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
logger.Error(err)
result.Succ = false
result.Code = -1
return
}
@ -146,7 +146,11 @@ func PreferenceHandler(w http.ResponseWriter, r *http.Request) {
user.Lived = now
user.Updated = now
result.Succ = user.Save()
if user.Save() {
result.Code = 0
} else {
result.Code = -1
}
}
// FixedTimeSave saves online users' configurations periodically (1 minute).

View File

@ -439,7 +439,7 @@ var editors = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -587,7 +587,7 @@ var editors = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -617,7 +617,7 @@ var editors = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}

View File

@ -163,7 +163,7 @@ var menu = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (result.succ) {
if (0 == result.code) {
window.location.href = "/login";
}
}
@ -440,7 +440,7 @@ var menu = {
url: '/preference',
data: JSON.stringify(request),
success: function (result, textStatus, jqXHR) {
if (!result.succ) {
if (0 != result.code) {
return false;
}

View File

@ -373,7 +373,7 @@ var playground = {
playground.editor.setValue(data.code);
if (!result.succ) {
if (0 != result.code) {
console.log(data);
return;
}
@ -446,7 +446,7 @@ var playground = {
playground.editor.setValue(data.code);
playground.editor.setCursor(cursor);
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -466,7 +466,7 @@ var playground = {
$("#output").html(data.output);
if (!result.succ) {
if (0 != result.code) {
return;
}

View File

@ -164,7 +164,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogAlert").dialog("open", result.msg);
return false;
@ -190,7 +190,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogAlert").dialog("open", result.msg);
return false;
@ -220,7 +220,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (result.succ) {
if (0 == result.code) {
var $dirRMenu = $("#dirRMenu");
var $fileRMenu = $("#fileRMenu");
var setting = {
@ -374,7 +374,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogAlert").dialog("open", result.msg);
return false;
@ -463,7 +463,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -499,7 +499,7 @@ var tree = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogRenamePrompt").dialog("close");
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();

View File

@ -42,7 +42,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -125,7 +125,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogRemoveConfirm").dialog("close");
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();
@ -163,7 +163,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogNewFilePrompt").dialog("close");
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();
@ -207,7 +207,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogNewDirPrompt").dialog("close");
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();
@ -268,7 +268,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
return;
}
@ -443,7 +443,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (!result.succ) {
if (0 != result.code) {
$("#dialogAlert").dialog("open", result.msg);
return false;
@ -614,7 +614,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (result.succ) {
if (0 == result.code) {
editor.setValue(result.data.code);
editor.setCursor(cursor);
editor.scrollTo(null, scrollInfo.top);
@ -647,7 +647,7 @@ var wide = {
data: JSON.stringify(request),
dataType: "json",
success: function (result) {
if (result.succ) {
if (0 == result.code) {
formatted = result.data.code;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long