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
dc465373
Commit
dc465373
authored
Jun 17, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
70fb5d05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
headwear.go
cv/headwear_cv/headwear.go
+24
-20
headwear.go
domain/model/res_m/headwear.go
+6
-5
No files found.
cv/headwear_cv/headwear.go
View file @
dc465373
...
...
@@ -14,12 +14,13 @@ import (
)
type
CvHeadwear
struct
{
Id
uint64
`json:"id"`
Using
bool
`json:"using"`
PicUrl
mysql
.
Str
`json:"picUrl"`
EffectUrl
mysql
.
Str
`json:"effectUrl"`
TimeLeft
int64
`json:"timeLeft"`
// 离到期还有多少秒(过期则是负数)
HeadwearIcon
string
`json:"headwearIcon"`
Id
uint64
`json:"id"`
Using
bool
`json:"using"`
PicUrl
mysql
.
Str
`json:"picUrl"`
EffectUrl
mysql
.
Str
`json:"effectUrl"`
ReverseEffectUrl
mysql
.
Str
`json:"reverseEffectUrl"`
TimeLeft
int64
`json:"timeLeft"`
// 离到期还有多少秒(过期则是负数)
HeadwearIcon
string
`json:"headwearIcon"`
}
type
CvHeadwearDiamond
struct
{
...
...
@@ -61,11 +62,12 @@ func GetHeadwearList(db *gorm.DB, userId uint64) ([]CvHeadwear, error) {
// TODO: 没过期并且有设置using的,才算是,因为写入方不维护using状态的更新
isUsing
:=
i
.
Using
==
headwear_e
.
YesUsing
&&
i
.
EndTime
.
After
(
now
)
result
=
append
(
result
,
CvHeadwear
{
Id
:
i
.
HeadwearId
,
PicUrl
:
resHwMap
[
i
.
HeadwearId
]
.
PicUrl
,
EffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
EffectUrl
,
Using
:
isUsing
,
TimeLeft
:
i
.
EndTime
.
Unix
()
-
now
.
Unix
(),
Id
:
i
.
HeadwearId
,
PicUrl
:
resHwMap
[
i
.
HeadwearId
]
.
PicUrl
,
EffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
EffectUrl
,
ReverseEffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
ReverseEffectUrl
,
Using
:
isUsing
,
TimeLeft
:
i
.
EndTime
.
Unix
()
-
now
.
Unix
(),
})
if
isUsing
{
hasUsing
=
true
...
...
@@ -100,10 +102,11 @@ func GetCvHeadwear(userId uint64) (*CvHeadwear, error) {
return
nil
,
myerr
.
WrapErr
(
err
)
}
return
&
CvHeadwear
{
Id
:
userHeadwear
.
HeadwearId
,
PicUrl
:
resHeadwear
.
PicUrl
,
EffectUrl
:
resHeadwear
.
EffectUrl
,
Using
:
userHeadwear
.
Using
==
headwear_e
.
YesUsing
,
Id
:
userHeadwear
.
HeadwearId
,
PicUrl
:
resHeadwear
.
PicUrl
,
EffectUrl
:
resHeadwear
.
EffectUrl
,
ReverseEffectUrl
:
resHeadwear
.
ReverseEffectUrl
,
Using
:
userHeadwear
.
Using
==
headwear_e
.
YesUsing
,
},
nil
}
...
...
@@ -159,11 +162,12 @@ func BatchGetCvHeadwears(userIds []uint64) (map[uint64]CvHeadwear, error) {
headwear
,
flag
:=
resHeadwearMap
[
r
.
HeadwearId
]
if
flag
{
result
[
r
.
UserId
]
=
CvHeadwear
{
Id
:
headwear
.
ID
,
PicUrl
:
headwear
.
PicUrl
,
EffectUrl
:
headwear
.
EffectUrl
,
Using
:
r
.
Using
==
headwear_e
.
YesUsing
,
HeadwearIcon
:
response
[
r
.
UserId
],
Id
:
headwear
.
ID
,
PicUrl
:
headwear
.
PicUrl
,
EffectUrl
:
headwear
.
EffectUrl
,
ReverseEffectUrl
:
headwear
.
ReverseEffectUrl
,
Using
:
r
.
Using
==
headwear_e
.
YesUsing
,
HeadwearIcon
:
response
[
r
.
UserId
],
}
}
...
...
domain/model/res_m/headwear.go
View file @
dc465373
...
...
@@ -9,10 +9,11 @@ import (
type
ResHeadwear
struct
{
mysql
.
Entity
*
domain
.
Model
`gorm:"-"`
Name
mysql
.
Str
PicUrl
mysql
.
Str
EffectUrl
mysql
.
Str
*
domain
.
Model
`gorm:"-"`
Name
mysql
.
Str
PicUrl
mysql
.
Str
EffectUrl
mysql
.
Str
ReverseEffectUrl
mysql
.
Str
}
//矛盾,项目负责人(产品不接受 商品 同上架分开两个数据结构的模式),又在页面上要求头饰同价格在一起展示,修改。
...
...
@@ -134,4 +135,4 @@ func GetResHeadwearMap(db *gorm.DB) (map[uint64]ResHeadwear, error) {
result
[
i
.
ID
]
=
i
}
return
result
,
nil
}
\ No newline at end of file
}
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