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 (
...
@@ -14,12 +14,13 @@ import (
)
)
type
CvHeadwear
struct
{
type
CvHeadwear
struct
{
Id
uint64
`json:"id"`
Id
uint64
`json:"id"`
Using
bool
`json:"using"`
Using
bool
`json:"using"`
PicUrl
mysql
.
Str
`json:"picUrl"`
PicUrl
mysql
.
Str
`json:"picUrl"`
EffectUrl
mysql
.
Str
`json:"effectUrl"`
EffectUrl
mysql
.
Str
`json:"effectUrl"`
TimeLeft
int64
`json:"timeLeft"`
// 离到期还有多少秒(过期则是负数)
ReverseEffectUrl
mysql
.
Str
`json:"reverseEffectUrl"`
HeadwearIcon
string
`json:"headwearIcon"`
TimeLeft
int64
`json:"timeLeft"`
// 离到期还有多少秒(过期则是负数)
HeadwearIcon
string
`json:"headwearIcon"`
}
}
type
CvHeadwearDiamond
struct
{
type
CvHeadwearDiamond
struct
{
...
@@ -61,11 +62,12 @@ func GetHeadwearList(db *gorm.DB, userId uint64) ([]CvHeadwear, error) {
...
@@ -61,11 +62,12 @@ func GetHeadwearList(db *gorm.DB, userId uint64) ([]CvHeadwear, error) {
// TODO: 没过期并且有设置using的,才算是,因为写入方不维护using状态的更新
// TODO: 没过期并且有设置using的,才算是,因为写入方不维护using状态的更新
isUsing
:=
i
.
Using
==
headwear_e
.
YesUsing
&&
i
.
EndTime
.
After
(
now
)
isUsing
:=
i
.
Using
==
headwear_e
.
YesUsing
&&
i
.
EndTime
.
After
(
now
)
result
=
append
(
result
,
CvHeadwear
{
result
=
append
(
result
,
CvHeadwear
{
Id
:
i
.
HeadwearId
,
Id
:
i
.
HeadwearId
,
PicUrl
:
resHwMap
[
i
.
HeadwearId
]
.
PicUrl
,
PicUrl
:
resHwMap
[
i
.
HeadwearId
]
.
PicUrl
,
EffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
EffectUrl
,
EffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
EffectUrl
,
Using
:
isUsing
,
ReverseEffectUrl
:
resHwMap
[
i
.
HeadwearId
]
.
ReverseEffectUrl
,
TimeLeft
:
i
.
EndTime
.
Unix
()
-
now
.
Unix
(),
Using
:
isUsing
,
TimeLeft
:
i
.
EndTime
.
Unix
()
-
now
.
Unix
(),
})
})
if
isUsing
{
if
isUsing
{
hasUsing
=
true
hasUsing
=
true
...
@@ -100,10 +102,11 @@ func GetCvHeadwear(userId uint64) (*CvHeadwear, error) {
...
@@ -100,10 +102,11 @@ func GetCvHeadwear(userId uint64) (*CvHeadwear, error) {
return
nil
,
myerr
.
WrapErr
(
err
)
return
nil
,
myerr
.
WrapErr
(
err
)
}
}
return
&
CvHeadwear
{
return
&
CvHeadwear
{
Id
:
userHeadwear
.
HeadwearId
,
Id
:
userHeadwear
.
HeadwearId
,
PicUrl
:
resHeadwear
.
PicUrl
,
PicUrl
:
resHeadwear
.
PicUrl
,
EffectUrl
:
resHeadwear
.
EffectUrl
,
EffectUrl
:
resHeadwear
.
EffectUrl
,
Using
:
userHeadwear
.
Using
==
headwear_e
.
YesUsing
,
ReverseEffectUrl
:
resHeadwear
.
ReverseEffectUrl
,
Using
:
userHeadwear
.
Using
==
headwear_e
.
YesUsing
,
},
nil
},
nil
}
}
...
@@ -159,11 +162,12 @@ func BatchGetCvHeadwears(userIds []uint64) (map[uint64]CvHeadwear, error) {
...
@@ -159,11 +162,12 @@ func BatchGetCvHeadwears(userIds []uint64) (map[uint64]CvHeadwear, error) {
headwear
,
flag
:=
resHeadwearMap
[
r
.
HeadwearId
]
headwear
,
flag
:=
resHeadwearMap
[
r
.
HeadwearId
]
if
flag
{
if
flag
{
result
[
r
.
UserId
]
=
CvHeadwear
{
result
[
r
.
UserId
]
=
CvHeadwear
{
Id
:
headwear
.
ID
,
Id
:
headwear
.
ID
,
PicUrl
:
headwear
.
PicUrl
,
PicUrl
:
headwear
.
PicUrl
,
EffectUrl
:
headwear
.
EffectUrl
,
EffectUrl
:
headwear
.
EffectUrl
,
Using
:
r
.
Using
==
headwear_e
.
YesUsing
,
ReverseEffectUrl
:
headwear
.
ReverseEffectUrl
,
HeadwearIcon
:
response
[
r
.
UserId
],
Using
:
r
.
Using
==
headwear_e
.
YesUsing
,
HeadwearIcon
:
response
[
r
.
UserId
],
}
}
}
}
...
...
domain/model/res_m/headwear.go
View file @
dc465373
...
@@ -9,10 +9,11 @@ import (
...
@@ -9,10 +9,11 @@ import (
type
ResHeadwear
struct
{
type
ResHeadwear
struct
{
mysql
.
Entity
mysql
.
Entity
*
domain
.
Model
`gorm:"-"`
*
domain
.
Model
`gorm:"-"`
Name
mysql
.
Str
Name
mysql
.
Str
PicUrl
mysql
.
Str
PicUrl
mysql
.
Str
EffectUrl
mysql
.
Str
EffectUrl
mysql
.
Str
ReverseEffectUrl
mysql
.
Str
}
}
//矛盾,项目负责人(产品不接受 商品 同上架分开两个数据结构的模式),又在页面上要求头饰同价格在一起展示,修改。
//矛盾,项目负责人(产品不接受 商品 同上架分开两个数据结构的模式),又在页面上要求头饰同价格在一起展示,修改。
...
@@ -134,4 +135,4 @@ func GetResHeadwearMap(db *gorm.DB) (map[uint64]ResHeadwear, error) {
...
@@ -134,4 +135,4 @@ func GetResHeadwearMap(db *gorm.DB) (map[uint64]ResHeadwear, error) {
result
[
i
.
ID
]
=
i
result
[
i
.
ID
]
=
i
}
}
return
result
,
nil
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