Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
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
hujiebin
hilo-group
Commits
09debcec
Commit
09debcec
authored
Jun 27, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
默认国家给沙特
parent
6e2e4198
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
country.go
domain/model/user_m/country.go
+8
-2
No files found.
domain/model/user_m/country.go
View file @
09debcec
...
...
@@ -3,10 +3,12 @@ package user_m
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
"hilo-group/myerr"
)
//获取用户的国家,和所属的区域(是否阿语区)
// 获取用户的国家,和所属的区域(是否阿语区)
// 默认国家给沙特
func
GetUserCountryArea
(
model
*
domain
.
Model
,
id
mysql
.
ID
)
(
string
,
int
,
error
)
{
type
info
struct
{
Name
string
...
...
@@ -14,7 +16,11 @@ func GetUserCountryArea(model *domain.Model, id mysql.ID) (string, int, error) {
}
res
:=
new
(
info
)
if
err
:=
model
.
DB
()
.
Raw
(
"select name, area from res_country where name = (select country from user where id = ?)"
,
id
)
.
First
(
&
res
)
.
Error
;
err
!=
nil
{
return
""
,
0
,
myerr
.
WrapErr
(
err
)
if
err
!=
gorm
.
ErrRecordNotFound
{
return
""
,
0
,
myerr
.
WrapErr
(
err
)
}
// gorm.ErrRecordNotFound
return
"KSA"
,
1
,
nil
}
return
res
.
Name
,
res
.
Area
,
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