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
fbb2d85e
Commit
fbb2d85e
authored
Jul 10, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
座驾cp头像
parent
e6a49662
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
user.go
cv/user_cv/user.go
+9
-4
user.go
domain/model/user_m/user.go
+18
-0
No files found.
cv/user_cv/user.go
View file @
fbb2d85e
...
@@ -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
)
if
err
!=
nil
{
for
_
,
v
:=
range
[]
int
{
1
,
2
}
{
return
nil
,
err
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
,
v
)
if
err
!=
nil
{
return
nil
,
err
}
propertiesArea
[
v
]
=
properties
}
}
properties
,
err
:=
GetPropertyAll
(
mysql
.
Db
,
myArea
)
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/user_m/user.go
View file @
fbb2d85e
...
@@ -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
}
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