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
1babf36f
Commit
1babf36f
authored
Jun 28, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
派对邀请
parent
8874a8e0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
9 deletions
+165
-9
invite_apply.go
cv/invite_cv/invite_apply.go
+21
-0
invite_apply.go
domain/model/invite_m/invite_apply.go
+33
-8
新人派对申请.sql
mysql/新人派对申请.sql
+1
-0
response.go
resp/response.go
+26
-0
party_invite.go
route/invite_r/party_invite.go
+82
-0
router.go
route/router.go
+2
-1
No files found.
cv/invite_cv/invite_apply.go
0 → 100644
View file @
1babf36f
package
invite_cv
import
"git.hilo.cn/hilo-common/resource/mysql"
type
CvUserLevel
struct
{
UserId
mysql
.
ID
`json:"userId"`
// 用户id
WealthUserGrade
uint32
`json:"wealthUserGrade"`
// 财富等级
CharmUserGrade
uint32
`json:"charmUserGrade"`
// 魅力等级
ActiveUserGrade
uint32
`json:"activeUserGrade"`
// 活跃等级
NobleLevel
uint16
`json:"nobleLevel"`
// 贵族等级
}
type
InviteApplyRes
struct
{
NewUserCode
string
`json:"newUserCode"`
Platform
string
`json:"platform"`
Recharge
string
`json:"recharge"`
UserCode
string
`json:"userCode"`
CreateUnix
int64
`json:"createUnix"`
Level
string
`json:"level"`
Status
uint8
`json:"status"`
// 状态0.未审核1.已通过2.已拒绝
}
domain/model/invite_m/invite_apply.go
View file @
1babf36f
package
invite_m
package
invite_m
import
"git.hilo.cn/hilo-common/domain"
import
(
"git.hilo.cn/hilo-common/domain"
"time"
)
type
InviteApply
struct
{
type
InviteApply
struct
{
Id
uint64
`json:"id"`
Id
uint64
`json:"id"`
...
@@ -10,6 +13,8 @@ type InviteApply struct {
...
@@ -10,6 +13,8 @@ type InviteApply struct {
RechargeInfo
string
`json:"recharge_info"`
RechargeInfo
string
`json:"recharge_info"`
Status
uint8
`json:"status"`
// 状态0.未审核1.已通过2.已拒绝
Status
uint8
`json:"status"`
// 状态0.未审核1.已通过2.已拒绝
VideoUrl
string
`json:"video_url"`
VideoUrl
string
`json:"video_url"`
Level
string
`json:"level"`
CreatedTime
time
.
Time
`json:"created_time"`
}
}
func
CreateInviteApply
(
model
*
domain
.
Model
,
userId
,
newUserId
uint64
,
platform
,
recharge
,
videoUrl
string
)
error
{
func
CreateInviteApply
(
model
*
domain
.
Model
,
userId
,
newUserId
uint64
,
platform
,
recharge
,
videoUrl
string
)
error
{
...
@@ -20,3 +25,23 @@ func CreateInviteApply(model *domain.Model, userId, newUserId uint64, platform,
...
@@ -20,3 +25,23 @@ func CreateInviteApply(model *domain.Model, userId, newUserId uint64, platform,
}
}
return
nil
return
nil
}
}
func
GetApplyList
(
model
*
domain
.
Model
,
userId
uint64
,
pageIndex
,
pageSize
,
gType
int
,
beginTime
,
endTime
time
.
Time
)
([]
*
InviteApply
,
int64
,
error
)
{
db
:=
model
.
DB
()
.
Model
(
InviteApply
{})
.
Where
(
"user_id = ?"
,
userId
)
.
Where
(
"created_time >= ? and created_time <= ?"
,
beginTime
,
endTime
)
switch
gType
{
// 1.已申请2.待审核3.已通过4.已拒绝
case
2
:
db
=
db
.
Where
(
"`status` = ?"
,
0
)
case
3
:
db
=
db
.
Where
(
"`status` = ?"
,
1
)
case
4
:
db
=
db
.
Where
(
"`status` = ?"
,
2
)
}
res
:=
make
([]
*
InviteApply
,
0
)
var
count
int64
err
:=
db
.
Order
(
"id desc"
)
.
Offset
((
pageIndex
-
1
)
*
pageSize
)
.
Find
(
&
res
)
.
Limit
(
-
1
)
.
Offset
(
-
1
)
.
Count
(
&
count
)
.
Error
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetApplyList err:%v"
,
err
)
return
nil
,
0
,
err
}
return
res
,
count
,
nil
}
mysql/新人派对申请.sql
View file @
1babf36f
...
@@ -5,6 +5,7 @@ CREATE TABLE `invite_apply` (
...
@@ -5,6 +5,7 @@ CREATE TABLE `invite_apply` (
`platform`
varchar
(
20
)
NOT
NULL
COMMENT
'从那个平台过来'
,
`platform`
varchar
(
20
)
NOT
NULL
COMMENT
'从那个平台过来'
,
`recharge_info`
varchar
(
50
)
NOT
NULL
COMMENT
'新用户在其它平台充值的标志'
,
`recharge_info`
varchar
(
50
)
NOT
NULL
COMMENT
'新用户在其它平台充值的标志'
,
`status`
tinyint
unsigned
NOT
NULL
COMMENT
'状态0.未审核1.已通过2.已拒绝'
,
`status`
tinyint
unsigned
NOT
NULL
COMMENT
'状态0.未审核1.已通过2.已拒绝'
,
`level`
varchar
(
5
)
NOT
NULL
DEFAULT
''
COMMENT
'申请等级(S,A,B,C)'
,
`video_url`
varchar
(
400
)
NOT
NULL
COMMENT
'上传的视频url'
,
`video_url`
varchar
(
400
)
NOT
NULL
COMMENT
'上传的视频url'
,
`created_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`created_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`updated_time`
timestamp
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
...
...
resp/response.go
View file @
1babf36f
...
@@ -63,6 +63,32 @@ func ResponsePageBaseOk(c *gin.Context, data interface{}, nextPageIndex int, has
...
@@ -63,6 +63,32 @@ func ResponsePageBaseOk(c *gin.Context, data interface{}, nextPageIndex int, has
c
.
JSON
(
http
.
StatusOK
,
response
)
c
.
JSON
(
http
.
StatusOK
,
response
)
}
}
// 分页返回
// 客户端入参 req.PageReqBase
// 服务端返回 req.PageRespBase
func
ResponsePageOk
(
c
*
gin
.
Context
,
data
interface
{},
total
int64
,
pageSize
,
pageIndex
int
)
{
if
data
==
nil
{
data
=
make
([]
interface
{},
0
)
}
nextPageIndex
:=
0
hasNextPage
:=
false
if
(
pageIndex
-
1
)
*
pageSize
+
pageSize
-
1
<
int
(
total
)
{
nextPageIndex
=
pageIndex
+
1
hasNextPage
=
true
}
response
:=
Response
{
Code
:
myerr
.
GetSuccessCode
(),
Message
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
Data
:
req
.
PageRespBase
{
NextPageIndex
:
nextPageIndex
,
HasNextPage
:
hasNextPage
,
Data
:
data
,
},
}
c
.
JSON
(
http
.
StatusOK
,
response
)
}
func
ResponseWaring
(
c
*
gin
.
Context
,
waringError
*
myerr
.
WaringError
)
{
func
ResponseWaring
(
c
*
gin
.
Context
,
waringError
*
myerr
.
WaringError
)
{
response
:=
Response
{
response
:=
Response
{
Code
:
waringError
.
GetCode
(),
Code
:
waringError
.
GetCode
(),
...
...
route/invite_r/party_invite.go
View file @
1babf36f
...
@@ -3,12 +3,18 @@ package invite_r
...
@@ -3,12 +3,18 @@ package invite_r
import
(
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"hilo-user/cv/invite_cv"
"hilo-user/domain/cache/user_c"
"hilo-user/domain/model/invite_m"
"hilo-user/domain/model/invite_m"
"hilo-user/domain/model/promotion_m"
"hilo-user/domain/model/promotion_m"
"hilo-user/domain/model/user_m"
"hilo-user/domain/model/user_m"
"hilo-user/myerr"
"hilo-user/myerr/bizerr"
"hilo-user/myerr/bizerr"
"hilo-user/req"
"hilo-user/resp"
"hilo-user/resp"
"time"
)
)
// @Tags 新人邀请
// @Tags 新人邀请
...
@@ -88,3 +94,79 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -88,3 +94,79 @@ func InviteApply(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
nil
)
resp
.
ResponseOk
(
c
,
nil
)
return
myCtx
,
nil
return
myCtx
,
nil
}
}
// @Tags 新人邀请
// @Summary 查询历史申请
// @Param pageIndex query int true "偏移值 默认:1" default(1)
// @Param pageSize query int true "请求数量 默认:10" default(10)
// @Param beginTime query string true "开始时间2006-01-02"
// @Param endTime query string true "结束时间2006-01-02"
// @Param type query int true "1.已申请2.待审核3.已通过4.已拒绝"
// @Success 200 {object} invite_cv.InviteApplyRes
// @Router /v2/user/invite/apply [get]
func
InviteApplyList
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myCtx
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
type
paramStr
struct
{
PageIndex
int
`form:"pageIndex" binding:"required"`
PageSize
int
`form:"pageSize" binding:"required"`
BeginTime
string
`form:"beginTime" binding:"required"`
EndTime
string
`form:"endTime" binding:"required"`
Type
int
`form:"type" binding:"required"`
}
var
param
paramStr
if
err
:=
c
.
ShouldBindQuery
(
&
param
);
err
!=
nil
{
return
myCtx
,
err
}
if
param
.
Type
<
1
||
param
.
Type
>
4
{
return
myCtx
,
bizerr
.
InvalidParameter
}
beginTime
,
err
:=
time
.
ParseInLocation
(
utils
.
DATE_FORMAT
,
param
.
BeginTime
,
time
.
Local
)
if
err
!=
nil
{
return
nil
,
myerr
.
WrapErr
(
err
)
}
endTime
,
err
:=
time
.
ParseInLocation
(
utils
.
DATE_FORMAT
,
param
.
EndTime
,
time
.
Local
)
if
err
!=
nil
{
return
nil
,
myerr
.
WrapErr
(
err
)
}
endTime
=
utils
.
GetDayEndTime
(
endTime
)
userId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myCtx
,
err
}
var
model
=
domain
.
CreateModelContext
(
myCtx
)
list
,
total
,
err
:=
invite_m
.
GetApplyList
(
model
,
userId
,
param
.
PageIndex
,
param
.
PageSize
,
param
.
Type
,
beginTime
,
endTime
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetApplyList param:%v, err:%v"
,
param
,
err
)
return
myCtx
,
err
}
uids
:=
make
([]
uint64
,
0
,
len
(
list
)
+
1
)
for
_
,
v
:=
range
list
{
uids
=
append
(
uids
,
v
.
UserId
,
v
.
NewUserId
)
}
users
,
err
:=
user_c
.
GetUserTinyMap
(
model
,
uids
,
false
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetApplyList param:%v, err:%v"
,
param
,
err
)
return
myCtx
,
err
}
res
:=
make
([]
*
invite_cv
.
InviteApplyRes
,
0
,
len
(
list
))
for
_
,
v
:=
range
list
{
res
=
append
(
res
,
&
invite_cv
.
InviteApplyRes
{
NewUserCode
:
users
[
v
.
NewUserId
]
.
Code
,
Platform
:
v
.
Platform
,
Recharge
:
v
.
RechargeInfo
,
UserCode
:
users
[
v
.
UserId
]
.
Code
,
CreateUnix
:
v
.
CreatedTime
.
Unix
(),
Level
:
v
.
Level
,
Status
:
v
.
Status
,
})
}
resp
.
ResponsePageOk
(
c
,
res
,
total
,
param
.
PageSize
,
param
.
PageIndex
)
return
myCtx
,
nil
}
route/router.go
View file @
1babf36f
...
@@ -55,7 +55,8 @@ func InitRouter() *gin.Engine {
...
@@ -55,7 +55,8 @@ func InitRouter() *gin.Engine {
}
}
userV2
:=
v2
.
Group
(
"/user"
)
userV2
:=
v2
.
Group
(
"/user"
)
{
{
userV2
.
GET
(
"/invite/apply"
,
wrapper
(
invite_r
.
InviteApply
))
userV2
.
POST
(
"/invite/apply"
,
wrapper
(
invite_r
.
InviteApply
))
userV2
.
GET
(
"/invite/apply"
,
wrapper
(
invite_r
.
InviteApplyList
))
}
}
inner
:=
r
.
Group
(
"/inner"
)
inner
:=
r
.
Group
(
"/inner"
)
inner
.
Use
(
ExceptionHandle
,
LoggerHandle
)
inner
.
Use
(
ExceptionHandle
,
LoggerHandle
)
...
...
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