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
86b72f1a
Commit
86b72f1a
authored
Jun 14, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
赠送cp头像头饰 todo
parent
b93434ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
level.go
domain/model/cp_m/level.go
+7
-1
No files found.
domain/model/cp_m/level.go
View file @
86b72f1a
...
...
@@ -126,6 +126,7 @@ func InitCpLevel(model *domain.Model, cpId, userId1, userId2 mysql.ID) error {
}
// 增加cp等级积分
// 此函数并发不安全,利用mysql事件串行执行保证顺序
// 送礼1钻石=1点数
// condition
// 1.记录不存在,首充加points计算level增加90天有效期
...
...
@@ -137,6 +138,7 @@ func AddCpLevelPoints(model *domain.Model, cpRelation CpRelation, points mysql.N
defer
func
()
{
model
.
Log
.
Infof
(
"AddCpLevelPoints cost:%v,err:%v"
,
time
.
Now
()
.
Sub
(
start
),
err
)
}()
var
oldLevel
cp_e
.
CpLevel
var
cpLevel
CpLevel
var
cpLevelDetails
[]
CpLevelDetail
if
err
:=
model
.
DB
()
.
Model
(
CpLevel
{})
.
Where
(
"cp_id = ?"
,
cpRelation
.
Id
)
.
First
(
&
cpLevel
)
.
Error
;
err
!=
nil
{
...
...
@@ -200,7 +202,7 @@ func AddCpLevelPoints(model *domain.Model, cpRelation CpRelation, points mysql.N
AftNum
:
cpLevel
.
Points
,
Remark
:
fmt
.
Sprintf
(
"send %d gift diamonds"
,
points
),
})
oldLevel
:
=
cpLevel
.
Level
oldLevel
=
cpLevel
.
Level
levelPoint
:=
cp_e
.
CpLevelPoints
[
oldLevel
]
// 已经用于升级的积分
for
level
:=
cp_e
.
CpLevelMax
;
level
>
oldLevel
;
level
--
{
if
cp_e
.
CpLevelPoints
[
level
]
<=
cpLevel
.
Points
+
levelPoint
{
...
...
@@ -269,6 +271,10 @@ func AddCpLevelPoints(model *domain.Model, cpRelation CpRelation, points mysql.N
return
myerr
.
WrapErr
(
err
)
}
}
// 赠送cp头像头饰
if
oldLevel
<
3
&&
cpLevel
.
Level
>=
3
{
//headwear_tx.SendHeadwear() // todo headwear id !
}
return
cpLevel
.
Persistence
(
model
)
}
...
...
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