Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweijian
hilo-user
Commits
729c0d4f
Commit
729c0d4f
authored
Jun 14, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cp-new' into feature/3.9.0
parents
9f9b92a7
c1a7417e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
cp.go
cv/cp_cv/cp.go
+4
-3
inner.go
route/user_r/inner.go
+16
-6
No files found.
cv/cp_cv/cp.go
View file @
729c0d4f
...
...
@@ -13,7 +13,8 @@ type CvCp struct {
// cp关系
type
CvCpRelation
struct
{
CpId
uint64
`json:"cpId"`
UserId
uint64
`json:"userId"`
CpUserId
uint64
`json:"cpUserId"`
CpId
uint64
`json:"cpId"`
UserId
uint64
`json:"userId"`
CpUserId
uint64
`json:"cpUserId"`
CpUserAvatar
string
`json:"cpUserAvatar,omitempty"`
}
route/user_r/inner.go
View file @
729c0d4f
...
...
@@ -195,10 +195,12 @@ func GetUserCpRelation(c *gin.Context) (*mycontext.MyContext, error) {
if
cpUserId
==
userId
{
cpUserId
=
cpRelation
.
UserId1
}
cpUser
,
_
:=
user_m
.
GetUser
(
model
,
cpUserId
)
response
=
cp_cv
.
CvCpRelation
{
CpId
:
cpRelation
.
ID
,
UserId
:
userId
,
CpUserId
:
cpUserId
,
CpId
:
cpRelation
.
ID
,
UserId
:
userId
,
CpUserId
:
cpUserId
,
CpUserAvatar
:
cpUser
.
Avatar
,
}
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
...
...
@@ -222,9 +224,16 @@ func MGetUserCpRelation(c *gin.Context) (*mycontext.MyContext, error) {
}
cpRelations
:=
cp_m
.
MGetCpRelation
(
model
,
req
.
Ids
)
var
m
=
make
(
map
[
uint64
]
cp_m
.
CpRelationTmp
)
var
userIds
[]
uint64
for
i
,
v
:=
range
cpRelations
{
m
[
v
.
UserId1
]
=
cpRelations
[
i
]
m
[
v
.
UserId2
]
=
cpRelations
[
i
]
userIds
=
append
(
userIds
,
v
.
UserId1
)
userIds
=
append
(
userIds
,
v
.
UserId2
)
}
users
,
err
:=
user_m
.
GetUserMapByIds
(
model
,
userIds
)
if
err
!=
nil
{
return
myContext
,
err
}
var
response
=
make
(
map
[
uint64
]
cp_cv
.
CvCpRelation
)
for
_
,
uid
:=
range
req
.
Ids
{
...
...
@@ -234,9 +243,10 @@ func MGetUserCpRelation(c *gin.Context) (*mycontext.MyContext, error) {
cpUserId
=
cpRelation
.
UserId1
}
response
[
uid
]
=
cp_cv
.
CvCpRelation
{
CpId
:
cpRelation
.
ID
,
UserId
:
uid
,
CpUserId
:
cpUserId
,
CpId
:
cpRelation
.
ID
,
UserId
:
uid
,
CpUserId
:
cpUserId
,
CpUserAvatar
:
users
[
cpUserId
]
.
Avatar
,
}
}
}
...
...
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