Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
chenchuanwen
my-yaf-project
Commits
a6c4f287
Commit
a6c4f287
authored
Dec 01, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
省市测试
parent
ab9b3a5c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
AreaUtil.php
application/library/Area/AreaUtil.php
+2
-0
Area.php
application/models/DAO/Area.php
+3
-0
No files found.
application/library/Area/AreaUtil.php
View file @
a6c4f287
...
@@ -14,12 +14,14 @@ class AreaUtil {
...
@@ -14,12 +14,14 @@ class AreaUtil {
var_dump
(
$ip
);
var_dump
(
$ip
);
}
}
$cityData
=
\Our\Common
::
getIpCity
(
$ip
);
$cityData
=
\Our\Common
::
getIpCity
(
$ip
);
var_dump
(
$cityData
);
$provinceId
=
\Our\ApiConst
::
zero
;
$provinceId
=
\Our\ApiConst
::
zero
;
$cityId
=
\Our\ApiConst
::
zero
;
$cityId
=
\Our\ApiConst
::
zero
;
switch
(
$cityData
[
'country'
]){
switch
(
$cityData
[
'country'
]){
case
\Our\NameConst
::
China
:
case
\Our\NameConst
::
China
:
if
(
$cityData
[
'region'
]){
if
(
$cityData
[
'region'
]){
$province
=
mb_substr
(
$cityData
[
'region'
],
0
,
2
);
$province
=
mb_substr
(
$cityData
[
'region'
],
0
,
2
);
var_dump
(
$province
);
$provinceObj
=
\DAO\AreaModel
::
getInstance
()
->
getOne
(
array
(
'area_deep'
=>
1
,
'area_name'
=>
array
(
'like'
,
$province
.
'%'
)),
'area_id,area_name'
);
$provinceObj
=
\DAO\AreaModel
::
getInstance
()
->
getOne
(
array
(
'area_deep'
=>
1
,
'area_name'
=>
array
(
'like'
,
$province
.
'%'
)),
'area_id,area_name'
);
if
(
$provinceObj
){
if
(
$provinceObj
){
$provinceId
=
$provinceObj
[
'area_id'
];
$provinceId
=
$provinceObj
[
'area_id'
];
...
...
application/models/DAO/Area.php
View file @
a6c4f287
...
@@ -28,6 +28,9 @@ class AreaModel extends \DAO\AbstractModel {
...
@@ -28,6 +28,9 @@ class AreaModel extends \DAO\AbstractModel {
public
function
getOne
(
$where
,
$field
=
\Our\NameConst
::
allField
){
public
function
getOne
(
$where
,
$field
=
\Our\NameConst
::
allField
){
$this
->
setDb
(
$this
->
dbName
);
$this
->
setDb
(
$this
->
dbName
);
if
(
is_array
(
$where
)){
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
return
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
}
}
...
...
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