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
d3f8d8fe
Commit
d3f8d8fe
authored
Jul 11, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update gift.go
parent
7b53b832
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
gift.go
route/recommend_r/gift.go
+13
-3
No files found.
route/recommend_r/gift.go
View file @
d3f8d8fe
...
...
@@ -6,22 +6,28 @@ import (
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/gin-gonic/gin"
"hilo-user/cv/user_cv"
"hilo-user/domain/model/group_m"
"hilo-user/domain/model/recommend_m"
"hilo-user/domain/model/user_m"
"hilo-user/resp"
)
type
RecommendUser
struct
{
*
user_cv
.
UserTiny
`json:",inline"`
CurrentRoom
string
`json:"currentRoom"`
// 当前用户所在房间(产品叫“群组”)
}
// @Tags 用户推荐
// @Summary 推荐最近送礼的50人,最近12小时赠送礼物大于100k的用户
// @Param token header string true "token"
// @Success 200 {object} []
user_cv.UserTiny
// @Success 200 {object} []
RecommendUser
// @Router /v1/recommend/user/gift [get]
func
UserRecommendGift
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
model
:=
domain
.
CreateModelContext
(
myContext
)
// 获取推荐
recommendUser
:=
recommend_m
.
GetPastTop50SendGiftUsers
(
model
)
var
response
=
make
([]
*
user_cv
.
UserTiny
,
0
)
var
response
=
make
([]
RecommendUser
,
0
)
if
len
(
recommendUser
)
<=
0
{
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
nil
...
...
@@ -34,8 +40,12 @@ func UserRecommendGift(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
err
}
rooms
,
err
:=
group_m
.
RoomLivingUserIdFilter
(
model
,
userIds
)
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
v
:=
range
recommendUser
{
response
=
append
(
response
,
user_cv
.
UserToTiny
(
users
[
v
.
SendUserId
])
)
response
=
append
(
response
,
RecommendUser
{
user_cv
.
UserToTiny
(
users
[
v
.
SendUserId
]),
rooms
[
v
.
SendUserId
]}
)
}
resp
.
ResponseOk
(
c
,
response
)
return
myContext
,
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