Commit 0b90d795 authored by chenhan wang's avatar chenhan wang
Browse files

本地调试3.3

parent 6ebe6ace
...@@ -76,7 +76,6 @@ func SendFile(c echo.Context) error { ...@@ -76,7 +76,6 @@ func SendFile(c echo.Context) error {
switch stat { switch stat {
case 0: case 0:
return response.SendResponse(c, http.StatusForbidden, cookieMsg+"error:密码错误", "") //403 return response.SendResponse(c, http.StatusForbidden, cookieMsg+"error:密码错误", "") //403
//return c.JSON(http.StatusForbidden, "error:密码错误") // 403
case 1: // 鉴权通过 case 1: // 鉴权通过
data := model.Find1(info.Url, "content") // 文件内容 data := model.Find1(info.Url, "content") // 文件内容
typ := model.Find1(info.Url, "fileType") // 文件类型 typ := model.Find1(info.Url, "fileType") // 文件类型
...@@ -84,10 +83,10 @@ func SendFile(c echo.Context) error { ...@@ -84,10 +83,10 @@ func SendFile(c echo.Context) error {
return response.SendResponse3(c, http.StatusOK, cookieMsg+"success", name, GetFileContentType(typ), data) // 返回数据 return response.SendResponse3(c, http.StatusOK, cookieMsg+"success", name, GetFileContentType(typ), data) // 返回数据
case 2: case 2:
return response.SendResponse(c, http.StatusGone, cookieMsg+"error:内容过期", "") //410 return response.SendResponse(c, http.StatusGone, cookieMsg+"error:内容过期", "") //410
//return c.HTML(http.StatusGone, "error:内容过期")
case 3: case 3:
return response.SendResponse(c, http.StatusUnauthorized, cookieMsg+"error:内容过期", "") //401 return response.SendResponse(c, http.StatusUnauthorized, cookieMsg+"error:内容过期", "") //401
//return c.HTML(http.StatusUnauthorized, "请进行身份验证") case 4:
return response.SendResponse(c, http.StatusInternalServerError, cookieMsg+"error:Internal Server Error", "") //500
} }
return nil return nil
} }
......
...@@ -21,7 +21,7 @@ func InitWebFramework() { ...@@ -21,7 +21,7 @@ func InitWebFramework() {
} }
func StartServer() { func StartServer() {
e.Logger.Fatal(e.Start(controller.GetSetting("testurl"))) // 启动服务,注意默认端口80不能省略 e.Logger.Fatal(e.Start(controller.GetSetting("url"))) // 启动服务,注意默认端口80不能省略
//e.Logger.Fatal(e.Start("127.0.0.1:80")) // 启动服务,注意默认端口80不能省略 //e.Logger.Fatal(e.Start("127.0.0.1:80")) // 启动服务,注意默认端口80不能省略
//e.Logger.Fatal(e.Start("http://xlab.zju.edu.cn/test/pastebin/group-1:80")) // 启动服务,注意默认端口80不能省略,需要域名解析,config //e.Logger.Fatal(e.Start("http://xlab.zju.edu.cn/test/pastebin/group-1:80")) // 启动服务,注意默认端口80不能省略,需要域名解析,config
} }
......
...@@ -97,7 +97,7 @@ func Checkt(p Content) bool { ...@@ -97,7 +97,7 @@ func Checkt(p Content) bool {
} }
// 这个函数那边有可能需要 // 这个函数那边有可能需要
// 检查sid是否超 // 检查sid是否超
func Checkt1(sid string) bool { func Checkt1(sid string) bool {
var s Sid var s Sid
DB.First(&s, "S = ?", sid) DB.First(&s, "S = ?", sid)
......
...@@ -85,6 +85,7 @@ CREATE TABLE `sids` ( ...@@ -85,6 +85,7 @@ CREATE TABLE `sids` (
`created_at` datetime(3) DEFAULT NULL, `created_at` datetime(3) DEFAULT NULL,
`updated_at` datetime(3) DEFAULT NULL, `updated_at` datetime(3) DEFAULT NULL,
`deleted_at` datetime(3) DEFAULT NULL, `deleted_at` datetime(3) DEFAULT NULL,
`time` datetime(3) DEFAULT NULL,
`s` longtext, `s` longtext,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_sids_deleted_at` (`deleted_at`) KEY `idx_sids_deleted_at` (`deleted_at`)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment