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
95bd280f
Commit
95bd280f
authored
Jul 18, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
to txGroupIds
parent
312d9a7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
groupInfo.go
domain/model/group_m/groupInfo.go
+12
-0
gift.go
route/recommend_r/gift.go
+10
-0
No files found.
domain/model/group_m/groupInfo.go
View file @
95bd280f
...
...
@@ -76,6 +76,18 @@ func ToTxGroupId(model *domain.Model, imGroupId string) (string, error) {
return
gi
.
TxGroupId
,
nil
}
func
ToTxGroupIdMap
(
model
*
domain
.
Model
,
imGroupIds
[]
string
)
(
map
[
string
]
string
,
error
)
{
var
res
=
make
(
map
[
string
]
string
)
var
rows
[]
GroupInfo
if
err
:=
model
.
DB
()
.
Model
(
GroupInfo
{})
.
Where
(
"im_group_id in ?"
,
imGroupIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
return
res
,
err
}
for
_
,
v
:=
range
rows
{
res
[
v
.
ImGroupId
]
=
v
.
TxGroupId
}
return
res
,
nil
}
func
ToImGroupId
(
model
*
domain
.
Model
,
txGroupId
string
)
(
string
,
error
)
{
if
len
(
txGroupId
)
<=
0
{
return
""
,
nil
...
...
route/recommend_r/gift.go
View file @
95bd280f
...
...
@@ -43,6 +43,16 @@ func UserRecommendGift(c *gin.Context) (*mycontext.MyContext, error) {
rooms
,
err
:=
group_m
.
RoomLivingUserIdFilter
(
model
,
userIds
)
if
err
!=
nil
{
return
nil
,
err
}
else
if
len
(
rooms
)
>
0
{
// to txGroupIds
var
imGroupIds
[]
string
for
_
,
imGroupId
:=
range
rooms
{
imGroupIds
=
append
(
imGroupIds
,
imGroupId
)
}
txGroupIdsMap
,
_
:=
group_m
.
ToTxGroupIdMap
(
model
,
imGroupIds
)
for
uid
,
room
:=
range
rooms
{
rooms
[
uid
]
=
txGroupIdsMap
[
room
]
}
}
for
_
,
v
:=
range
recommendUser
{
response
=
append
(
response
,
RecommendUser
{
user_cv
.
UserToTiny
(
users
[
v
.
SendUserId
]),
rooms
[
v
.
SendUserId
]})
...
...
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