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
ae256c50
Commit
ae256c50
authored
Jun 26, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cp座驾
parent
f19b2537
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
6 deletions
+28
-6
property.go
cv/property_cv/property.go
+2
-2
user.go
cv/user_cv/user.go
+7
-3
property.go
domain/model/res_m/property.go
+1
-0
user.go
domain/model/user_m/user.go
+13
-0
user.go
domain/service/user_s/user.go
+5
-1
No files found.
cv/property_cv/property.go
View file @
ae256c50
...
@@ -95,7 +95,7 @@ func GetPropertyById(resPropertyId mysql.ID) (CvProperty, error) {
...
@@ -95,7 +95,7 @@ func GetPropertyById(resPropertyId mysql.ID) (CvProperty, error) {
},
nil
},
nil
}
}
func
GetPropertyAll
(
db
*
gorm
.
DB
)
(
map
[
uint64
]
CvProperty
,
error
)
{
func
GetPropertyAll
(
db
*
gorm
.
DB
,
area
int
)
(
map
[
uint64
]
CvProperty
,
error
)
{
rp
:=
res_m
.
ResProperty
{}
rp
:=
res_m
.
ResProperty
{}
properties
,
err
:=
rp
.
GetAll
(
mysql
.
Db
)
properties
,
err
:=
rp
.
GetAll
(
mysql
.
Db
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -103,7 +103,7 @@ func GetPropertyAll(db *gorm.DB) (map[uint64]CvProperty, error) {
...
@@ -103,7 +103,7 @@ func GetPropertyAll(db *gorm.DB) (map[uint64]CvProperty, error) {
}
}
//获取座驾头像
//获取座驾头像
propertieAvatarMap
,
err
:=
(
&
res_m
.
ResPropertyAvatar
{})
.
GetAll
(
mysql
.
Db
)
propertieAvatarMap
,
err
:=
(
&
res_m
.
ResPropertyAvatar
{
Area
:
area
})
.
GetAll
(
mysql
.
Db
)
userIds
:=
[]
uint64
{}
userIds
:=
[]
uint64
{}
for
_
,
value
:=
range
propertieAvatarMap
{
for
_
,
value
:=
range
propertieAvatarMap
{
...
...
cv/user_cv/user.go
View file @
ae256c50
...
@@ -151,7 +151,11 @@ func GetUserBases(userIds []mysql.ID, myUserId mysql.ID) ([]*CvUserBase, error)
...
@@ -151,7 +151,11 @@ 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)
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
)
_
,
myArea
,
err
:=
user_m
.
GetUserCountryArea
(
domain
.
CreateModelNil
(),
myUserId
)
if
err
!=
nil
{
return
nil
,
err
}
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
,
myArea
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -338,7 +342,7 @@ func getMedalInfoMap(db *gorm.DB, medals map[uint64][]uint32) (map[uint64][]uint
...
@@ -338,7 +342,7 @@ func getMedalInfoMap(db *gorm.DB, medals map[uint64][]uint32) (map[uint64][]uint
return
medalIds
,
medalMap
,
nil
return
medalIds
,
medalMap
,
nil
}
}
func
GetPropertyAll
(
db
*
gorm
.
DB
)
(
map
[
uint64
]
property_cv
.
CvProperty
,
error
)
{
func
GetPropertyAll
(
db
*
gorm
.
DB
,
area
int
)
(
map
[
uint64
]
property_cv
.
CvProperty
,
error
)
{
rp
:=
res_m
.
ResProperty
{}
rp
:=
res_m
.
ResProperty
{}
properties
,
err
:=
rp
.
GetAll
(
mysql
.
Db
)
properties
,
err
:=
rp
.
GetAll
(
mysql
.
Db
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -346,7 +350,7 @@ func GetPropertyAll(db *gorm.DB) (map[uint64]property_cv.CvProperty, error) {
...
@@ -346,7 +350,7 @@ func GetPropertyAll(db *gorm.DB) (map[uint64]property_cv.CvProperty, error) {
}
}
//获取座驾头像
//获取座驾头像
propertyAvatarMap
,
err
:=
(
&
res_m
.
ResPropertyAvatar
{})
.
GetAll
(
mysql
.
Db
)
propertyAvatarMap
,
err
:=
(
&
res_m
.
ResPropertyAvatar
{
Area
:
area
})
.
GetAll
(
mysql
.
Db
)
var
userIds
[]
uint64
var
userIds
[]
uint64
for
_
,
value
:=
range
propertyAvatarMap
{
for
_
,
value
:=
range
propertyAvatarMap
{
...
...
domain/model/res_m/property.go
View file @
ae256c50
...
@@ -33,6 +33,7 @@ type ResPropertyAvatar struct {
...
@@ -33,6 +33,7 @@ type ResPropertyAvatar struct {
Type
res_e
.
ResPropertyAvatarType
Type
res_e
.
ResPropertyAvatarType
SendUserId
mysql
.
ID
SendUserId
mysql
.
ID
ReceiverUserId
mysql
.
ID
ReceiverUserId
mysql
.
ID
Area
int
}
}
func
InitResPropertyDiamond
(
model
*
domain
.
Model
,
resPropertyId
mysql
.
ID
,
diamondNum
mysql
.
Num
,
second
mysql
.
Num
)
*
ResPropertyDiamond
{
func
InitResPropertyDiamond
(
model
*
domain
.
Model
,
resPropertyId
mysql
.
ID
,
diamondNum
mysql
.
Num
,
second
mysql
.
Num
)
*
ResPropertyDiamond
{
...
...
domain/model/user_m/user.go
View file @
ae256c50
...
@@ -144,3 +144,16 @@ func GetUsers(model *domain.Model, ids []mysql.ID) ([]*User, error) {
...
@@ -144,3 +144,16 @@ func GetUsers(model *domain.Model, ids []mysql.ID) ([]*User, error) {
}
}
return
res
,
nil
return
res
,
nil
}
}
//获取用户的国家,和所属的区域(是否阿语区)
func
GetUserCountryArea
(
model
*
domain
.
Model
,
userId
mysql
.
ID
)
(
string
,
int
,
error
)
{
type
info
struct
{
Name
string
Area
int
}
res
:=
new
(
info
)
if
err
:=
model
.
Db
.
WithContext
(
model
.
Context
)
.
Raw
(
"select name, area from res_country where name = (select country from user where id = ?)"
,
userId
)
.
First
(
&
res
)
.
Error
;
err
!=
nil
{
return
""
,
0
,
myerr
.
WrapErr
(
err
)
}
return
res
.
Name
,
res
.
Area
,
nil
}
domain/service/user_s/user.go
View file @
ae256c50
...
@@ -172,7 +172,11 @@ func (s *UserService) GetUserDetail(userId mysql.ID, myUserId mysql.ID, lang str
...
@@ -172,7 +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)
properties
,
err
:=
property_cv
.
GetPropertyAll
(
mysql
.
Db
)
_
,
myArea
,
err
:=
user_m
.
GetUserCountryArea
(
model
,
myUserId
)
if
err
!=
nil
{
return
nil
,
err
}
properties
,
err
:=
property_cv
.
GetPropertyAll
(
mysql
.
Db
,
myArea
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
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