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
36497b1f
authored
Apr 01, 2020
by
keith
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
删除concat引发空指针问题
parent
5fb8f530
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
controllers/contact_controller.go
services/contact_service.go
controllers/contact_controller.go
View file @
36497b1f
...
...
@@ -61,10 +61,10 @@ func (c *ContactController) Delete() {
auth
:=
c
.
GetAdminAuthInfo
()
// delete
rows
,
err
:=
c
.
ContactRepository
.
Delete
(
id
,
auth
.
UID
)
rows
:=
c
.
ContactRepository
.
Delete
(
id
,
auth
.
UID
)
if
err
!=
nil
||
rows
==
0
{
c
.
JSON
(
configs
.
ResponseFail
,
"删除失败!"
,
err
.
Error
()
)
if
rows
==
0
{
c
.
JSON
(
configs
.
ResponseFail
,
"删除失败!"
,
nil
)
}
c
.
JSON
(
configs
.
ResponseSucess
,
"删除成功!"
,
rows
)
...
...
services/contact_service.go
View file @
36497b1f
...
...
@@ -14,7 +14,7 @@ type ContactRepositoryInterface interface {
GetContacts
(
uid
int64
)
([]
models
.
ContactDto
,
error
)
UpdateIsSessionEnd
(
uid
int64
)
(
int64
,
error
)
Update
(
id
int64
,
params
*
orm
.
Params
)
(
int64
,
error
)
Delete
(
id
int64
,
uid
int64
)
(
int64
,
error
)
Delete
(
id
int64
,
uid
int64
)
int64
DeleteAll
(
uid
int64
)
(
int64
,
error
)
Add
(
contact
*
models
.
Contact
)
(
int64
,
error
)
GetContactWithIds
(
ids
...
int64
)
(
*
models
.
Contact
,
error
)
...
...
@@ -112,13 +112,14 @@ func (r *ContactRepository) GetContacts(uid int64) ([]models.ContactDto, error)
}
// Delete delete a Contact
func
(
r
*
ContactRepository
)
Delete
(
id
int64
,
uid
int64
)
(
int64
,
error
)
{
func
(
r
*
ContactRepository
)
Delete
(
id
int64
,
uid
int64
)
int64
{
res
,
err
:=
r
.
o
.
Raw
(
"UPDATE `contact` SET `delete` = 1 WHERE id = ? AND to_account = ?"
,
id
,
uid
)
.
Exec
()
rows
,
_
:=
res
.
RowsAffected
()
if
err
!=
nil
{
logs
.
Warn
(
"GetContacts get Contacts err------------"
,
err
)
return
0
}
return
rows
,
err
rows
,
_
:=
res
.
RowsAffected
()
return
rows
}
...
...
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