Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
kefu_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e3fd893
authored
Jan 08, 2020
by
chenxianqi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update auth logout
parent
4c5fa99a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
controllers/auth.go
controllers/public.go
main.go
controllers/auth.go
View file @
6e3fd893
...
...
@@ -86,7 +86,7 @@ func (c *AuthController) Logout() {
_
=
o
.
Read
(
&
admin
,
"Token"
)
admin
.
Token
=
""
admin
.
CurrentConUser
=
0
if
_
,
err
:=
o
.
Update
(
&
admin
,
"Token"
,
"CurrentConUser"
);
err
!=
nil
{
if
_
,
err
:=
o
.
Update
(
&
admin
);
err
!=
nil
{
logs
.
Error
(
err
)
c
.
Data
[
"json"
]
=
utils
.
ResponseError
(
c
.
Ctx
,
"退出失败!"
,
nil
)
c
.
ServeJSON
()
...
...
controllers/public.go
View file @
6e3fd893
...
...
@@ -57,6 +57,7 @@ func (c *PublicController) Register() {
// user
var
user
models
.
User
var
admin
models
.
Admin
if
sessionRequest
.
Type
==
0
{
// platfrom id exist
...
...
@@ -116,7 +117,7 @@ func (c *PublicController) Register() {
token
:=
c
.
Ctx
.
Input
.
Header
(
"Authorization"
)
// admin
admin
:
=
models
.
Admin
{
Token
:
token
}
admin
=
models
.
Admin
{
Token
:
token
}
if
err
:=
o
.
Read
(
&
admin
,
"Token"
);
err
!=
nil
{
c
.
Data
[
"json"
]
=
utils
.
ResponseError
(
c
.
Ctx
,
"客服不存在!"
,
err
)
c
.
ServeJSON
()
...
...
@@ -145,7 +146,7 @@ func (c *PublicController) Register() {
if
sessionRequest
.
Type
==
0
{
resData
=
successData
{
Token
:
&
imToken
,
User
:
&
user
}
}
else
{
resData
=
successData
{
Token
:
&
imToken
,
User
:
nil
}
resData
=
successData
{
Token
:
&
imToken
,
User
:
&
admin
}
}
c
.
Data
[
"json"
]
=
utils
.
ResponseSuccess
(
c
.
Ctx
,
"获取成功!"
,
&
resData
)
c
.
ServeJSON
()
...
...
main.go
View file @
6e3fd893
...
...
@@ -88,7 +88,8 @@ func appTask() {
logs
.
Info
(
"清理登录超时用户,有"
,
count
,
"个用户被强制下线"
)
// 检查Admin
_
,
_
=
aqs
.
Filter
(
"online__in"
,
1
,
2
)
.
Filter
(
"last_activity__lte"
,
adminOffLineUnixTimer
)
.
Update
(
orm
.
Params
{
"online"
:
0
,
"online"
:
0
,
"current_con_user"
:
0
,
})
// 2.判断用户是否超时无应答
...
...
@@ -167,7 +168,7 @@ func appTask() {
// 任务调度(30分钟会执行一次删除客户token)
// deleteAdminTokenTk := toolbox.NewTask("deleteAdminToken", "0 */30 * * * *", func() error {
// o := o.QueryTable(new(models.Admin))
// o.
Filter("root", 0).
Update(orm.Params{
// o.Update(orm.Params{
// "token": "",
// })
// return nil
...
...
Write
Preview
Markdown
is supported
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