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
e0e5d95e
Commit
e0e5d95e
authored
Jun 13, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cp-new' into feature/3.9.0
parents
44670695
8c40c987
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
17 deletions
+32
-17
level.go
_const/enum/cp_e/level.go
+9
-9
anniversary.go
domain/model/cp_m/anniversary.go
+23
-8
No files found.
_const/enum/cp_e/level.go
View file @
e0e5d95e
...
...
@@ -57,16 +57,16 @@ var (
CpPrivilegeActiveProfile
:
240
,
CpPrivilegeMicEffect
:
241
,
}
// cp特权描述
// todo 翻译
// cp特权描述
CpPrivilegeDescMsgId
=
map
[
CpPrivilege
]
uint
{
CpPrivilegeSpace
:
0
,
CpPrivilegeBanner
:
0
,
CpPrivilegeMedal
:
0
,
CpPrivilegeCert
:
0
,
CpPrivilegeRoomEffect
:
0
,
CpPrivilegeHeadwear
:
0
,
CpPrivilegeActiveProfile
:
0
,
CpPrivilegeMicEffect
:
0
,
CpPrivilegeSpace
:
264
,
CpPrivilegeBanner
:
265
,
CpPrivilegeMedal
:
266
,
CpPrivilegeCert
:
267
,
CpPrivilegeRoomEffect
:
268
,
CpPrivilegeHeadwear
:
269
,
CpPrivilegeActiveProfile
:
27
0
,
CpPrivilegeMicEffect
:
271
,
}
// cp特权icon // todo ui
CpPrivilegeIcon
=
map
[
CpPrivilege
]
string
{
...
...
domain/model/cp_m/anniversary.go
View file @
e0e5d95e
...
...
@@ -4,7 +4,9 @@ import (
"fmt"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/bluele/gcache"
"hilo-user/_const/enum/cp_e"
"hilo-user/domain/model/res_m"
"hilo-user/domain/model/user_m"
"time"
)
...
...
@@ -25,33 +27,46 @@ type CpAnniversary struct {
// 初始化6个cp纪念日
// 1)我们在一起;2)XXX的生日;3)XXX的生日;4)第一次说我爱你;5)第一次亲吻;6)结婚纪念日
// todo 翻译
func
InitCpAnniversary
(
model
*
domain
.
Model
,
cp
CpRelationTmp
)
error
{
func
InitCpAnniversary
(
model
*
domain
.
Model
,
cp
CpRelationTmp
,
lang
string
)
error
{
users
,
err
:=
user_m
.
GetUserMapByIds
(
model
,
[]
uint64
{
cp
.
UserId1
,
cp
.
UserId2
})
if
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
"我们在一起"
,
time
.
Now
()
.
Unix
(),
true
,
100
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
GetTranslate
(
259
,
lang
)
,
time
.
Now
()
.
Unix
(),
true
,
100
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
fmt
.
Sprintf
(
"%s的生日"
,
users
[
cp
.
UserId1
]
.
Nick
),
0
,
true
,
0
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
)
,
users
[
cp
.
UserId1
]
.
Nick
),
0
,
true
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
fmt
.
Sprintf
(
"%s的生日"
,
users
[
cp
.
UserId2
]
.
Nick
),
0
,
true
,
0
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
)
,
users
[
cp
.
UserId2
]
.
Nick
),
0
,
true
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
"第一次说我爱你"
,
0
,
false
,
0
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
GetTranslate
(
261
,
lang
)
,
0
,
false
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
"第一次亲吻"
,
0
,
false
,
0
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
GetTranslate
(
262
,
lang
)
,
0
,
false
,
0
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
"结婚纪念日"
,
0
,
false
,
0
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeAnniversary
,
cp
,
GetTranslate
(
263
,
lang
)
,
0
,
false
,
0
);
err
!=
nil
{
return
err
}
return
nil
}
var
translateCache
=
gcache
.
New
(
1000
)
.
LRU
()
.
Build
()
func
GetTranslate
(
msgId
uint
,
lang
string
)
string
{
key
:=
fmt
.
Sprintf
(
"%v-%v"
,
msgId
,
lang
)
if
data
,
err
:=
translateCache
.
Get
(
key
);
err
==
nil
{
return
data
.
(
string
)
}
if
resMul
,
_
:=
res_m
.
GetResMultiTextBy
(
mysql
.
Db
,
msgId
,
lang
);
resMul
!=
nil
{
_
=
translateCache
.
SetWithExpire
(
key
,
resMul
.
Content
,
time
.
Hour
)
return
resMul
.
Content
}
return
"default"
}
// 添加cp纪念日
func
AddCpAnniversary
(
model
*
domain
.
Model
,
Type
cp_e
.
AnniversaryItemType
,
cp
CpRelationTmp
,
content
string
,
ts
int64
,
isRemind
bool
,
sort
int
)
error
{
return
model
.
DB
()
.
Model
(
CpAnniversary
{})
.
Create
(
&
CpAnniversary
{
...
...
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