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
d2202b7d
Commit
d2202b7d
authored
Jun 02, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:applyToUnBind
parent
f4a18554
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
6 deletions
+38
-6
space.go
cv/cp_cv/space.go
+5
-4
level.go
domain/model/cp_m/level.go
+20
-0
space.go
route/cp_r/space.go
+13
-2
No files found.
cv/cp_cv/space.go
View file @
d2202b7d
...
@@ -15,7 +15,8 @@ type CvCpInfo struct {
...
@@ -15,7 +15,8 @@ type CvCpInfo struct {
UserInfo
user_cv
.
UserTiny
`json:"userInfo"`
// 用户信息
UserInfo
user_cv
.
UserTiny
`json:"userInfo"`
// 用户信息
CpUserInfo
user_cv
.
UserTiny
`json:"cpUserInfo"`
// cp用户信息
CpUserInfo
user_cv
.
UserTiny
`json:"cpUserInfo"`
// cp用户信息
CpDays
int
`json:"cpDays"`
// cp天数
CpDays
int
`json:"cpDays"`
// cp天数
VisitTimes
int
`json:"visitTimes"`
// 空间访问量
VisitTimes
int64
`json:"visitTimes"`
// 空间访问量
ApplyToUnbind
bool
`json:"applyToUnbind"`
// 是否申请撤销cp
}
}
// cp等级
// cp等级
...
...
domain/model/cp_m/level.go
View file @
d2202b7d
...
@@ -20,6 +20,17 @@ func (CpRelationTmp) TableName() string {
...
@@ -20,6 +20,17 @@ func (CpRelationTmp) TableName() string {
return
"cp_relation"
return
"cp_relation"
}
}
type
CpCancelTmp
struct
{
mysql
.
Entity
UserId
mysql
.
ID
RecUserId
mysql
.
ID
Status
int
// 状态1.未处理2.发起者已撤销3.对方已确认4.到期自动确认
}
func
(
CpCancelTmp
)
TableName
()
string
{
return
"cp_cancel"
}
// cp等级
// cp等级
type
CpLevel
struct
{
type
CpLevel
struct
{
mysql
.
Entity
mysql
.
Entity
...
@@ -107,6 +118,15 @@ func GetCpRelationPair(model *domain.Model, userId1, userId2 mysql.ID) (cpRelati
...
@@ -107,6 +118,15 @@ func GetCpRelationPair(model *domain.Model, userId1, userId2 mysql.ID) (cpRelati
return
return
}
}
// 获取是否申请解绑中
func
GetApplyToUnbind
(
model
*
domain
.
Model
,
userId
,
cpUserId
mysql
.
ID
)
bool
{
var
total
int64
if
err
:=
model
.
DB
()
.
Table
(
CpCancelTmp
{}
.
TableName
())
.
Where
(
"user_id = ? AND rec_user_id = ? AND status = 1"
,
userId
,
cpUserId
)
.
Count
(
&
total
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetApplyToUnbind fail:%v"
,
err
)
}
return
total
>
0
}
// 增加cp等级积分
// 增加cp等级积分
// 送礼1钻石=1点数
// 送礼1钻石=1点数
// condition
// condition
...
...
route/cp_r/space.go
View file @
d2202b7d
...
@@ -43,6 +43,8 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -43,6 +43,8 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
return
myContext
,
err
return
myContext
,
err
}
}
expireAtUnix
,
cpLevel
:=
int64
(
0
),
cp_e
.
CpLevel0
expireAtUnix
,
cpLevel
:=
int64
(
0
),
cp_e
.
CpLevel0
visitTimes
:=
int64
(
0
)
cpDays
,
applyToUnbind
:=
0
,
false
// todo cp时长
nextPoints
,
remainPoints
,
curPoints
:=
cp_e
.
CpLevelPoints
[
cp_e
.
CpLevel1
],
mysql
.
Num
(
0
),
mysql
.
Num
(
0
)
nextPoints
,
remainPoints
,
curPoints
:=
cp_e
.
CpLevelPoints
[
cp_e
.
CpLevel1
],
mysql
.
Num
(
0
),
mysql
.
Num
(
0
)
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
cpUserInfo
.
ID
)
cpRelation
,
exists
:=
cp_m
.
GetCpRelation
(
model
,
cpUserInfo
.
ID
)
if
exists
{
if
exists
{
...
@@ -58,6 +60,12 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -58,6 +60,12 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
});
err
!=
nil
{
});
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
visitTimes
=
cp_m
.
CountCpSpaceVisitors
(
model
,
cpRelation
.
ID
)
cpUserId
:=
cpRelation
.
UserId2
if
cpUserId
==
userId
{
cpUserId
=
cpRelation
.
UserId1
}
applyToUnbind
=
cp_m
.
GetApplyToUnbind
(
model
,
userId
,
cpUserId
)
}
}
if
cpLevel
!=
cp_e
.
CpLevelMax
{
if
cpLevel
!=
cp_e
.
CpLevelMax
{
nextPoints
=
cp_e
.
CpLevelPoints
[
cpLevel
+
1
]
nextPoints
=
cp_e
.
CpLevelPoints
[
cpLevel
+
1
]
...
@@ -77,6 +85,9 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -77,6 +85,9 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
CpInfo
:
cp_cv
.
CvCpInfo
{
CpInfo
:
cp_cv
.
CvCpInfo
{
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
),
UserInfo
:
user_cv
.
UserToTiny
(
*
userInfo
),
CpUserInfo
:
user_cv
.
UserToTiny
(
*
cpUserInfo
),
CpUserInfo
:
user_cv
.
UserToTiny
(
*
cpUserInfo
),
VisitTimes
:
visitTimes
,
CpDays
:
cpDays
,
ApplyToUnbind
:
applyToUnbind
,
},
},
CpLevel
:
cp_cv
.
CvCpLevel
{
CpLevel
:
cp_cv
.
CvCpLevel
{
Level
:
cpLevel
,
Level
:
cpLevel
,
...
...
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