Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
barry cho
Bbsgo
Commits
ea41fc6e
Commit
ea41fc6e
authored
4 years ago
by
mlogclub
Browse files
Options
Download
Email Patches
Plain Diff
观察期时长单位修改为秒
parent
27a0ab45
master
dev
3.3.2
v3.4.3
v3.4.2
v3.4.1
v3.4.0
v3.3.2
v3.3.1
v3.3.0
v3.2.6
v3.2.5
v3.2.4
v3.2.3
v3.2.2
v3.2.1
v3.2.0
v3.1.9
v3.1.8
v3.1.7
v3.1.6
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
server/model/constants/constants.go
+12
-12
server/model/constants/constants.go
server/model/data.go
+12
-12
server/model/data.go
server/model/model_methods.go
+5
-4
server/model/model_methods.go
server/services/sys_config_service.go
+26
-26
server/services/sys_config_service.go
server/services/user_service.go
+3
-3
server/services/user_service.go
site/pages/admin/settings/index.vue
+2
-2
site/pages/admin/settings/index.vue
with
60 additions
and
59 deletions
+60
-59
server/model/constants/constants.go
+
12
-
12
View file @
ea41fc6e
...
...
@@ -2,18 +2,18 @@ package constants
// 系统配置
const
(
SysConfigSiteTitle
=
"siteTitle"
// 站点标题
SysConfigSiteDescription
=
"siteDescription"
// 站点描述
SysConfigSiteKeywords
=
"siteKeywords"
// 站点关键字
SysConfigSiteNavs
=
"siteNavs"
// 站点导航
SysConfigSiteNotification
=
"siteNotification"
// 站点公告
SysConfigRecommendTags
=
"recommendTags"
// 推荐标签
SysConfigUrlRedirect
=
"urlRedirect"
// 是否开启链接跳转
SysConfigScoreConfig
=
"scoreConfig"
// 分数配置
SysConfigDefaultNodeId
=
"defaultNodeId"
// 发帖默认节点
SysConfigArticlePending
=
"articlePending"
// 是否开启文章审核
SysConfigTopicCaptcha
=
"topicCaptcha"
// 是否开启发帖验证码
SysConfigUserObserve
Hour
=
"userObserve
Hour"
// 新用户观察期
SysConfigSiteTitle
=
"siteTitle"
// 站点标题
SysConfigSiteDescription
=
"siteDescription"
// 站点描述
SysConfigSiteKeywords
=
"siteKeywords"
// 站点关键字
SysConfigSiteNavs
=
"siteNavs"
// 站点导航
SysConfigSiteNotification
=
"siteNotification"
// 站点公告
SysConfigRecommendTags
=
"recommendTags"
// 推荐标签
SysConfigUrlRedirect
=
"urlRedirect"
// 是否开启链接跳转
SysConfigScoreConfig
=
"scoreConfig"
// 分数配置
SysConfigDefaultNodeId
=
"defaultNodeId"
// 发帖默认节点
SysConfigArticlePending
=
"articlePending"
// 是否开启文章审核
SysConfigTopicCaptcha
=
"topicCaptcha"
// 是否开启发帖验证码
SysConfigUserObserve
Seconds
=
"userObserve
Seconds"
// 新用户观察期
)
// EntityType
...
...
This diff is collapsed.
Click to expand it.
server/model/data.go
+
12
-
12
View file @
ea41fc6e
...
...
@@ -14,16 +14,16 @@ type ScoreConfig struct {
// 配置返回结构体
type
ConfigData
struct
{
SiteTitle
string
`json:"siteTitle"`
SiteDescription
string
`json:"siteDescription"`
SiteKeywords
[]
string
`json:"siteKeywords"`
SiteNavs
[]
ActionLink
`json:"siteNavs"`
SiteNotification
string
`json:"siteNotification"`
RecommendTags
[]
string
`json:"recommendTags"`
UrlRedirect
bool
`json:"urlRedirect"`
ScoreConfig
ScoreConfig
`json:"scoreConfig"`
DefaultNodeId
int64
`json:"defaultNodeId"`
ArticlePending
bool
`json:"articlePending"`
TopicCaptcha
bool
`json:"topicCaptcha"`
UserObserve
Hour
int
`json:"userObserve
Hour
"`
SiteTitle
string
`json:"siteTitle"`
SiteDescription
string
`json:"siteDescription"`
SiteKeywords
[]
string
`json:"siteKeywords"`
SiteNavs
[]
ActionLink
`json:"siteNavs"`
SiteNotification
string
`json:"siteNotification"`
RecommendTags
[]
string
`json:"recommendTags"`
UrlRedirect
bool
`json:"urlRedirect"`
ScoreConfig
ScoreConfig
`json:"scoreConfig"`
DefaultNodeId
int64
`json:"defaultNodeId"`
ArticlePending
bool
`json:"articlePending"`
TopicCaptcha
bool
`json:"topicCaptcha"`
UserObserve
Seconds
int
`json:"userObserve
Seconds
"`
}
This diff is collapsed.
Click to expand it.
server/model/model_methods.go
+
5
-
4
View file @
ea41fc6e
...
...
@@ -60,10 +60,11 @@ func (u *User) GetRoles() []string {
return
roles
}
// InObservationPeriod 是否在观察期,observeHour观察时长
func
(
u
*
User
)
InObservationPeriod
(
observeHour
int
)
bool
{
if
observeHour
<=
0
{
// InObservationPeriod 是否在观察期
// observeSeconds 观察时长
func
(
u
*
User
)
InObservationPeriod
(
observeSeconds
int
)
bool
{
if
observeSeconds
<=
0
{
return
false
}
return
simple
.
TimeFromTimestamp
(
u
.
CreateTime
)
.
Add
(
time
.
Hour
*
time
.
Duration
(
observe
Hour
))
.
After
(
time
.
Now
())
return
simple
.
TimeFromTimestamp
(
u
.
CreateTime
)
.
Add
(
time
.
Second
*
time
.
Duration
(
observe
Seconds
))
.
After
(
time
.
Now
())
}
This diff is collapsed.
Click to expand it.
server/services/sys_config_service.go
+
26
-
26
View file @
ea41fc6e
...
...
@@ -117,18 +117,18 @@ func (s *sysConfigService) setSingle(db *gorm.DB, key, value, name, description
func
(
s
*
sysConfigService
)
GetConfig
()
*
model
.
ConfigData
{
var
(
siteTitle
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteTitle
)
siteDescription
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteDescription
)
siteKeywords
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteKeywords
)
siteNavs
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteNavs
)
siteNotification
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteNotification
)
recommendTags
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigRecommendTags
)
urlRedirect
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigUrlRedirect
)
scoreConfigStr
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigScoreConfig
)
defaultNodeIdStr
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigDefaultNodeId
)
articlePending
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigArticlePending
)
topicCaptcha
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigTopicCaptcha
)
userObserve
Hour
Str
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigUserObserve
Hour
)
siteTitle
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteTitle
)
siteDescription
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteDescription
)
siteKeywords
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteKeywords
)
siteNavs
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteNavs
)
siteNotification
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigSiteNotification
)
recommendTags
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigRecommendTags
)
urlRedirect
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigUrlRedirect
)
scoreConfigStr
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigScoreConfig
)
defaultNodeIdStr
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigDefaultNodeId
)
articlePending
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigArticlePending
)
topicCaptcha
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigTopicCaptcha
)
userObserve
Seconds
Str
=
cache
.
SysConfigCache
.
GetValue
(
constants
.
SysConfigUserObserve
Seconds
)
)
var
siteKeywordsArr
[]
string
...
...
@@ -160,23 +160,23 @@ func (s *sysConfigService) GetConfig() *model.ConfigData {
}
var
(
defaultNodeId
,
_
=
strconv
.
ParseInt
(
defaultNodeIdStr
,
10
,
64
)
userObserve
Hour
,
_
=
strconv
.
Atoi
(
userObserve
Hour
Str
)
defaultNodeId
,
_
=
strconv
.
ParseInt
(
defaultNodeIdStr
,
10
,
64
)
userObserve
Seconds
,
_
=
strconv
.
Atoi
(
userObserve
Seconds
Str
)
)
return
&
model
.
ConfigData
{
SiteTitle
:
siteTitle
,
SiteDescription
:
siteDescription
,
SiteKeywords
:
siteKeywordsArr
,
SiteNavs
:
siteNavsArr
,
SiteNotification
:
siteNotification
,
RecommendTags
:
recommendTagsArr
,
UrlRedirect
:
strings
.
ToLower
(
urlRedirect
)
==
"true"
,
ScoreConfig
:
scoreConfig
,
DefaultNodeId
:
defaultNodeId
,
ArticlePending
:
strings
.
ToLower
(
articlePending
)
==
"true"
,
TopicCaptcha
:
strings
.
ToLower
(
topicCaptcha
)
==
"true"
,
UserObserve
Hour
:
userObserve
Hour
,
SiteTitle
:
siteTitle
,
SiteDescription
:
siteDescription
,
SiteKeywords
:
siteKeywordsArr
,
SiteNavs
:
siteNavsArr
,
SiteNotification
:
siteNotification
,
RecommendTags
:
recommendTagsArr
,
UrlRedirect
:
strings
.
ToLower
(
urlRedirect
)
==
"true"
,
ScoreConfig
:
scoreConfig
,
DefaultNodeId
:
defaultNodeId
,
ArticlePending
:
strings
.
ToLower
(
articlePending
)
==
"true"
,
TopicCaptcha
:
strings
.
ToLower
(
topicCaptcha
)
==
"true"
,
UserObserve
Seconds
:
userObserve
Seconds
,
}
}
...
...
This diff is collapsed.
Click to expand it.
server/services/user_service.go
+
3
-
3
View file @
ea41fc6e
...
...
@@ -508,9 +508,9 @@ func (s *userService) CheckPostStatus(user *model.User) *simple.CodeError {
if
user
.
IsForbidden
()
{
return
common
.
ForbiddenError
}
observe
Hour
:=
SysConfigService
.
GetInt
(
constants
.
SysConfigUserObserve
Hour
)
if
user
.
InObservationPeriod
(
observe
Hour
)
{
return
simple
.
NewError
(
common
.
InObservationPeriod
.
Code
,
"账号尚在观察期,观察期时长:"
+
strconv
.
Itoa
(
observe
Hour
)
+
"
小时
,请稍后再试"
)
observe
Seconds
:=
SysConfigService
.
GetInt
(
constants
.
SysConfigUserObserve
Seconds
)
if
user
.
InObservationPeriod
(
observe
Seconds
)
{
return
simple
.
NewError
(
common
.
InObservationPeriod
.
Code
,
"账号尚在观察期,观察期时长:"
+
strconv
.
Itoa
(
observe
Seconds
)
+
"
秒
,请稍后再试"
)
}
return
nil
}
This diff is collapsed.
Click to expand it.
site/pages/admin/settings/index.vue
+
2
-
2
View file @
ea41fc6e
...
...
@@ -98,10 +98,10 @@
placement=
"top"
>
<el-input-number
v-model=
"config.userObserve
Hour
"
v-model=
"config.userObserve
Seconds
"
:min=
"0"
:max=
"720"
label=
"用户观察期(
小时
)"
label=
"用户观察期(
秒
)"
></el-input-number>
</el-tooltip>
</el-form-item>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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
Menu
Projects
Groups
Snippets
Help