Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenhan wang
pastebin
Commits
0b90d795
Commit
0b90d795
authored
Jan 20, 2023
by
chenhan wang
Browse files
本地调试3.3
parent
6ebe6ace
Changes
4
Show whitespace changes
Inline
Side-by-side
backend/app/controller/interface.go
View file @
0b90d795
...
...
@@ -76,7 +76,6 @@ func SendFile(c echo.Context) error {
switch
stat
{
case
0
:
return
response
.
SendResponse
(
c
,
http
.
StatusForbidden
,
cookieMsg
+
"error:密码错误"
,
""
)
//403
//return c.JSON(http.StatusForbidden, "error:密码错误") // 403
case
1
:
// 鉴权通过
data
:=
model
.
Find1
(
info
.
Url
,
"content"
)
// 文件内容
typ
:=
model
.
Find1
(
info
.
Url
,
"fileType"
)
// 文件类型
...
...
@@ -84,10 +83,10 @@ func SendFile(c echo.Context) error {
return
response
.
SendResponse3
(
c
,
http
.
StatusOK
,
cookieMsg
+
"success"
,
name
,
GetFileContentType
(
typ
),
data
)
// 返回数据
case
2
:
return
response
.
SendResponse
(
c
,
http
.
StatusGone
,
cookieMsg
+
"error:内容过期"
,
""
)
//410
//return c.HTML(http.StatusGone, "error:内容过期")
case
3
:
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
}
...
...
backend/app/init.go
View file @
0b90d795
...
...
@@ -21,7 +21,7 @@ func InitWebFramework() {
}
func
StartServer
()
{
e
.
Logger
.
Fatal
(
e
.
Start
(
controller
.
GetSetting
(
"
test
url"
)))
// 启动服务,注意默认端口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("http://xlab.zju.edu.cn/test/pastebin/group-1:80")) // 启动服务,注意默认端口80不能省略,需要域名解析,config
}
...
...
backend/model/init.go
View file @
0b90d795
...
...
@@ -97,7 +97,7 @@ func Checkt(p Content) bool {
}
// 这个函数那边有可能需要
// 检查sid是否超
时
// 检查sid是否超
func
Checkt1
(
sid
string
)
bool
{
var
s
Sid
DB
.
First
(
&
s
,
"S = ?"
,
sid
)
...
...
backend/mysql/pastebinTable.sql
View file @
0b90d795
...
...
@@ -85,6 +85,7 @@ CREATE TABLE `sids` (
`created_at`
datetime
(
3
)
DEFAULT
NULL
,
`updated_at`
datetime
(
3
)
DEFAULT
NULL
,
`deleted_at`
datetime
(
3
)
DEFAULT
NULL
,
`time`
datetime
(
3
)
DEFAULT
NULL
,
`s`
longtext
,
PRIMARY
KEY
(
`id`
),
KEY
`idx_sids_deleted_at`
(
`deleted_at`
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment