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
823b8882
Commit
823b8882
authored
Jul 10, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Plain Diff
merge master
parents
536911b7
2c323d3c
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
25 deletions
+78
-25
bag.go
cv/user_cv/bag.go
+1
-0
user.go
cv/user_cv/user.go
+9
-4
gift.go
domain/model/res_m/gift.go
+1
-0
user.go
domain/model/user_m/user.go
+18
-0
user.go
domain/service/user_s/user.go
+2
-2
response.go
resp/response.go
+19
-6
middleHandle.go
route/middleHandle.go
+13
-0
router.go
route/router.go
+2
-2
bag.go
route/user_r/bag.go
+13
-11
No files found.
cv/user_cv/bag.go
View file @
823b8882
...
@@ -16,6 +16,7 @@ type UserBag struct {
...
@@ -16,6 +16,7 @@ type UserBag struct {
Count
mysql
.
Num
`json:"count"`
// 拥有数量
Count
mysql
.
Num
`json:"count"`
// 拥有数量
RemainDays
int
`json:"remainDays"`
// 有效天数
RemainDays
int
`json:"remainDays"`
// 有效天数
TextStyleList
[]
*
TextStyle
`json:"textStyleList"`
// 文本样式
TextStyleList
[]
*
TextStyle
`json:"textStyleList"`
// 文本样式
HasGiftText
bool
`json:"hasGiftText"`
// 是否有礼物文字
}
}
type
TextStyle
struct
{
type
TextStyle
struct
{
...
...
cv/user_cv/user.go
View file @
823b8882
...
@@ -151,11 +151,15 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
...
@@ -151,11 +151,15 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
//rp := res_m.ResProperty{}
//rp := res_m.ResProperty{}
//properties, err := rp.GetAll(mysql.Db)
//properties, err := rp.GetAll(mysql.Db)
_
,
myArea
,
err
:=
user_m
.
GetUserCountryArea
(
domain
.
CreateModelNil
(),
myUserId
)
propertiesArea
:=
make
(
map
[
int
]
map
[
uint64
]
property_cv
.
CvProperty
)
for
_
,
v
:=
range
[]
int
{
1
,
2
}
{
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
,
v
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
,
myArea
)
propertiesArea
[
v
]
=
properties
}
areaMap
,
err
:=
user_m
.
GetUserAreaMap
(
domain
.
CreateModelNil
(),
userIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -173,6 +177,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
...
@@ -173,6 +177,7 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
cvUserBases
:=
[]
*
CvUserBase
{}
cvUserBases
:=
[]
*
CvUserBase
{}
for
i
:=
0
;
i
<
len
(
users
);
i
++
{
for
i
:=
0
;
i
<
len
(
users
);
i
++
{
user
:=
users
[
i
]
user
:=
users
[
i
]
properties
:=
propertiesArea
[
areaMap
[
user
.
ID
]]
invisible
:=
IfLogout
(
user
.
LogoutTime
)
invisible
:=
IfLogout
(
user
.
LogoutTime
)
invisibleAvatar
:=
""
invisibleAvatar
:=
""
invisibleNick
:=
user
.
Code
invisibleNick
:=
user
.
Code
...
...
domain/model/res_m/gift.go
View file @
823b8882
...
@@ -22,6 +22,7 @@ type ResGift struct {
...
@@ -22,6 +22,7 @@ type ResGift struct {
Together
bool
Together
bool
Status
mysql
.
UserYesNo
Status
mysql
.
UserYesNo
GiftType
mysql
.
Type
GiftType
mysql
.
Type
HasGiftText
bool
}
}
// 获取所有的礼物
// 获取所有的礼物
...
...
domain/model/user_m/user.go
View file @
823b8882
...
@@ -157,3 +157,21 @@ func GetUserCountryArea(model *domain.Model, userId mysql.ID) (string, int, erro
...
@@ -157,3 +157,21 @@ func GetUserCountryArea(model *domain.Model, userId mysql.ID) (string, int, erro
}
}
return
res
.
Name
,
res
.
Area
,
nil
return
res
.
Name
,
res
.
Area
,
nil
}
}
//获取用户的国家所属的区域(是否阿语区)
func
GetUserAreaMap
(
model
*
domain
.
Model
,
userIds
[]
mysql
.
ID
)
(
map
[
mysql
.
ID
]
int
,
error
)
{
type
info
struct
{
Id
mysql
.
ID
Area
int
}
rows
:=
make
([]
*
info
,
0
)
sql
:=
"select user.id, rc.area from user left join res_country rc on user.country = rc.name where user.id in (?);"
if
err
:=
model
.
DB
()
.
Raw
(
sql
,
userIds
)
.
Scan
(
&
rows
)
.
Error
;
err
!=
nil
{
return
nil
,
myerr
.
WrapErr
(
err
)
}
res
:=
make
(
map
[
mysql
.
ID
]
int
)
for
_
,
v
:=
range
rows
{
res
[
v
.
Id
]
=
v
.
Area
}
return
res
,
nil
}
domain/service/user_s/user.go
View file @
823b8882
...
@@ -172,11 +172,11 @@ func (s *UserService) GetUserDetail(userId mysql.ID, myUserId mysql.ID, lang str
...
@@ -172,11 +172,11 @@ func (s *UserService) GetUserDetail(userId mysql.ID, myUserId mysql.ID, lang str
//rp := res_m.ResProperty{}
//rp := res_m.ResProperty{}
//properties, err := rp.GetAll(mysql.Db)
//properties, err := rp.GetAll(mysql.Db)
_
,
myArea
,
err
:=
user_m
.
GetUserCountryArea
(
model
,
myU
serId
)
_
,
area
,
err
:=
user_m
.
GetUserCountryArea
(
model
,
u
serId
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
properties
,
err
:=
property_cv
.
GetPropertyAll
(
mysql
.
Db
,
myA
rea
)
properties
,
err
:=
property_cv
.
GetPropertyAll
(
mysql
.
Db
,
a
rea
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
resp/response.go
View file @
823b8882
...
@@ -3,6 +3,7 @@ package resp
...
@@ -3,6 +3,7 @@ package resp
import
(
import
(
"encoding/json"
"encoding/json"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"hilo-user/myerr"
"hilo-user/myerr"
"hilo-user/req"
"hilo-user/req"
...
@@ -15,6 +16,7 @@ type Response struct {
...
@@ -15,6 +16,7 @@ type Response struct {
MessageData
interface
{}
`json:"messageData"`
// 消息详情
MessageData
interface
{}
`json:"messageData"`
// 消息详情
OperationMessage
interface
{}
`json:"operationMessage"`
// 操作消息
OperationMessage
interface
{}
`json:"operationMessage"`
// 操作消息
Data
interface
{}
`json:"data"`
// 数据
Data
interface
{}
`json:"data"`
// 数据
Edata
interface
{}
`json:"edata"`
// 加密数据
}
}
type
GameResponse
struct
{
type
GameResponse
struct
{
...
@@ -36,7 +38,12 @@ func ResponseOk(c *gin.Context, data interface{}) {
...
@@ -36,7 +38,12 @@ func ResponseOk(c *gin.Context, data interface{}) {
Code
:
myerr
.
GetSuccessCode
(),
Code
:
myerr
.
GetSuccessCode
(),
Message
:
myerr
.
GetSuccessMsg
(),
Message
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
Data
:
data
,
}
if
_
,
ok
:=
c
.
Get
(
mycontext
.
InnerEncrypt
);
ok
{
//response.Edata = utils.EncryptionData(data, []byte("484194d4d0f968a7"))
response
.
Edata
=
utils
.
EncryptionData
(
data
,
[]
byte
(
"hilo!@#$%^&*()_+"
))
}
else
{
response
.
Data
=
data
}
}
printResponseBody
(
c
,
&
response
)
printResponseBody
(
c
,
&
response
)
...
@@ -50,15 +57,21 @@ func ResponsePageBaseOk(c *gin.Context, data interface{}, nextPageIndex int, has
...
@@ -50,15 +57,21 @@ func ResponsePageBaseOk(c *gin.Context, data interface{}, nextPageIndex int, has
if
data
==
nil
{
if
data
==
nil
{
data
=
make
([]
interface
{},
0
)
data
=
make
([]
interface
{},
0
)
}
}
pageData
:=
req
.
PageRespBase
{
NextPageIndex
:
nextPageIndex
,
HasNextPage
:
hasNextPage
,
Data
:
data
,
}
response
:=
Response
{
response
:=
Response
{
Code
:
myerr
.
GetSuccessCode
(),
Code
:
myerr
.
GetSuccessCode
(),
Message
:
myerr
.
GetSuccessMsg
(),
Message
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
OperationMessage
:
myerr
.
GetSuccessMsg
(),
Data
:
req
.
PageRespBase
{
}
NextPageIndex
:
nextPageIndex
,
if
_
,
ok
:=
c
.
Get
(
mycontext
.
InnerEncrypt
);
ok
{
HasNextPage
:
hasNextPage
,
//response.Edata = utils.EncryptionData(data, []byte("484194d4d0f968a7"))
Data
:
data
,
response
.
Edata
=
utils
.
EncryptionData
(
pageData
,
[]
byte
(
"hilo!@#$%^&*()_+"
))
},
}
else
{
response
.
Data
=
pageData
}
}
c
.
JSON
(
http
.
StatusOK
,
response
)
c
.
JSON
(
http
.
StatusOK
,
response
)
}
}
...
...
route/middleHandle.go
View file @
823b8882
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/mylogrus"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/utils"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"hilo-user/myerr/bizerr"
"hilo-user/myerr/bizerr"
"hilo-user/req"
"hilo-user/req"
...
@@ -137,6 +138,18 @@ func LoggerHandle(c *gin.Context) {
...
@@ -137,6 +138,18 @@ func LoggerHandle(c *gin.Context) {
mycontext
.
CreateMyContext
(
c
.
Keys
)
.
Log
.
Infof
(
"request end fullPath:%v,url:%v, method: %v, traceId:%v, latency:%v userId:%v"
,
c
.
FullPath
(),
reqUri
,
method
,
traceId
,
latency
,
userId
)
mycontext
.
CreateMyContext
(
c
.
Keys
)
.
Log
.
Infof
(
"request end fullPath:%v,url:%v, method: %v, traceId:%v, latency:%v userId:%v"
,
c
.
FullPath
(),
reqUri
,
method
,
traceId
,
latency
,
userId
)
}
}
// 加密Handle
func
EncryptHandle
(
c
*
gin
.
Context
)
{
header
:=
c
.
Request
.
Header
appVersion
:=
header
.
Get
(
"Appversion"
)
if
len
(
appVersion
)
>
0
{
if
high
,
_
:=
utils
.
CompareVersion
(
appVersion
,
"> 3.9.0"
);
high
{
c
.
Set
(
mycontext
.
InnerEncrypt
,
true
)
}
}
c
.
Next
()
}
//http信息解密(web)
//http信息解密(web)
func
HttpWebSecretHandle
(
c
*
gin
.
Context
)
{
func
HttpWebSecretHandle
(
c
*
gin
.
Context
)
{
traceId
,
_
:=
c
.
Keys
[
mycontext
.
TRACEID
]
traceId
,
_
:=
c
.
Keys
[
mycontext
.
TRACEID
]
...
...
route/router.go
View file @
823b8882
...
@@ -29,8 +29,8 @@ func InitRouter() *gin.Engine {
...
@@ -29,8 +29,8 @@ func InitRouter() *gin.Engine {
{
{
user
.
GET
(
"/nameplate"
,
wrapper
(
user_r
.
UserNameplate
))
user
.
GET
(
"/nameplate"
,
wrapper
(
user_r
.
UserNameplate
))
user
.
GET
(
"/bag/:resType"
,
wrapper
(
user_r
.
UserBag
))
user
.
GET
(
"/bag/:resType"
,
wrapper
(
user_r
.
UserBag
))
user
.
GET
(
"/detail"
,
wrapper
(
user_r
.
UserDetail
))
user
.
GET
(
"/detail"
,
EncryptHandle
,
wrapper
(
user_r
.
UserDetail
))
user
.
GET
(
"/detail/:userExternalId"
,
wrapper
(
user_r
.
UserDetailByExternalId
))
user
.
GET
(
"/detail/:userExternalId"
,
EncryptHandle
,
wrapper
(
user_r
.
UserDetailByExternalId
))
}
}
cp
:=
v2
.
Group
(
"/cp"
)
cp
:=
v2
.
Group
(
"/cp"
)
{
{
...
...
route/user_r/bag.go
View file @
823b8882
...
@@ -56,12 +56,14 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -56,12 +56,14 @@ func UserBag(c *gin.Context) (*mycontext.MyContext, error) {
SvgaUrl
:
gift
.
SvagUrl
,
SvgaUrl
:
gift
.
SvagUrl
,
Count
:
bagGift
.
Count
,
Count
:
bagGift
.
Count
,
RemainDays
:
int
(
bagGift
.
EndTime
.
Sub
(
time
.
Now
())
.
Hours
()
/
24
),
RemainDays
:
int
(
bagGift
.
EndTime
.
Sub
(
time
.
Now
())
.
Hours
()
/
24
),
HasGiftText
:
gift
.
HasGiftText
,
}
}
if
gift
.
ID
==
cp_e
.
CpConfessionGiftId
{
// 如果是cp告白礼物
if
gift
.
ID
==
cp_e
.
CpConfessionGiftId
||
gift
.
HasGiftText
{
// 如果是cp告白礼物
info
.
TextStyleList
=
make
([]
*
user_cv
.
TextStyle
,
0
,
2
)
info
.
TextStyleList
=
make
([]
*
user_cv
.
TextStyle
,
0
,
2
)
info
.
TextStyleList
=
append
(
info
.
TextStyleList
,
info
.
TextStyleList
=
append
(
info
.
TextStyleList
,
&
user_cv
.
TextStyle
{
TextColor
:
"#ce0083"
,
TextSize
:
20
,
TextKey
:
"sender_name"
},
&
user_cv
.
TextStyle
{
TextColor
:
"#ce0083"
,
TextSize
:
20
,
TextKey
:
"sender_name"
},
&
user_cv
.
TextStyle
{
TextColor
:
"#ce0083"
,
TextSize
:
20
,
TextKey
:
"receiver_name"
},
&
user_cv
.
TextStyle
{
TextColor
:
"#ce0083"
,
TextSize
:
20
,
TextKey
:
"receiver_name"
},
&
user_cv
.
TextStyle
{
TextColor
:
"#FFFFFF"
,
TextSize
:
40
,
TextKey
:
"gift_text"
},
)
)
}
}
...
...
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